Skip to content

Revscriptsys

Eduardo Dantas edited this page Apr 22, 2022 · 3 revisions

Action by position:

With this method, we can register action scripts without needing the action id/unique id or the item being on the map, as there is also a second parameter that creates the item (if it doesn't exist).

  • This is a example script on how to use register mode by position

How to use the new position function:

  • We can use a table;
local registerPositions = {
	{x = 4998, y = 5000, z = 7},
	{x = 4971, y = 5300, z = 5},
	{x = 4802, y = 5088, z = 7},
	{x = 5518, y = 5126, z = 6},
	{x = 5852, y = 5295, z = 5},
	{x = 1940, y = 1345, z = 7},
	{x = 4709, y = 4186, z = 7}
}

for index, value in pairs(registerPositions) do
	action:position(value, 19236)
end
  • Or we can use without table;
action:position({x = 4998, y = 5000, z = 7}, 19236)

Small explanation:

The position parameter is obviously mandatory, the item id/name parameter is not mandatory, it can be used to create an item on the map without needing to edit the map, for scripts that need to check the id of the item inside them.

Important notes:

  • If the item already exists in the position, a warning will be sent informing that the item already exists and cannot be created, this warning will only disappear if the id/name parameter is removed.
  • If the item doesn't exist (ie it's a wrong id or name), then the distro will tell you that the item is invalid.