• 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 tile with outfit change

Xernoo

Cookie Lova
Joined
Jun 14, 2010
Messages
59
Reaction score
4
Location
Sweden, Jämtland
Hello, I need a script that, if you step on a tile you get teleported, a message appear and it changes ur outfit to swimming outfit.

I also need a npc with swimming outfit that, when you come to the new tile he comes to you (like follow) and say: Hey! do you need help?
if awser is: Yes then teleport to a location.
if awser is: No then say: Ok then, just don't get to close to the waterfall.
Rep++ :peace:
 
[1]
swimtile.lua:

Code:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
		return true
	end

	local pos, newPos = getCreaturePosition(cid), {x = EDIT, y = EDIT, z = EDIT}
	doSetCreatureOutfit(cid, outfit, -1)
	doTeleportThing(cid, newPos)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now swimming.")
	doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)

	return true
end

In movements.xml:
Code:
	<movevent type="StepIn" actionid="XXXX" event="script" value="swimtile.lua"/>
 
Last edited:
Try this
LUA:
local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
		return true
	end

	local pos, newPos = getCreaturePosition(cid), {x = EDIT, y = EDIT, z = EDIT}
	if(math.random(1, 100) <= 90) then
    doSetCreatureOutfit(cid, outfit, -1)
	doTeleportThing(cid, newPos)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now swimming.")
	doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
elseif(math.random(1, 100) >= 91) then
    doPlayerSendCancel(cid, "Good luck next time!")

	return true
end

Idk if it will work but I tried my best :D
 
some fixes :)
LUA:
local outfit = 1291  -- looktype
local chance = 10    -- in %
local newPos = {x = EDIT, y = EDIT, z = EDIT}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
		return true
	end
	local outfitt = getCreatureOutfit(cid)
		outfitt.lookType = outfit
	if(math.random(1, 100) <= chance) then
		doSetCreatureOutfit(cid, outfitt)
		doTeleportThing(cid, newPos)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now swimming.")
		doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
	else
		doPlayerSendCancel(cid, "Good luck next time!")
		doTeleportThing(cid,fromPosition)
		doSendMagicEffect(fromPosition,2)
	end
 
	return true
end
 
Try:
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
 
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)            npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)            npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                    npcHandler:onThink() end
 
function greetCallback(cid)
	Topic[cid] = 0
	return true
end
local place = {x=95,y=125,z=7} ---- Edit this to your POSITIONS
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end
	if msgcontains(msg, 'help') then
		npcHandler:say('Would you like some help?!', cid)
		Topic[cid] = 1
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
		npcHandler:say('Are you ready?', cid)
		Topic[cid] = 2
	elseif msgcontains(msg, 'no') and Topic[cid] == 1 then
		npcHandler:say('Ok then, just don\'t get near the waterfall.', cid)
		Topic[cid] = 0
	elseif msgcontains(msg, 'yes') and Topic[cid] == 2 then
		Topic[cid] = 0
		selfSay('There you go!', cid)
		addEvent(doTeleportThing,50,cid,place)
		addEvent(doSendMagicEffect,100,place,10)
      end
	return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Melchior" script="data/npc/scripts/YOURFILE!.lua" walkinterval="5000" floorchange="0">
	<health now="100" max="100"/>
	<look type="267" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME| do you need {help}?"/>
</parameters>
</npc>

Credits for Doggynub, he helped me fixing the npc script :P
 
Thanks.. You deserve credist too. ^^ So rep+!

Edit: You must spread some Reputation around before giving it to santigggg again. - You must spread some Reputation around before giving it to Doggynub again. I will give you both as soon as I can, even tho Doggynub has disabled hes reputation. :)
 
Back
Top