Difference between revisions of "NDGIC"
Line 95: | Line 95: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObj()</p> || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObj()</p><br>templateid - the creation template id<br>templatedata - template data in a lua table<br>location - where to put it in the world<br>eventid - Event Handler Id for the Creation Event<br>(...)one ore more arguments passed to the createobject event || . |
|} | |} | ||
</center> | </center> |
Revision as of 07:58, 14 November 2019
Global Functions & Examples
CallFunctionDelayed(...) ParamsTimeSpan - duration to wait before calling the function function - function to call |
Calls a function after the specified amount of time has elapsed Note: This function will not be called if server shuts down or restarts before the delay expires.. |
Example
-- call the TrapTriggered function after 2 seconds has elapsed CallFunctionDelayed(TimeSpan.FromSeconds(2),TrapTriggered()) -- handle the target who triggered the trap by dealing 25 points of magic damage to the target function TrapTriggered() -- get the target trigger object stored by the trap local target = this:GetObjVar("TrapTriggeredBy") -- if the target is valid apply the damage if(target) then damageInfo.Victim:SendMessage("DamageInflicted",target,25,"MAGIC",false,false,false,target) end end
CanPathTo(...) Paramsorigin - the start location to path from destination - the end location to path to |
Checks for a valid path from the origin to the destination using A* algorithm. Returns - true if worked, false if not |
Example
-- attempt to move the target object to a new location function MoveTargetToLoc(target,location) if(CanPathTo(this:GetLocation(),location) then -- move the target to the location specified target:PathTo(location,1,"ArrivedEventHandler",true,true,4) return true end -- if pathing failed return false return false end
ChangeWorld(...) Paramsreloadregion - true/false to reload the region regionaddress - region to send players too worldaddress - world adddress that contains the region subregion - subregion to move players too threads - number of object threads to run for the region x - the x location to move the players too z - the z location to move the players too |
Changes or reloads the world on a standalone server. |
Example
-- change the current region, will reset and reload ChangeWorld(true) -- change the current region to the black forest at location 550,375 with 8 threads and no reloading of the area ChangeWorld(false,"AzureSky.NewCelador.BlackForest","NewCelador","BlackForest",8,550,375)
ClearBans() |
Clears all active bans on the server.. |
Example
-- WARNING: THIS REMOVES ALL BANS ON THE SERVER ClearBans()
CopyObjectToPos(...) Paramsobject - object to copy container - container to put in or nil location - the location in the world or container eventid - the event id for handling the created object (...) one ore more variables to pass to the create event handler |
Copy the specified object in a new position/container. |
Example
--Copy a object into a users backpack function DupeItemInPlayersBackpack(user,item) local backpackObj = user:GetEquippedObject("Backpack") local location = GetRandomDropPosition(backpackObj) CopyObjectToPos(item,backpackObj,location,"DupeItemEventHandler") end
--Copy a mobile to a location in the world function CopyMonsterToLocation(user,mobile,location) CopyObjectToPos(mobile,nil,location,"CopyMonsterToLocationHandler") end
CreateCustomObj() templateid - the creation template id templatedata - template data in a lua table location - where to put it in the world eventid - Event Handler Id for the Creation Event (...)one ore more arguments passed to the createobject event |
. |
Example
CODE EXAMPLE BLOCK
CreateCustomObjInContainer() |
. |
Example
CODE EXAMPLE BLOCK
CreateCustomTempObj() |
. |
Example
CODE EXAMPLE BLOCK
CreateEquippedObj() |
. |
Example
CODE EXAMPLE BLOCK
CreateObjExtended() |
. |
Example
CODE EXAMPLE BLOCK
CreateObjInContainer() |
. |
Example
CODE EXAMPLE BLOCK
CreatePrefab() |
. |
Example
CODE EXAMPLE BLOCK
CreateTempObj() |
. |
Example
CODE EXAMPLE BLOCK