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

OnPush [ Help Please ]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
After seeing this thread I thought, in every monster fit 8 people, but if my enemy is training afk, I will push him out.

21kxekm.jpg

What I must do to 'If player try to push player in DUMMY TILE' then he will receive message 'Not possible'.

Examples:
---

I made it:

XML:
<event type="push" name="playerPush" event="script" value="push.lua"/>
Lua:
local fromPosition = {x="1000", y="1000", z="7"}
local toPosition = {x="2000", y="2000", z="9"}
function onPush(cid, target)
if (target == isPlayer(cid)) and (isInRange(cid, fromPosition, toPosition) == true) then
   doPlayerSendCancel(cid, "Sorry, not possible.")
end
end

Evan made it
Here's the script if you wanna do the tile clicking:
Lua:
function onStepIn(cid, item, fromPosition, toPosition)
	if isPlayer(cid) then
		doCreatureSetNoMove(cid, cannotMove)
	end
	return true
end
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) and getCreatureNoMove(cid) == true then
		doCreatureSetNoMove(cid, false)
	end
	return true
end

Evil Mark made it:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isPlayer(cid) then
		doCreatureSetNoMove(cid, true)
		doSendAnimatedText(toPosition, "Training!", math.random(0, 255))
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In order to leave this booth you have to dance.")
		doCreatureSetLookDirection(cid, 0)
		while (getCreatureLookDirection(cid) ~= 0) then
			doCreatureSetNoMove(cid, false)
		end
	else
		doTeleportThing(cid, fromPosition, false)
	end
	return true
end

Aziz made it:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if actor ~= cid then
		doTeleportThing(cid, lastPosition, true)
	end
	return true
end

Ratser made this:
antipush.lua:
Lua:
local targetlist, ret = {"Target Dummy"}, true

function onPush(cid, target, ground, position)
	if(isInArray(targetlist, getCreatureTarget(target):lower())) then
		ret = RETURNVALUE_NOTPOSSIBLE
	end
	
	return ret
end
creaturescripts.xml:
XML:
	<event type="push" name="AntiPush" event="script" value="antipush.lua"/>

Does someone knows how to make it automatically?
 
Last edited:
onStepIn

doCreatureSetNoMove(cid, cannotMove)

Haven't tested, but it looks like a possibility.
 
There are multiple alternatives, I will post them after Chayenne dies on real Tibia.
I think I can figure out a way to avoid the problem you posted.

Just hold on, let me kill this bitch.
 
You could use a talkaction instead of movement script so that the second time they use it they will be able to move again.
Not too elegant of a solution but it would work..
 
I've got myself into noMove, but now I can't figure out how to get rid of the noMove.
I did doCreatureSetNoMove(cid, 0) but that does not work.

Nevermind, I got it.

Well, what you can do is have all the tiles they stand on to have the same actionID.
If they step into it, they cannot move, then they can click the tile below them to be able to move again.
It's not automatic, unfortunately, but it's the best way to do it. I've tried doing it with onStepOut, in hoping it would detect an attempt of stepping out, it didn't work.

Here's the script if you wanna do the tile clicking:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) and getCreatureNoMove(cid) == true then
		doCreatureSetNoMove(cid, false)
	end
	return true
end

You can do the wall idea, where you surround the 9 square area with walls and put in a level door in the middle of every side.
 
Last edited:
There should be some kind of function onAttemptStepOut, where it can do something to you when you try to move somewhere, but you can't.
 
Maybe something like this

Lua:
x = x=1000, y=1000, z=7
y = x=2000, y=2000, z=9
if (getCreatureNoMove(cid) == true) and (onAttemptStepOut == true) and (isInArea(x.y) == true) then
   doCreatureSetNoMove(cid, false)
end

Possible?
 
No, I'm saying, there should be a new function that detects someone attempting to move, but could not.
onAttemptStepOut is just a name I made up.
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isPlayer(cid) then
		doCreatureSetNoMove(cid, true)
		doSendAnimatedText(toPosition, "Training!", math.random(0, 255))
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In order to leave this booth you have to dance.")
		doCreatureSetLookDirection(cid, 0)
		while (getCreatureLookDirection(cid) ~= 0) then
			doCreatureSetNoMove(cid, false)
		end
	else
		doTeleportThing(cid, fromPosition, false)
	end
	return true
end
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if actor ~= cid then
		doTeleportThing(cid, lastPosition, true)
	end
	return true
end
 
Back
Top