X
Xikini
Guest
0.3.6 TFS
To start I am trying to learn to scripting but I seem to be taking mouthfuls instead if sips.
What I'm trying to do is when a player walks on a tile in-game they get a storage value ranging from 20001-30000
Ideally I would not have to touch the movements afterwords.
I would be able to set the ActionID on the map editor with any tile. (example: map editor has ActionID 26470 on a grass tile in front of a cave - it would give the player the storage of 26470
What I'm trying to do is make it so that in movements I have this
Instead of this
This is my current set player storage on step in. (not tested)
I believe I have it is set so that it will only set the storage value once and give the player a message.
Do I need an else do nothing?
I don't really understand if I need the 'return true', but copy paste is a wonderful thing.
Would something like this work?
But I'm not sure how to do it exactly
Any pointers or solutions off the top of your heads?
Rep++ of course for any help
To start I am trying to learn to scripting but I seem to be taking mouthfuls instead if sips.
What I'm trying to do is when a player walks on a tile in-game they get a storage value ranging from 20001-30000
Ideally I would not have to touch the movements afterwords.
I would be able to set the ActionID on the map editor with any tile. (example: map editor has ActionID 26470 on a grass tile in front of a cave - it would give the player the storage of 26470
What I'm trying to do is make it so that in movements I have this
XML:
<movevent type="StepIn" actionid="20001-23000" event="script" value="checkpoint.lua"/>
Instead of this
XML:
<movevent type="StepIn" actionid="20001" event="script" value="checkpoint20001.lua"/>
<movevent type="StepIn" actionid="20002" event="script" value="checkpoint20002.lua"/>
<movevent type="StepIn" actionid="20003" event="script" value="checkpoint20003.lua"/>
<movevent type="StepIn" actionid="20004" event="script" value="checkpoint20004.lua"/>
<movevent type="StepIn" actionid="20005" event="script" value="checkpoint20005.lua"/>
This is my current set player storage on step in. (not tested)
I believe I have it is set so that it will only set the storage value once and give the player a message.
LUA:
function onStepIn(cid, item, position, position)
if getPlayerStorageValue(cid, 20001) ~= -1 then
setPlayerStorageValue(cid, 20001, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Checkpoint Found!")
end
return TRUE
end
I don't really understand if I need the 'return true', but copy paste is a wonderful thing.
Would something like this work?
LUA:
function onStepIn(cid, item, position, position)
if(actionid > 20001 and actionid < 30000) then
if getPlayerStorageValue(cid, actionid) ~= -1 then
setPlayerStorageValue(cid, actionid, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Checkpoint Found!")
end
end
return TRUE
end
But I'm not sure how to do it exactly
Any pointers or solutions off the top of your heads?
Rep++ of course for any help