Difference between revisions of "NDGIC"
(14 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CallFunctionDelayed()</p>Params<br>TimeSpan - duration to wait before calling the function<br>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.. | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CallFunctionDelayed(...)</p>Params<br>TimeSpan - duration to wait before calling the function<br>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.. |
|} | |} | ||
</center> | </center> | ||
Line 28: | Line 28: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CanPathTo()</p>Params<br>origin - the start location to path from<br>destination - the end location to path to || Checks for a valid path from the origin to the destination using A* algorithm.<br>Returns - true if worked, false if not | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CanPathTo(...)</p>Params<br>origin - the start location to path from<br>destination - the end location to path to || Checks for a valid path from the origin to the destination using A* algorithm.<br>Returns - true if worked, false if not |
|} | |} | ||
</center> | </center> | ||
<p style="width: 60%;margin: 0 auto">Example</p> | <p style="width: 60%;margin: 0 auto">Example</p> | ||
<div style="width:60%;margin: 0 auto"> | <div style="width:60%;margin: 0 auto"> | ||
− | + | -- 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 | ||
</div> | </div> | ||
Line 39: | Line 48: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">ChangeWorld() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">ChangeWorld(...)</p>Params<br>reloadregion - true/false to reload the region<br>regionaddress - region to send players too<br>worldaddress - world adddress that contains the region<br>subregion - subregion to move players too<br>threads - number of object threads to run for the region<br>x - the x location to move the players too<br>z - the z location to move the players too || Changes or reloads the world on a standalone server. |
|} | |} | ||
</center> | </center> | ||
<p style="width: 60%;margin: 0 auto">Example</p> | <p style="width: 60%;margin: 0 auto">Example</p> | ||
<div style="width:60%;margin: 0 auto"> | <div style="width:60%;margin: 0 auto"> | ||
− | + | -- 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) | ||
</div> | </div> | ||
Line 50: | Line 62: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">ClearBans() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">ClearBans() || Clears all active bans on the server.. |
|} | |} | ||
</center> | </center> | ||
<p style="width: 60%;margin: 0 auto">Example</p> | <p style="width: 60%;margin: 0 auto">Example</p> | ||
<div style="width:60%;margin: 0 auto"> | <div style="width:60%;margin: 0 auto"> | ||
− | + | -- WARNING: THIS REMOVES ALL BANS ON THE SERVER | |
+ | ClearBans() | ||
</div> | </div> | ||
Line 61: | Line 74: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CopyObjectToPos() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CopyObjectToPos(...)</p>Params<br>object - object to copy<br>container - container to put in or nil<br>location - the location in the world or container<br>eventid - the event id for handling the created object<br>(...) one ore more variables to pass to the create event handler || Copy the specified object in a new position/container. |
|} | |} | ||
</center> | </center> | ||
<p style="width: 60%;margin: 0 auto">Example</p> | <p style="width: 60%;margin: 0 auto">Example</p> | ||
<div style="width:60%;margin: 0 auto"> | <div style="width:60%;margin: 0 auto"> | ||
− | + | --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 | ||
+ | </div> | ||
+ | <div style="width:60%;margin: 0 auto"> | ||
+ | --Copy a mobile to a location in the world | ||
+ | function CopyMonsterToLocation(user,mobile,location) | ||
+ | CopyObjectToPos(mobile,nil,location,"CopyMonsterToLocationHandler") | ||
+ | end | ||
</div> | </div> | ||
− | |||
<center> | <center> | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObj() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObj()</p>Params<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 || Spawn a new GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
|} | |} | ||
</center> | </center> | ||
Line 83: | Line 106: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObjInContainer() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomObjInContainer()</p>Params<br>template - creation template id for new object<br>templatedata - template data in a lua table<br>container - gameobj container<br>location - where in the world to put it<br>eventid - Event Handler identifier for the createdobject event<br>(...) - one ore more object arguments to be passed to the createdobject event || Spawn a new GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
|} | |} | ||
</center> | </center> | ||
Line 94: | Line 117: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomTempObj() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateCustomTempObj()</p></p>Params<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 || Spawn a new temporary GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
|} | |} | ||
</center> | </center> | ||
Line 105: | Line 128: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateEquippedObj() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateEquippedObj()</p>Params<br>template - template object to spawn<br>equipper - game object to equip too<br>eventid - event identifier for the resulting createdobject event<br>(...) - one ore more object arguments to be passed to the createdobject event || .Spawn a new GameObj directly to an equipment slot |
|} | |} | ||
</center> | </center> | ||
Line 116: | Line 139: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateObjExtended() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateObjExtended()</p>Params<br>template - object template to be created<br>container - object to place in (nil if none)<br>location - location to spawn the object<br>rotation - (Loc) object rotation<br>scale - (Loc) object scale<br>eventid - event identifier for the resulting createdobject event<br>(...) One or more object arguments to be passed to the CreatedObject event. Function references are not supported || Spawn a new GameObj in the world |
+ | with a specfied rotation and scale. | ||
|} | |} | ||
</center> | </center> | ||
Line 127: | Line 151: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateObjInContainer() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateObjInContainer()</p>Params<br>template - template number to spawn<br>gameobject - game object of container <br>location - Where in the container to put it<br>eventid - event identifier for the resulting createdobject event<br>(...)One ore more object arguments to be passed to the created object event || Spawn a new GameObj inside a container object. |
|} | |} | ||
</center> | </center> | ||
Line 138: | Line 162: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreatePrefab() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreatePrefab()</p>Params<br>prefabname - name of the prefab to use<br>location - center location to place the prefab<br>eventid - event identifier for the resulting createdobject event<br>(...)One ore more object arguments to be passed to the created object event || Create group of dynamic objects relative to a specific position. |
|} | |} | ||
</center> | </center> | ||
Line 149: | Line 173: | ||
{| class="wikitable" | style="width: 60%" | {| class="wikitable" | style="width: 60%" | ||
|- | |- | ||
− | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateTempObj() || . | + | |style="width: 40%"| <p style="color: #DDDD88;font-size: 18px">CreateTempObj()</p>Params<br>template - template name to spawn<br>location -where in the world to put it<br>eventid - event identifier for the resulting createdobject event<br>(...)One ore more object arguments to be passed to the created object event || Spawn a temporary GameObj in the world. Temporary objects are never stored in the backup and will disappear on restart. |
|} | |} | ||
</center> | </center> |
Latest revision as of 04:41, 18 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() Paramstemplateid - 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 |
Spawn a new GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
Example
CODE EXAMPLE BLOCK
CreateCustomObjInContainer() Paramstemplate - creation template id for new object templatedata - template data in a lua table container - gameobj container location - where in the world to put it eventid - Event Handler identifier for the createdobject event (...) - one ore more object arguments to be passed to the createdobject event |
Spawn a new GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
Example
CODE EXAMPLE BLOCK
CreateCustomTempObj() Paramstemplateid - 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 |
Spawn a new temporary GameObj by using the specified lua table as the template in the world. NOTE: You can use (GetTemplateData(...)) to get a template table and modify it. |
Example
CODE EXAMPLE BLOCK
CreateEquippedObj() Paramstemplate - template object to spawn equipper - game object to equip too eventid - event identifier for the resulting createdobject event (...) - one ore more object arguments to be passed to the createdobject event |
.Spawn a new GameObj directly to an equipment slot |
Example
CODE EXAMPLE BLOCK
CreateObjExtended() Paramstemplate - object template to be created container - object to place in (nil if none) location - location to spawn the object rotation - (Loc) object rotation scale - (Loc) object scale eventid - event identifier for the resulting createdobject event (...) One or more object arguments to be passed to the CreatedObject event. Function references are not supported |
Spawn a new GameObj in the world
with a specfied rotation and scale. |
Example
CODE EXAMPLE BLOCK
CreateObjInContainer() Paramstemplate - template number to spawn gameobject - game object of container location - Where in the container to put it eventid - event identifier for the resulting createdobject event (...)One ore more object arguments to be passed to the created object event |
Spawn a new GameObj inside a container object. |
Example
CODE EXAMPLE BLOCK
CreatePrefab() Paramsprefabname - name of the prefab to use location - center location to place the prefab eventid - event identifier for the resulting createdobject event (...)One ore more object arguments to be passed to the created object event |
Create group of dynamic objects relative to a specific position. |
Example
CODE EXAMPLE BLOCK
CreateTempObj() Paramstemplate - template name to spawn location -where in the world to put it eventid - event identifier for the resulting createdobject event (...)One ore more object arguments to be passed to the created object event |
Spawn a temporary GameObj in the world. Temporary objects are never stored in the backup and will disappear on restart. |
Example
CODE EXAMPLE BLOCK