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

NPC Future traveling

advander

Duck
Joined
May 17, 2010
Messages
275
Reaction score
9
Hello,

I'm requesting a NPC
With the name Ahti and looktype 54

You: Hi
Ahti: Hello |playername| I can see into the future, do you like too know what future is yours?
You: yes
Ahti: Uhm let me see, Aah there it is, aargh this is not good I can only see fear and death in your hands.

then she tps you too another time(city) with the position,

474
716
14

I really need this npc we have try too do it our selfs but we failed

REP++

Thx in advance
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(msgcontains(msg, 'yes')) then
		selfSay('Very well, Uhm let me see, Aah there it is, aargh this is not good I can only see fear and death in your hands.', cid)
		talkState[talkUser] = 1
		doTeleportThing(cid,{x = 474, y = 716, z = 14},false)	
	end
			else
				selfSay('Have a nice life, while you still have time..', cid)
			end
		else
			selfSay('Pray to the gods, they are the only ones who can save you now...', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Very well, then let your mind stay in the shadows.', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Make a new file in data/npc/scripts and put that in there, make sure to name it future.lua

Then open data/npc and make a new xml file and put this in there:
XML:
<?xml version="1.0"?>
<npc name="Ahti" script="future.lua" floorchange="0" walkinterval="4000">
	<health now="150" max="150"/>
	<look type="54" head="10" body="122" legs="19" feet="10"/>
		<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can see into the future, would you like to know what is in store for you?"/>
		<parameter key="message_decline" value="May your future be filled with darkness..."/>
	</parameters>
</npc>

I didn't test it so if it doesn't work post the errors here, and if it does work REP ++ me thanks.
 
Thanks for helping but aint working

[02/03/2012 08:35:02] [Error - LuaScriptInterface::loadFile] data/npc/scripts/future.lua:23: 'end' expected (to close 'function' at line 11) near 'else'
[02/03/2012 08:35:02] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/future.lua
[02/03/2012 08:35:02] data/npc/scripts/future.lua:23: 'end' expected (to close 'function' at line 11) near 'else'

btw I'm using
[02/03/2012 08:32:17] The Forgotten Server, version 0.3.6 (Crying Damson)
[02/03/2012 08:32:17] Compiled with GNU C++ version 3.4.5 (mingw special) at Dec 24 2009, 10:39:30.

Thx in advance
 
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
 
	if(msgcontains(msg, 'yes')) then
		selfSay('Very well, Uhm let me see, Aah there it is, aargh this is not good I can only see fear and death in your hands.', cid)
		talkState[talkUser] = 1
		doTeleportThing(cid,{x = 474, y = 716, z = 14},false)	
		else
			selfSay('Have a nice life, while you still have time..', cid)
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Replace the old script i gave you and try this one. Not tested but if it works REP ++ me and if it doesn't post the errors please.
 
Last edited:
Code:
<?xml version="1.0"?>
<npc name="Ahti" script="future.lua" floorchange="0" walkinterval="4000">
	<health now="150" max="150"/>
	<look type="54" head="10" body="122" legs="19" feet="10"/>
		<parameters>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. I can see into the future, would you like to know what is in store for you?"/>
		<parameter key="message_decline" value="May your future be filled with darkness..."/>
                <parameter key="message_walkaway" value="TEXT" />
	</parameters>
</npc>
 
Back
Top