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

Movement script to stopEvent

bury

Active Member
Joined
Jul 27, 2008
Messages
421
Solutions
7
Reaction score
25
Hello.

In summary, I made a funny action script with help of this forum. If you click in X item you'll start one event and take an storage. The event just starts and make the character say funny things but WITHOUT MOVE.

I want a movement script, that if you move your character (normal move, with the movement keys of ur keyboard), the event stops itself (stopEvent(eventid)) and the storage dissapears (it gets value=0).

Could it be possible? I dont find any LUA Function such as if playermoves then etcetc

Thanks!!
 
In your event pass a parameter for the players position and check if it is different now, if so set storage and return true to stop it.
 
In your event pass a parameter for the players position and check if it is different now, if so set storage and return true to stop it.

I think thats what I looking for. How it would be in form of script?
 
Im not at home but is something like this (is a funny script per vocation)

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if isPlayer(cid) == TRUE then
	if isSorcerer(cid) == TRUE then
		addEvent(shroomone, 1000,cid)	
	
	else if isPlayer(cid) == TRUE then
	if isDruid(cid) == TRUE then
		addEvent(shroomtwo, 1000,cid)
              
	
	
	else if isPlayer(cid) == TRUE then
	if isPaladin(cid) == TRUE then
		addEvent(shroomthree, 1000,cid)
		
              
	
	else if isPlayer(cid) == TRUE then
	if isKnight(cid) == TRUE then
		addEvent(shroomfour, 1000,cid)
		
	
	
              

	end		
	end
    end
	end
	end
	end
    end
	end

	if getPlayerStorageValue(cid,123) == 0 then
	setPlayerStorageValue(cid, 123, 1)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The event has started. do not say anything you regret")
	end
	end

And after this, the functions.
I want to stop the events and get storage = 0 if player moves.
 
Take example of finding movement from this script: http://otland.net/f81/homecoming-st...-pos-after-countdown-if-not-fight-etc-183192/

And here is example how to stop a running event:
script1:
LUA:
local function eventname()
-- put event action there
end

put_anything_here_but_must_be_unique = addEvent(eventname,1000,cid)
1000 is time in miliseconds so it's 1 second

script2:
LUA:
stopEvent(put_anything_here_but_must_be_unique)
 
just make infinite loop like this one in this homecoming script where x,y are in storages, loop will break itself when storage doesn't match(repeat x until y? dunno, I suck in programming xD)
and on last execution when storages doesn't match - stopEvent(below else?)
 
Back
Top