• 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!

If not Storage Value -> One step back

Appzyt

New Member
Joined
Jun 1, 2008
Messages
92
Reaction score
0
I have been trying to do a new sorta quest where you gotto complete a quest, then you "learn" how to swim. So I thought it might be smart to make a quest with XXXX storage value and then make a movement script wich pushes you back one tile if you dont have the storage value.
So what I need help with is the movement script.

Hoping someone might be able to help me out on this one.

Well met,

Appzyt
 
hm what about if you have to "use" the sea and go trought it? cuz if u can be that, u can use vip system, and put actionid of door on a stone or water :p
 
If you use TFS, you already have this done in tiles.lua! Just set the actionid of a switch tile to the storage value of the quest, and players will not be able to cross it
 
Aye there is such script but since I want to use on the beach I was thinking it will look ugly when there are alot of switch tiles before them. Anyhow when I said I tried to make the script this is what I came up with and did not work since I do not know how to script :p


Lua:
function onStepIn(cid, item, position, fromPosition)

        elseif item.aid == 3335 then
        if getPlayerStorageValue(cid,1234) == -1 then 
            doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry. You do not yet know how to swim.')
	    doSendMagicEffect(getCreaturePosition(cid),51)
	     local SwimPos = getCreaturePosition(cid)
					SwimPos.z = SwimPos.z + 1
					doTeleportThing(cid, SwimPos, FALSE)
				end
			end

Could anyone help me out?
 
Last edited:
First why do you use the z coordinate( z = floor level ) .
example to edit the position using player position correctly
Lua:
local pid = getThingPos(cid)
pos = {x= pid.x,y=pid.y -1,z= pid.z}

doTeleportThing(cid,pos)

And there is a simple way to push player back to the position he came from, check the following script :
Lua:
function onStepIn(cid, item, position, fromPosition)
    if item.aid == 3335 then
                 if getPlayerStorageValue(cid,1234) == -1 then 
                              doPlayerSendTextMessage(cid,MESSAGE_EVENT_ADVANCE,'Sorry. You do not yet know how to swim.')
		              doTeleportThing(cid, fromPosition,false)
			      doSendMagicEffect(fromPosition, 2)
	         end
	end
return true
end
 
Code:
---Scripted By Ranyo ---

function onStepIn(cid, item, position, fromPosition)
 
      if item.aid == 3335 then
        if getPlayerStorageValue(cid,1234) == 1 then 
            doCreatureSay(cid,"Welcome Swimmer", TALKTYPE_ORANGE_1)
					local pid = getThingPos(cid)
                                        pos = {x= pid.x,y=pid.y +1,z= pid.z}
					doTeleportThing(cid,pos)
					doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
                                else  
                                        doTeleportThing(cid, fromPosition,false)
                                        doPlayerSendCancel(cid,"You arent swimmer yet.")
				end
			end
return TRUE
end

And add this to movements.xml
<movevent type="StepIn" actionid="3335" event="script" value="XXXX.lua"/>

Not Tested ... im not a good scripter too im just trying to help you ... you can say im not a scripter but im practicing :thumbup:
 
Last edited:
Sheeeet Damadger ur much faster than me :( btw i didnt use ur local pid ....

EDIT : can u fix my problem pls at requests
 
Lua:
function onStepIn(cid, item, position, fromPosition)
	if(getPlayerStorageValue(cid, storage) < 1 then 
		return false, doTeleportThing(cid, fromPosition)
	end
	return true
end
 

Similar threads

Back
Top