Action Jump over gaps

barker

HHHHH
Joined
Nov 23, 2007
Messages
1,298
Best answers
0
Reaction score
24
CREDITS TO Balanar at Otfans

Hello
My script allows players to jump over gaps (for example in mountains).
But only if the have time ring or boots of haste equiped (or any speed item).

Script:
Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local actionid = {first=110,second=111}
	if isPlayer(cid) == TRUE then
		local constants = {getPlayerLevel(cid),getCreatureSpeed(cid)} -- don't change
		local config = {from={x=1035,y=1042,z=8,id=actionid.first},to={x=1035,y=1046,z=8,id=actionid.second}} --enter the position where to jump(to) and back(from)
		local formula = 220+(2*(tonumber(constants[1])-1)) --don't change
		if formula < constants[2] then
			if (config.from.x == config.to.x or config.from.y == config.to.y) and config.from.z == config.to.z then
				if item.actionid == config.from.id then
					doTeleportThing(cid,config.to)
				else
					doTeleportThing(cid,config.from)					
				end
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You jumped over the gap.")
				if config.from.x == config.to.x then
					for a = config.from.x,config.to.x do
						for b = config.from.y+1,config.to.y-1 do
							doSendMagicEffect({x=a,y=b,z=config.to.z},2)
						end
					end
				else
					for a = config.from.x+1,config.to.x-1 do
						for b = config.from.y,config.to.y do
							doSendMagicEffect({x=a,y=b,z=config.to.z},2)
						end
					end
				end
			else
				doPlayerSay(cid,"Something is wrong with the positions.They must be on the same floor and the need to be on 1 line.",1)
			end
		else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You didn't dare to jump.")
			doTeleportThing(cid, fromPosition, false)
			doSendMagicEffect(fromPosition,2)
		end
	end
	return true
end
Here a small picture to set it up:


You need a gap in a mountain. The right example shows how it may not look like..
The point where you jump from and the point where you jump to must be on a line.

If you have the gap, place a item (id:460,red sqaures in the picture) next to the two positions yellow and blue squares. The item 460 which is more north or more west in the map you add the actionid which you set in "actionid.first" and the item 460 which is more south or more east you add the actionid which you set to "actionid.second".
Example in the picture:
Code:
local actionid = {first=110,second=111}
I need to add the actionid 110 to the grey-circled and the actionid 111 to the green-circled.

Then you go on setting the positions.
Search this part:
Code:
local config = {from={x=1035,y=1042,z=8,id=actionid.first},to=x=1035,y=1046,z=8,id=actionid.second}}
And the position next to the item, which you added actionid.first, you set in "config.from" and the position next to the item, which you added actionid.second you set as "config.to".
Now everything should work.
Also there are automatically jump effects shown between the to gap sides, if you set it up right.

COMMENT:
If you want player to jump over the gap even without speed items, replace
Code:
if formula < constants[2] then
with
Code:
if formula < (formula+1) then
 

JDB

OtLand Veteran
Joined
Jun 1, 2009
Messages
4,145
Best answers
2
Reaction score
109
This is pretty cool and good for quests :p
 
Top