Przejdź do treści

WLD - world manipulation functions

Functions related to the world.

Functions

Wld_AssignRoomToGuild

Wld_AssignRoomToGuild

Assigns a room to a guild

func void Wld_AssignRoomToGuild(var string room, var int guild) 

Parameters

  • var string room - name of the room as defined in the portal
  • var int guild - guild ID

Wld_AssignRoomToNpc

Wld_AssignRoomToNpc

Assigns a room to a specific NPC

func void Wld_AssignRoomToNpc(var string room, var C_NPC owner) 

Parameters

  • var string room - name of the room as defined in the portal
  • var C_NPC owner - instance of the room owner

Wld_DetectItem

Wld_DetectItem

Detects an item with the specified flags

func int Wld_DetectItem(var C_NPC npc, var int flags) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var int flags - item flags

Globals

  • item - set to the item if detected

Return value
The function returns TRUE if the item is found, FALSE otherwise

Wld_DetectNpc

Wld_DetectNpc

Detects an NPC based on instance name, guild and AI state

func int Wld_DetectNpc(var C_NPC npc, var int instancename, var func state, var int guild) 

Parameters

  • var C_NPC npc - instance of the detector NPC
  • var int instancename - instance name of the detected NPC (-1 for any)
  • var func state - ZS state function of the detected NPC
  • var int guild - guild ID of the detected NPC (-1 for any)

Globals

  • other - set to the detected NPC

Return value
The function returns TRUE if the NPC is detected, FALSE otherwise

Wld_DetectNpcEx

Wld_DetectNpcEx

Detects an NPC based on instance name, guild and AI state with oprion to ignore player

func int Wld_DetectNpcEx(var C_NPC npc, var int instancename, var func state, var int guild, var int detectplayer) 

Parameters

  • var C_NPC npc - instance of the detector NPC
  • var int instancename - instance name of the detected NPC (-1 for any)
  • var func state - ZS state function of the detected NPC
  • var int guild - guild ID of the detected NPC (-1 for any)
  • var int detectplayer - 1 to detect player, 0 to ignore player

Globals

  • other - set to the detected NPC

Return value
The function returns TRUE if the NPC is detected, FALSE otherwise

Wld_DetectNpcExAtt

Wld_DetectNpcExAtt

Detects an NPC based on instance name, guild, AI state and attitude with oprion to ignore player

func int Wld_DetectNpcExAtt(var C_NPC npc, var int instancename, var func state, var int guild, var int detectplayer, var int attitude) 

Parameters

  • var C_NPC npc - instance of the detector NPC
  • var int instancename - instance name of the detected NPC (-1 for any)
  • var func state - ZS state function of the detected NPC
  • var int guild - guild ID of the detected NPC (-1 for any)
  • var int detectplayer - 1 to detect player, 0 to ignore player
  • var int attitude - attitude of the detected NPC (ATT_ constants)

Globals

  • other - set to the detected NPC

Return value
The function returns TRUE if the NPC is detected, FALSE otherwise

Warning

This function is only available in Gothic 2

Wld_DetectPlayer

Wld_DetectPlayer

Checks if the player is detected by the NPC

func int Wld_DetectPlayer(var C_NPC npc) 

Parameters

  • var C_NPC npc - instance of the NPC

Globals

  • other - set to the detected player

Return value
The function returns TRUE if the player is detected, FALSE otherwise

Wld_ExchangeGuildAttitudes

Wld_ExchangeGuildAttitudes

Exchanges the guild attitude table

func void Wld_ExchangeGuildAttitudes(var string tablename) 

Parameters

  • var string tablename - name of the new attitude table

Wld_GetDay

Wld_GetDay

Gets the current day, start day is 0

func int Wld_GetDay() 

Return value
The function returns current day

Wld_GetFormerPlayerPortalGuild

Wld_GetFormerPlayerPortalGuild

Gets the guild of the room (portal) the player was in before the last room change

func int Wld_GetFormerPlayerPortalGuild() 

Return value
The function returns owner guild ID of the previous room the player was in

Wld_GetFormerPlayerPortalOwner

Wld_GetFormerPlayerPortalOwner

Gets the owner of the room (portal) the player was in before the last room change

func C_NPC Wld_GetFormerPlayerPortalOwner() 

Return value
The function returns instance of the room owner of the previous room the player was in, NULL if no owner

Wld_GetPlayerPortalGuild

Wld_GetPlayerPortalGuild

Gets the owner guild of the room (portal) the player is currently in

func int Wld_GetPlayerPortalGuild() 

Return value
The function returns owner guild ID of the current room the player is in

Wld_GetPlayerPortalOwner

Wld_GetPlayerPortalOwner

Gets the owner of the active room (portal) the player is currently in

func C_NPC Wld_GetPlayerPortalOwner() 

Return value
The function returns instance of the room owner of the current room the player is in, NULL if no owner

Wld_InsertItem

Wld_InsertItem

Inserts an item into the world at the specified spawn point

func void Wld_InsertItem(var int iteminstance, var string spawnpoint) 

Parameters

  • var int iteminstance - instance ID of the item
  • var string spawnpoint - name of the spawn point (waypoint or object)

Wld_InsertNpc

Wld_InsertNpc

Inserts an NPC into the world at the specified spawn point

func void Wld_InsertNpc(var int npcinstance, var string spawnpoint) 

Parameters

  • var int npcinstance - instance ID of the NPC
  • var string spawnpoint - name of the spawn point (waypoint or object)

Globals

  • self - set to the inserted NPC

Wld_InsertNpcAndRespawn

Wld_InsertNpcAndRespawn

Inserts an NPC into the world and sets a respawn delay, if the NPC dies it will respawn after the specified delay

func void Wld_InsertNpcAndRespawn(var int instancename, var string spawnpoint, var int spawndelay) 

Parameters

  • var int instancename - instance name of the NPC
  • var string spawnpoint - name of the spawn point (waypoint or object)
  • var int spawndelay - spawn delay in game hours

Wld_InsertObject

Wld_InsertObject

Inserts an oCMob with specified visual into the world at the specified spawn point

func void Wld_InsertObject(var string visual, var string spawnpoint) 

Parameters

  • var string visual - name of the visual (with the extension)
  • var string spawnpoint - name of the spawn point (waypoint or object)

Wld_IsFPAvailable

Wld_IsFPAvailable

Checks if a free point near the NPC is available

func int Wld_IsFPAvailable(var C_NPC npc, var string fpname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string fpname - name of the freepoint (could be only the middle part of the name: FP_ + fpname + _01)

Return value
The function returns TRUE if the freepoint is available, FALSE otherwise

Wld_IsMobAvailable

Wld_IsMobAvailable

Checks if a MOB is available near the NPC and is unoccupied

func int Wld_IsMobAvailable(var C_NPC npc, var string schemename) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string schemename - name of the MOB schema (e.g. BENCH)

Return value
The function returns TRUE if the MOB is available, FALSE otherwise

Wld_IsNextFPAvailable

Wld_IsNextFPAvailable

Checks if the next free point is available

func int Wld_IsNextFPAvailable(var C_NPC npc, var string fpname) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string fpname - name of the freepoint (could be only the middle part of the name: FP_ + fpname + _01)

Return value
The function returns TRUE if the next freepoint is available, FALSE otherwise

Wld_IsRaining

Wld_IsRaining

Checks if it is raining

func int Wld_IsRaining() 

Return value
The function returns TRUE if it is raining, FALSE otherwise

Warning

This function is only available in Gothic 2

Wld_IsTime

Wld_IsTime

Checks if the current world time is between the specified times

func int Wld_IsTime(var int hour1, var int min1, var int hour2, var int min2) 

Parameters

  • var int hour1 - start hour
  • var int min1 - start minute
  • var int hour2 - end hour
  • var int min2 - end minute

Return value
The function returns TRUE if the current time is between the specified times, FALSE otherwise

Wld_PlayEffect

Wld_PlayEffect

Plays a visual effect (VFX)

func void Wld_PlayEffect(var string effect, var instance origin, var instance target, var int effectlevel, var int damage, var int damagetype, var int isprojectile) 

Parameters

  • var string effect - name of the visual effect
  • var instance origin - instance of the effect origin object
  • var instance target - instance of the effect target object
  • var int effectlevel - level of the effect
  • var int damage - damage value
  • var int damagetype - type of damage
  • var int isprojectile - if TRUE, the effect passes through static objects

Wld_StopEffect

Wld_StopEffect

Stops a visual effect (VFX)

func void Wld_StopEffect(var string effect) 

Parameters

  • var string effect - name of the visual effect

Warning

This function is only available in Gothic 2

Wld_RemoveItem

Wld_RemoveItem

Removes a specific item object from the world

func int Wld_RemoveItem(var C_ITEM itm) 

Parameters

  • var C_ITEM itm - C_ITEM instance of the item

Return value
The function returns TRUE if the item was removed, FALSE otherwise

Wld_RemoveNpc

Wld_RemoveNpc

Removes an NPC from the game world

func void Wld_RemoveNpc(var int instancename) 

Parameters

  • var int instancename - instance name of the NPC to remove

Wld_SendTrigger

Wld_SendTrigger

Sends a trigger message to the specified VOB

func void Wld_SendTrigger(var string vobname) 

Parameters

  • var string vobname - name of the VOB

Wld_SendUntrigger

Wld_SendUntrigger

Sends an untrigger message to the specified VOB

func void Wld_SendUntrigger(var string vobname) 

Parameters

  • var string vobname - name of the VOB

Wld_SetGuildAttitude

Wld_SetGuildAttitude

Sets the guild attitude value between two guilds. Used for monster guilds as human guilds use attitude table

func void Wld_SetGuildAttitude(var int guild1, var int attitude, var int guild2) 

Parameters

  • var int guild1 - ID of the first guild
  • var int attitude - attitude value (ATT_ constants)
  • var int guild2 - ID of the second guild

Wld_GetGuildAttitude

Wld_GetGuildAttitude

Gets the guild attitude value between two guilds.

func int Wld_GetGuildAttitude(var int guild1, var int guild2) 

Parameters

  • var int guild1 - ID of the first guild
  • var int guild2 - ID of the second guild

Return value
The function returns attitude value as ATT_ constant

Wld_SetMobRoutine

Wld_SetMobRoutine

Sets a daily routine for the object, the Trigger/Untrigger message is sent if it is later than the specified time

func void Wld_SetMobRoutine(var int hour1, var int min1, var string objname, var int state) 

Parameters

  • var int hour1 - start hour
  • var int min1 - start minute
  • var string objname - name of the object
  • var int state - 1 for Trigger, 0 for Untrigger

Wld_SetObjectRoutine

Wld_SetObjectRoutine

Sets a daily routine for the object, the Trigger/Untrigger message is sent if it is later than the specified time

func void Wld_SetObjectRoutine(var int hour1, var int min1, var string objname, var int state) 

Parameters

  • var int hour1 - start hour
  • var int min1 - start minute
  • var string objname - name of the object
  • var int state - 1 for Trigger, 0 for Untrigger

Wld_SetTime

Wld_SetTime

Sets the world time to the specified hour and minute

func void Wld_SetTime(var int hour, var int min) 

Parameters

  • var int hour - int hour to set
  • var int min - int minute to set

Wld_SpawnNpcRange

Wld_SpawnNpcRange

Spawns an NPC within a specified range around npc

func void Wld_SpawnNpcRange(var C_NPC npc, var int instancename, var int num, var float range) 

Parameters

  • var C_NPC npc - instance of the NPC to spawn around
  • var int instancename - instance name of the spawned NPC
  • var int num - number of NPCs to spawn
  • var float range - spawn range in cm

Wld_GetMobState

Wld_GetMobState

Gets the state of the MOB used by the NPC

func int Wld_GetMobState(var C_NPC npc, var string schemename) 

Parameters

  • var C_NPC npc - instance of the NPC
  • var string schemename - name of the schema (e.g. BENCH)

zParserExtender

zParserExtender implements quite a few new WLD external functions.