• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua StepIn transform item in fire field

chupaescadatri

Banned User
Joined
Jul 5, 2014
Messages
338
Reaction score
49
Hello, I'm trying to create the spike sword-like function in rookgaard, when it goes through 2 sqm, the spike sword turns into fire field

local sqm1= 32063, 32080, 10

local sqm2= 32169, 32157, 8

local spike sword= 32101, 32085, 7

ID spike sword = 2383
ID fire field = 1487

Does anyone know how to do it?
+rep
 
Hello, I'm trying to create the spike sword-like function in rookgaard, when it goes through 2 sqm, the spike sword turns into fire field

local sqm1= 32063, 32080, 10

local sqm2= 32169, 32157, 8

local spike sword= 32101, 32085, 7

ID spike sword = 2383
ID fire field = 1487

Does anyone know how to do it?
+rep
the player pass in 2 sqm and transform an item in fire field I do not know, if it was lever that changes item I would know, I tried to adapt but I could not
 
Figure out which tile itemid is in those sqm1 and sqm2 position.
Look for that itemid in data/movements/movements.xml

If those itemids are not there, then great, add it and make it load spikesword_rook.lua or something (data/movements/scripts/spikesword_rook.lua)
In the lua script, add function onStepIn(creature, item, position, fromPosition)

Verify that creature position (or fromPosition?) is either sqm1 or sqm2. (and if creature is a player?)

Update a globalstorage or something so we know if someone moved over the positions.
Do a check against globalstorage to see if both sqm1 and sqm2 has been walked on, remove spike sword and add a fire field.
 
Figure out which tile itemid is in those sqm1 and sqm2 position.
Look for that itemid in data/movements/movements.xml

If those itemids are not there, then great, add it and make it load spikesword_rook.lua or something (data/movements/scripts/spikesword_rook.lua)
In the lua script, add function onStepIn(creature, item, position, fromPosition)

Verify that creature position (or fromPosition?) is either sqm1 or sqm2. (and if creature is a player?)

Update a globalstorage or something so we know if someone moved over the positions.
Do a check against globalstorage to see if both sqm1 and sqm2 has been walked on, remove spike sword and add a fire field.
movements.xml
Code:
    <movevent type="StepIn" actionid="1570" event="script" value="spikesword.lua"/>
    <movevent type="StepIn" actionid="1571" event="script" value="spikesword.lua"/>
spikesword.lua
Code:
function onStepIn(cid, item, position, fromPosition, toPosition)
local pos = {X=32101, Y=32085, Z=7}
local spike = 2383
local firefield = 1487
local stoneFromPos = getThingfromPos(pos)

doRemoveItem(spikeFromPos.uid, 1)
doAddItem(firefieldFromPos.uid, 1)
end
end

nothing happened =/
 
movements.xml
Code:
    <movevent type="StepIn" actionid="1570" event="script" value="spikesword.lua"/>
    <movevent type="StepIn" actionid="1571" event="script" value="spikesword.lua"/>
spikesword.lua
Code:
function onStepIn(cid, item, position, fromPosition, toPosition)
local pos = {X=32101, Y=32085, Z=7}
local spike = 2383
local firefield = 1487
local stoneFromPos = getThingfromPos(pos)

doRemoveItem(spikeFromPos.uid, 1)
doAddItem(firefieldFromPos.uid, 1)
end
end

nothing happened =/

I don't think movements.xml allows actionid, you have to assign the itemid of the tile itself. But you should then be able to check actionid of that tile in the Lua code.

Sample line from movements.xml:
XML:
<movevent event="StepIn" itemid="426" script="tiles.lua" />
 
I don't think movements.xml allows actionid, you have to assign the itemid of the tile itself. But you should then be able to check actionid of that tile in the Lua code.

Sample line from movements.xml:
XML:
<movevent event="StepIn" itemid="426" script="tiles.lua" />
do not RMEe I put the actionid but it still did not work
 
Back
Top