• 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:
What means "actor ~= cid"?

Actor means the person that is doing the "Action" in this case the person pushing the character, and cid is the person being pushed. Thus if the person pushing is not the person being pushed it will put them back onto the spot.

In simple terms, you can not be pushed onto a tile with whatever ActionID you give.
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if actor ~= cid then
		doTeleportThing(cid, lastPosition, true)
	end
	return true
end
Will it work?

Can we use this? onPush(cid, target)

Example:
Lua:
x = x=1000, y=1000, z=7
y = x=2000, y=2000, z=9
onPush(cid, target)
if (target == isPlayer(cid)) and (isInArea(x.y) == true) then
   doCreatureSetNoMove(cid, false)
end
end
 
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if actor ~= cid then
		doTeleportThing(cid, lastPosition, true)
	end
	return true
end
Will it work?

If Actor steps in, and he's not the person who stepped him in (pushed) then he'll be teleported to his last known position.
 
Will it work?

Can we use this? onPush(cid, target)

Example:

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
 
Last edited:
If Actor steps in, and he's not the person who stepped him in (pushed) then he'll be teleported to his last known position.

No, the actor is the person pushing, the cid is the person stepping in. Although you are right, the person pushed will teleport to their last position.
 
Meh...

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"/>
 
Read the code. If someone tries to push a player who is attacking a Target Dummy o w/e creature you put in the config it returns "not possible".
 
Lua:
<movevent type="StepIn" itemid="(tileid)" event="script" value="walkback.lua"/> --One for every tile id in the training area

Lua:
local fromPosition = {x=1000, y=1000, z=7}
local toPosition = {x=2000, y=2000, z=9}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if (isPlayer(cid)) and (isInRange(cid, fromPosition, toPosition) == true) then
		if (actor ~= cid)
			doTeleportThing(cid, lastPosition, true)
			doPlayerSendCancel(actor, 'You can not push people in this area.')
		end
	end
end
 
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

It should prevent player training from getting pushed. do not works
 
Last edited:
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

It should prevent player training from getting pushed. This script do not works.
PS.: Must check if Target Dummy is a monster. (Players can create a character name Target Dummy)
 
If player A gets pushed by player B while training, he will get pushed but if Player B starts attacking the Target Dummy and player A trying to push him back it won't be possible. :ninja:
 
Thought that check wouldn't be necessary but oh well...
Lua:
function onPush(cid, target, ground, position)
	local targetlist, ret = {"Target Dummy"}, true
	if(isCreature(target) and isMonster(getCreatureTarget(target)) and isInArray(targetlist, getCreatureTarget(target):lower())) then
		ret = RETURNVALUE_NOTPOSSIBLE
	end
 
	return ret
end
Does it show up any errors?
 
Last edited:
If player create character name called TARGET DUMMY. Will him affect?
Lua:
function onPush(cid, target, ground, position)
	local targetlist, ret = {"Target Dummy"}, true
	if(isCreature(target) and isMonster(getCreatureTarget(target)) and isInArray(targetlist, getCreatureTarget(target):lower())) then
		ret = RETURNVALUE_NOTPOSSIBLE
	end
 
	return ret
end
 
How much do you want to bet it doesn't work because you're using an old ass 8.6 distribution revision, that wasn't even officially released for use?
 
Back
Top Bottom