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

[movevent] Tp on Tile

muphet

New Member
Joined
Apr 27, 2008
Messages
233
Reaction score
2
Hi. I have next problem. This is my code:
Lua:
function onStepIn(cid, item, pos) 
local storage = getPlayerStorageValue(uid, 65001)
if isPlayer(cid) then
	if(item.uniqueid = 19701) and storage = 0 then
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Sorry, you cant pass this gate. You must be on quest: Dragon Empire.')
	elseif (item.uid = 19701) and getPlayerStorageValue(uid, 65001) = 1 then
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Dragon Empire quest started...')
	end
end
return true
end

But this one not workin'. If someone step on tile, nothing happens.. (btw, there are no tp function. that will be added when script show text :<)
 
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local p = {x=1,y=1,z=1} -- where to tp to.
	if(isPlayer(cid) and item.uid == 19701)then -- checks if it is a player and for item uniqueid.
		if(getPlayerStorageValue(cid,65001) < 0)then -- checks for storage value.
			doPlayerSendTextMessage(cid,19,'Sorry, but you can\'t pass this gate unless you are on the \'Dragon Empire\' quest.') -- message send
			doTeleportThing(cid,p) -- teleport to //.
			doSendMagicEffect(p,10) -- magic effect.
		else -- if not true.
			doPlayerSendTextMessagE(cid,19,'Dragon Empire quest has started...') -- message.
		end
	end
	return true
end
 
Last edited:
Here you are:
Code:
function onStepIn(cid, item, pos)
local storage = getPlayerStorageValue(cid, 65001)
local position = {x=1000, y=1000, z=7}

if(storage == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Dragon Empire quest started...')
	doTeleportThing(cid, position, TRUE)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
else
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Sorry, you cant pass this gate. You must be on quest: Dragon Empire.')
	end
return true
end
 
Last edited:
Code:
function onStepIn(cid, item, pos)
[b]local storage = getPlayerStorageValue(cid, 65001)[/b]
local position = {x=1000, y=1000, z=7}

if(storage == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Dragon Empire quest started...')
	doTeleportThing(cid, position, TRUE)
        [b]doSendMagicEffect(cid, CONST_ME_TELEPORT)[/b]
	[b]return true[/b]
else
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Sorry, you cant pass this gate. You must be on quest: Dragon Empire.')
	end
return true
end

Why do you write a local while it's faster to just write the function?
Why do you return true while it's unnecessary?

And you should check wether it's a player or a creature.

And doSendMagicEffect needs a location, so cid would be getThingPos(cid).

This is just critism to help you.
 
Code:
function onStepIn(cid, item, pos)
[b]local storage = getPlayerStorageValue(cid, 65001)[/b]
local position = {x=1000, y=1000, z=7}

if(storage == 1) then
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Dragon Empire quest started...')
	doTeleportThing(cid, position, TRUE)
        [b]doSendMagicEffect(cid, CONST_ME_TELEPORT)[/b]
	[b]return true[/b]
else
	doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'Sorry, you cant pass this gate. You must be on quest: Dragon Empire.')
	end
return true
end

Why do you write a local while it's faster to just write the function?
Why do you return true while it's unnecessary?

And you should check wether it's a player or a creature.

And doSendMagicEffect needs a location, so cid would be getThingPos(cid).

This is just critism to help you.

Your script is also bad...
Where is name or number of effect who script must send? :wub:
Shut up and firstly look at your mistakes, then improvements in other areas.
 
You can find these "numbers" in 'Data > Lib > 000-constants'.

Code:
MESSAGE_FIRST = 18
MESSAGE_STATUS_CONSOLE_RED = MESSAGE_FIRST
MESSAGE_EVENT_ORANGE = 19
MESSAGE_STATUS_CONSOLE_ORANGE = 20
MESSAGE_STATUS_WARNING = 21
MESSAGE_EVENT_ADVANCE = 22
MESSAGE_EVENT_DEFAULT = 23
MESSAGE_STATUS_DEFAULT = 24
MESSAGE_INFO_DESCR = 25
MESSAGE_STATUS_SMALL = 26
MESSAGE_STATUS_CONSOLE_BLUE = 27
MESSAGE_LAST = MESSAGE_STATUS_CONSOLE_BLUE

Code:
CONST_ME_DRAWBLOOD = 0
CONST_ME_LOSEENERGY = 1
CONST_ME_POFF = 2
CONST_ME_BLOCKHIT = 3
CONST_ME_EXPLOSIONAREA = 4
CONST_ME_EXPLOSIONHIT = 5
CONST_ME_FIREAREA = 6
CONST_ME_YELLOW_RINGS = 7
CONST_ME_GREEN_RINGS = 8
CONST_ME_HITAREA = 9
CONST_ME_TELEPORT = 10
CONST_ME_ENERGYHIT = 11
CONST_ME_MAGIC_BLUE = 12
CONST_ME_MAGIC_RED = 13
CONST_ME_MAGIC_GREEN = 14
CONST_ME_HITBYFIRE = 15
CONST_ME_HITBYPOISON = 16
CONST_ME_MORTAREA = 17
CONST_ME_SOUND_GREEN = 18
CONST_ME_SOUND_RED = 19
CONST_ME_POISONAREA = 20
CONST_ME_SOUND_YELLOW = 21
CONST_ME_SOUND_PURPLE = 22
CONST_ME_SOUND_BLUE = 23
CONST_ME_SOUND_WHITE = 24
CONST_ME_BUBBLES = 25
CONST_ME_CRAPS = 26
CONST_ME_GIFT_WRAPS = 27
CONST_ME_FIREWORK_YELLOW = 28
CONST_ME_FIREWORK_RED = 29
CONST_ME_FIREWORK_BLUE = 30
CONST_ME_STUN = 31
CONST_ME_SLEEP = 32
CONST_ME_WATERCREATURE = 33
CONST_ME_GROUNDSHAKER = 34
CONST_ME_HEARTS = 35
CONST_ME_FIREATTACK = 36
CONST_ME_ENERGYAREA = 37
CONST_ME_SMALLCLOUDS = 38
CONST_ME_HOLYDAMAGE = 39
CONST_ME_BIGCLOUDS = 40
CONST_ME_ICEAREA = 41
CONST_ME_ICETORNADO = 42
CONST_ME_ICEATTACK = 43
CONST_ME_STONES = 44
CONST_ME_SMALLPLANTS = 45
CONST_ME_CARNIPHILA = 46
CONST_ME_PURPLEENERGY = 47
CONST_ME_YELLOWENERGY = 48
CONST_ME_HOLYAREA = 49
CONST_ME_BIGPLANTS = 50
CONST_ME_CAKE = 51
CONST_ME_GIANTICE = 52
CONST_ME_WATERSPLASH = 53
CONST_ME_PLANTATTACK = 54
CONST_ME_TUTORIALARROW = 55
CONST_ME_TUTORIALSQUARE = 56
CONST_ME_MIRRORHORIZONTAL = 57
CONST_ME_MIRRORVERTICAL = 58
CONST_ME_SKULLHORIZONTAL = 59
CONST_ME_SKULLVERTICAL = 60
CONST_ME_ASSASSIN = 61
CONST_ME_STEPSHORIZONTAL = 62
CONST_ME_BLOODYSTEPS = 63
CONST_ME_STEPSVERTICAL = 64
CONST_ME_YALAHARIGHOST = 65
CONST_ME_BATS = 66
CONST_ME_SMOKE = 67
CONST_ME_INSECTS = 68
CONST_ME_NONE = 255
CONST_ME_LAST = CONST_ME_INSECTS

Now that solves the thinking of you that my script won't work.

And may I re-quote the following?

unknown666 said:
This is just critism to help you.
 
I will be brief: Your script doesn't make sense!
You change ex. "MESSAGE_EVENT_ORANGE" to "19" for what?!
You poorly helped him, unsuccessfully...
 
Don't talk all rubish.

The 'MESSAGE_EVENT_ORANGE' is defined in 000-constants, this will work perfectly.

My script does as he wanted and I changed it to 19 because that's how I always do it that way, as I almost always rewrite scripts.

Now tell me why I poorly helped him as you don't even check wether it's a player or a creature.

So stop telling mine doesn't work, etc.. as it does.

I'll try and help you again <_<.
 
No, it doesn't...
as you don't even check wether it's a player or a creature.
Becouse creature can't have a storage ;)

Your fucking answers = bullshit!
Delete unnecessary lines in your fucking script and Shut up, you're boring ;(
 
sory guys!! my bad :(
I have used tag in movevent: <movevent event="StepIn"> ;/
type="StepIn" workin' now

BTW, thank you unknown666, REP++ and you'll be credited as helper =)
 
My script must work...
You must add line to your movements.xml
<movevent type="StepIn" uniqueid="XXXX" event="script" value="script.lua"/>

XXXX must be same as you write in your MAP Editor.
 
redesign this script so that if you're not asking the storange not miss you, I let you go ot: / even if you have the quest done

TFS 0.4
 
Back
Top