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

[Advanced] NPC Tutorial

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,838
Solutions
18
Reaction score
617
Location
Poland
Hello.
Anyone can make for me an advanced npc ?
(TFS 0.3.6pl1)

I need an tutorial npc with that options:
- depot
- arena
- spell teacher

If i talk to npc and say an option above, the npc say: "Please follow me, i show you where it is..." and goin to place X,Y,Z (NPC). Player are automatically selffolow the NPC to that place.
At end of place (if player & npc are in x,y,z) the Player stop selffollowing npc and NPC dissapear with text: "See you next time" and teleports to respawn (the place before player take the npc).


Anyone can make that for me ?
 
You can use the function that already exists in the NPC lib

Code:
selfMoveTo(x, y, z)

i dont know if it'll work when it has to change floors, so if it doesnt, just move him to the stair hole, then when he goes down, set another selfMoveTo
 
something like this perhaps? (Not full code!!!)
(made in reply)
Code:
local BANK_POS = {x = 100, y = 100, z = 7}
local originalPos = {x = 80, y = 80, z = 7}

function onCreatureSay(cid, type, msg)
	...
	if msg == "bank" then
		selfSay("Follow me")
		doPlayerFollowCreature(cid, getNpcId())
[FONT=monospace]		selfMoveTo(BANK_POS[/FONT][FONT=monospace])[/FONT][FONT=monospace]
[/FONT][FONT=monospace]	end[/FONT][FONT=monospace]
[/FONT][FONT=monospace]	...
end

function onThink()
	...
	if getDistanceBetween(getNpcPos(), BANK_POS) == 0 then
		selfSay("Here we are")
		doTeleportThing(getNpcId(), originalPos)
	end
	...
end
[/FONT]
 
where's the fun in that?
I just told you everything you need to know, just get ur own NPC, copy the code I wrote in the appropriate place and it should work
 
Back
Top