World
Functions
NewVector3
function World.NewVector3((float)x , (float)y, (float)z)
Parameter | Type | Description |
---|---|---|
x | float |
X value of the new Vector3 |
y | float |
Y value of the new Vector3 |
z | float |
Z value of the new Vector3 |
World.NewVector3
Creates and returns a new Vector3 with the desired x, y and z
Example
NewVector = World.NewVector3(1,1,1)
StringToVector3
function World.StringToVector3((string)Stringified Vector)
Parameter | Type | Description |
---|---|---|
Stringified Vector | string |
Vector3 in string form |
World.StringToVector3
Turns a comma separated string into a vector3
Example
NewVector = World.StringToVector3("1,1,1")
Vector3ToString
function World.Vector3ToString((Vector3)Vector3)
Parameter | Type | Description |
---|---|---|
Vector3 | Vector3 |
Vector3 to turn into string |
World.Vector3ToString
Turns a Vector3 into a comma separated string
Example
NewVectorString = World.Vector3ToString(VectorToTurn)
GetPlayerPosition
function World.GetPlayerPosition()
World.GetPlayerPosition
Returns the player position in a Vector3 format
Example
playerPosition = World.GetPlayerPosition()
GetPositionNearToPlayer
function World.GetPositionNearToPlayer((float)Radius , (optional bool)Grounded)
Parameter | Type | Description |
---|---|---|
Radius | float |
Radius to use |
Grounded | optional bool |
Should we attempt to find a position above the ground? |
World.GetPositionNearToPlayer
Returns a position near to the player in a radius in a Vector3 format
Example
nearPlayerPosition = World.GetPositionNearToPlayer(5)
GetGroundPosition
function World.GetGroundPosition((Vector3)Position , (float)Above)
Parameter | Type | Description |
---|---|---|
Position | Vector3 |
Position to use |
Above | float |
Amount of space above the ground to add to the position. |
World.GetGroundPosition
Attempts to find the ground position for a specific Vector3 location
Example
aboveTheGround = World.GetGroundPosition(GetPositionNearToPlayer(2),0.5)
SetPlayerPosition
function World.SetPlayerPosition()
World.SetPlayerPosition
Sets the player position in a Vector3 format
Example
SetPlayerPosition(
DropItem
function World.DropItem((string)ItemID , (int)Amount, (optional Vector3)Position)
Parameter | Type | Description |
---|---|---|
ItemID | string |
Item ID |
Amount | int |
Amount of the item to drop |
Position | optional Vector3 |
Position to drop item at |
World.DropItem
Drops an amount of an item at a position. If no position is defined it will drop close to the player. If the player is not the host and doesn't have permission to drop items permission to drop items needs to be requested.
Example
World.DropItem("daisy", 1)
IsPositionCloseToBuildables
function World.IsPositionCloseToBuildables((Vector3)Position , (float)Radius)
Parameter | Type | Description |
---|---|---|
Position | Vector3 |
Position to check |
Radius | float |
Radius around the position to be checked |
World.IsPositionCloseToBuildables
Checks if a Vector3 position is close to any buildable in a radius.
Example
World.IsPositionCloseToBuildables(World.GetPlayerPosition(),5)
SpawnEntityIfEvent
function World.SpawnEntityIfEvent((string)Entity ID , (string)Event ID, (Vector3)Position)
Parameter | Type | Description |
---|---|---|
Entity ID | string |
Entity ID |
Event ID | string |
Event ID to check. If this even hasn't passed no entity will be spawned and the method will return nil |
Position | Vector3 |
Position to spawn the entity at |
World.SpawnEntityIfEvent
Spawns an entity if a certain event has passed. Returns the spawned entity if one is spawned or nil if the event hasn't passed or an entity with the id hasn't been found.
Example
World.SpawnEntityIfEvent("test","testevent",World.GetPositionNearToPlayer(5))
SpawnEntity
function World.SpawnEntity((string)Entity ID , (Vector3)Position)
Parameter | Type | Description |
---|---|---|
Entity ID | string |
Entity ID |
Position | Vector3 |
Position to spawn the entity at |
World.SpawnEntity
Spawns an entity at a location. Returns the spawned entity if one is spawned or nil if an entity with the id hasn't been found.
Example
World.SpawnEntity("test",World.GetPositionNearToPlayer(5))
GetSpawnpoint
function World.GetSpawnpoint()
World.GetSpawnpoint
Gets the current spawn point
Example
spawnpoint = World.GetSpawnpoint()
GetShopStatus
function World.GetShopStatus()
World.GetShopStatus
Gets the current shop status (true for Open or false for Closed)
Example
IsOpen = World.GetShopStatus()
SetChangeMaterialsWithSeasonsStatus
function World.SetChangeMaterialsWithSeasonsStatus()
World.SetChangeMaterialsWithSeasonsStatus
Sets whether materials should change with seasons or not
SetShopStatus
function World.SetShopStatus()
World.SetShopStatus
Sets the current shop status (true for Open or false for Closed)
GetSceneName
function World.GetSceneName()
World.GetSceneName
Returns the current scene name
Example
World.GetSceneName()
RefreshWorldForTime
function World.RefreshWorldForTime()
World.RefreshWorldForTime
Refreshes the quests, mail, showif and more for the current time. Useful if you just changed the time manually.
Example
World.RefreshWorldForTime()