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

[REQUEST] Movement script with countdown

Delvire

°£°
Joined
Feb 24, 2008
Messages
236
Reaction score
9
Hello!

I just want to know, how to made a movement script that, when you step on a tile, the script starts a countdown. When the time is over, the player is teleported to another place

Thanks!(I will rep++, obviously)
 
The original idea, was making a training room with skill limit, after a X skill, the player is kicked out and is not able to enter again. I did it using creaturescript, but it didn't worked(I can show the script if anyone want). D: D: D:
 
just try doing in movement and add on step in and out
Lua:
if getPlayerStorageValue(cid,storage) == value then
   doTeleportThing(cid, fromPosition)
   doPlayerSendCancel(cid,"You cant train anymore")
return true 
end
if getPlayerSkillLevel(cid, skill) == blabla and  getPlayerStorageValue(cid,storage) ~= value then then
   doTeleportthing(cid,pos) 
   setPlayerStorageValue(cid,storage,value)
   doPlayerSendTextMessage(cid,MESSAGE_STATUS_WARNING,"You have reached the maximum skill for training.")
return true 
end
end


just an example.( idonno if this what you want lol )
 
The original idea, was making a training room with skill limit, after a X skill, the player is kicked out and is not able to enter again. I did it using creaturescript, but it didn't worked(I can show the script if anyone want). D: D: D:

MUST! In Creaturescripts/scripts/login.lua add this:
Lua:
registerCreatureEvent(cid, "TrainKick")
near:
Lua:
registerCreatureEvent(cid, "PlayerDeath")

Creaturescripts/creaturescripts.xml:
Lua:
<event type="think" name="TrainKick" event="script" value="TrainingKick.lua"/>
Creaturescripts/scripts/TrainingKick.lua:
Lua:
function onThink(cid, interval)

	local cfg = { 
				SkillToTeleport = XXX, -- If this skill or higher you will be teleported to ToPos
				storage = XXXX, -- Storage added when entering room. Should be the same as storage in the movement script.
				ToPos = { x = XXX, y = YYY, z = ZZZ }, -- The Kick Position.
				notAllowedStorage = XXXX, -- Storage given so you cant enter the room again. Should be same as notAllowedStorage in the movement script.
				KickMessage = "You have been kicked from the training room due to high skills!",
				}
				
				-- DONT EDIT ANYTHING BELOW THIS IF YOU DONT KNOW WHAT YOU ARE DOING! --
	
	if getPlayerSkillLevel(cid, 0) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 1) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 2) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 3) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 4) >= cfg.SkillToTeleport or getPlayerSkillLevel(cid, 5) >= cfg.SkillToTeleport then
		if getPlayerStorageValue(cid, cfg.storage) ==  1 then
			doTeleportThing(cid, cfg.ToPos, FALSE)
			doSendMagicEffect(cfg.ToPos, 13)
			setPlayerStorageValue(cid, cfg.storage, 0)
			setPlayerStorageValue(cid, cfg.notAllowedStorage, 1)
			doPlayerSendCancel(cid, cfg.KickMessage)
		end
	end
return TRUE
end

Movements/movements.xml:
Code:
<movevent type="StepIn" actionid="[B]XXXX[/B]" event="script" value="TrainTeleport.lua" />
Change the XXXX for the actionid you want(must be the same as actionid in the movement script.

Movements/scripts/TrainTeleport.lua:
Lua:
function onStepIn(cid, item, pos)

	local cfg = {
				storage = XXXX, -- Should be same storage as the storage in the creaturescript.
				ToPos = { x = XXX, y = YYY, z = ZZZ }, -- Pos to get teleported into the training room.
				notAllowedStorage = XXXX, -- Storage when not allowed to enter the room again. Should be same as the notAllowedStorage in the creaturescript.
				actionid = XXXX, -- The action id used on the teleporting tile.
				notAllowedMessage = "You have to high skills to use the training room!", 
				}
				
				-- DONT EDIT ANYTHING BELOW THIS IF YOU DONT KNOW WHAT YOU ARE DOING! --
				
	if isPlayer(cid) then
		if item.actionid == cfg.actionid then
			if getPlayerStorageValue(cid, cfg.notAllowedStorage) ~= 1 then
				doTeleportThing(cid, cfg.ToPos, FALSE)
				doSendMagicEffect(cfg.ToPos, 13)
				setPlayerStorageValue(cid, cfg.storage, 1)
			else
				doPlayerSendCancel(cid, notAllowedMessage)
			end
		end
	end
	return TRUE
end

NOT TESTED!
 
Last edited:
Back
Top