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

Teleport Crystal

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,855
Solutions
18
Reaction score
671
Engine:
TFS: 0.3.5
What i mean?
If you use item (id: 9141) you will be teleported to temple.
You can only use this item if you dont have PZ and Skull, Red Skull, Black skull (skulls :P).
 
Here you are
Rep++ me :D

go to data/actions/scripts and create teleport.lua and paste the folowing

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
tepos = {x=, y=, z=}

if getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendCancel(cid, "Lose your battle sign first.")
else
doTeleportThing(cid, tpos)
doSendMagicEffect(tpos, 10)
end
end

dont forget to put your right place Coordinates here
this is an example
Code:
tepos = {x=1000, y=1000, z=7}

Then put in data/actions.xml
Code:
<action itemid="9141" script="teleport.lua"/>
 
Here you are
Rep++ me :D

go to data/actions/scripts and create teleport.lua and paste the folowing

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
tepos = {x=, y=, z=}

if getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE then
doPlayerSendCancel(cid, "Lose your battle sign first.")
else
doTeleportThing(cid, tpos)
doSendMagicEffect(tpos, 10)
end
end

dont forget to put your right place Coordinates here
this is an example
Code:
tepos = {x=1000, y=1000, z=7}

Then put in data/actions.xml
Code:
<action itemid="9141" script="teleport.lua"/>

That's not checking if the player has a skull
 
Dont forget Rep++ if worked :D

edit the script to:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
tepos = {x=, y=, z=}
playerSkull = getCreatureSkullType(cid)

if getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE or playerSkull == SKULL_RED or playerSkull == SKULL_BLACK then
doPlayerSendCancel(cid, "Either you have battle sign or you have a skull that prevent you from teleporting.")
else
doTeleportThing(cid, tpos)
doSendMagicEffect(tpos, 10)
end
end

Sure i didn't added white skull coz u can never have white skull without battle, but u can have red or black without battle

this one will check all kind of skulls even the white skull , although it's useless and the first one look better but i will post for u in case of u need it

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
tepos = {x=, y=, z=}
playerSkull = getCreatureSkullType(cid)

if getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE or playerSkull == SKULL_RED or playerSkull == SKULL_BLACK or playerSkull == SKULL_WHITE then
doPlayerSendCancel(cid, "Either you have battle sign or you have a skull that prevent you from teleporting.")
else
doTeleportThing(cid, tpos)
doSendMagicEffect(tpos, 10)
end
end

Dont forget to Rep++ me if it worked :)
 
Not Tested, Should work.

actions/scripts/script.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local ppos = { x=100, y=100, z=7 }
	local skull = getCreatureSkullType(cid)
	if (getCreatureCondition(cid, CONDITION_INFIGHT) == false) then
		if (skull == SKULL_NONE) then
			doTeleportThing(cid, ppos)
			doCreatureSay(cid, "Teleported!", TALKTYPE_ORANGE_1)
			doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are skulled and cannot use this.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are currently in a fight.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
	return true
end
 
Last edited:
actions/scripts/script.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local ppos = { x=100, y=100, z=7 }
	local skull = getCreatureSkullType(cid)
	if (getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
		if (skull == SKULL_WHITE) or (skull == SKULL_RED) or (skull == SKULL_BLACK) then
			doTeleportThing(cid, ppos)
			doCreatureSay(cid, "Teleported!", TALKTYPE_ORANGE_1)
			doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are skulled and cannot use this.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are currently in a fight.")
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
	return true
end

20:35 You are currently in a fight.
20:35 You are currently in a fight.
20:35 You are currently in a fight.

Why does it not work? Using 0.3.5 pl1.
 
Now it will work, sorry about that...

Same problem, but now..

04:09 You are skulled and cannot use this.

Is it because i am a gamemaster?

EDIT: Tested on a none-skulled normal character. He could not use it same problem
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local ppos = { x=100, y=100, z=7 }
        local skull = getCreatureSkullType(cid)
 if (getCreatureCondition(cid, CONDITION_INFIGHT) == false) and  if (skull == SKULL_WHITE) or (skull == SKULL_RED) or (skull == SKULL_BLACK) == false then
			doTeleportThing(cid, ppos)
                        doCreatureSay(cid, "Teleported!", TALKTYPE_ORANGE_1)
                        doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Players who are skulled or are in a battle may not use this.")
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
			end
		end
	return true
end

See if that will work
 
Back
Top