Page 1 of 1
NPC Movement
Posted: Sun Apr 23, 2017 5:10 am
by Ememjr
in the following spawn script i am trying to get the NPC to run away to another location but he just stands there i know the inrange part is getting access because that shows up when i get close, what i am i doing wrong on this on
Code: Select all
--[[
Script Name : SpawnScripts/Oakmyst/FulkoirHaggleton.lua
Script Purpose : Fulkoir Haggleton
Script Author : John Adams
Script Date : 2009.05.04
Modified by : Ememjr
Modified Date : 2017.04.22
Modified Notes : fixed to work with current Content on Official
Script Notes : Auto-Generated Conversation from PacketParser Data
--]]
function spawn(NPC)
SetPlayerProximityFunction(NPC, 10, "InRange", "LeaveRange")
end
function respawn(NPC)
spawn(NPC)
end
function InRange(NPC, Spawn)
PlayFlavor(NPC, "voiceover/english/tutorial_revamp/fulkoir_haggleton/qey_adv01_oakmyst_revamp/qst_fulkoir_gone_ff0a041c.mp3", "I'd have to be five times as crazy as I already am to stay here!", "", 2327597972, 1883003048, Spawn)
MoveToLocation(Spawn,1005,0,-253,10)
end
function LeaveRange(NPC, Spawn)
end
function hailed(NPC, Spawn)
FaceTarget(NPC, Spawn)
end
Re: NPC Movement
Posted: Sun Apr 23, 2017 12:01 pm
by Gangrenous
I think you need to pass the NPC.
MoveToLocation(NPC,1005,0,-253,10)
Re: NPC Movement
Posted: Sun Apr 23, 2017 4:14 pm
by Ememjr
thats the way i had, it actually tried both ways
is there a maximum distance he will go or a line of site type thing that has to be followed or should the go to any valid location
Re: NPC Movement
Posted: Sun Apr 23, 2017 4:41 pm
by Jabantiz
Gangrenous is right that it should be NPC as that is who you are actually trying to move.
There is no max distance or line of sight (server is not aware of level geometry currently), a speed of 10 is rather high though, normal run speed is 4 and walk speed is 2, but it should still work even with that high speed. I will test it out later tonight to see if I can figure out what is going wrong.
Re: NPC Movement
Posted: Sun Apr 23, 2017 5:02 pm
by Cynnar
Just a thought but you do not have spaces after the comma. The example on the
wiki shows spaces like so
Code: Select all
function hailed(NPC, Spawn)
MoveToLocation(NPC, 10, 0, 20)
end
Yours doesn't. Change to this
Code: Select all
MoveToLocation(Spawn, 1005, 0, -253, 10)
And see if that helps
Re: NPC Movement
Posted: Sun Apr 23, 2017 5:32 pm
by Gangrenous
I do not think the spacing is important at all. I would first check on a different spawn, just to be sure there is not something set on that spawn.
Re: NPC Movement
Posted: Sun Apr 23, 2017 5:43 pm
by Jabantiz
Spaces don't matter, it is mainly for readability and doesn't effect the execution of the code.
I just tested on the emu server and the following code works fine
Code: Select all
function InRange(NPC, Spawn)
PlayFlavor(NPC, "voiceover/english/tutorial_revamp/fulkoir_haggleton/qey_adv01_oakmyst_revamp/qst_fulkoir_gone_ff0a041c.mp3", "I'd have to be five times as crazy as I already am to stay here!", "", 2327597972, 1883003048, Spawn)
MoveToLocation(NPC,1005,13.56,-253,5)
end
I think the issue was a combination of the high speed and the location you sent the spawn to was below the map (y=0) changing that to be above the map worked. I say a combination because when spawns end up to far below the map it causes some strange graphics issues and in this case he was probably getting there almost immediately with the high speed causing him to either disappear or appear to not move at all.
Again spawn is set up on the emu server now if you want to take a look, you will probably need to /repop to get him back at his spawn point if he isn't already.
Re: NPC Movement
Posted: Mon Apr 24, 2017 12:07 am
by Cynnar
Good info to know.
I didn't think spacing mattered, but was the only thing I could see different than the way wiki was done. Didn't think about y being below map.
Re: NPC Movement
Posted: Mon Apr 24, 2017 4:01 am
by Ememjr
ok will try that, even thought that is not the true spot he is supposed to go to i put a shorter distance in my example to test it out, i will update the coords on emu
Re: NPC Movement
Posted: Mon Apr 24, 2017 4:11 am
by Ememjr
ok i slowed it down to 4, and its working now will update the entiere quest on emu when i get it clesned up, btw for the same quest an important meeting, for th kill quest part of it is there a way to have a addkillquest that the target is the entire group of mobs has to be killed befoe you get the quest update, ie the quest says to kill gilrix, but you dont get an update on live when you kill gilrix until he and his gnoll assassins are dead the entire group of 3,
Re: NPC Movement
Posted: Mon Apr 24, 2017 4:08 pm
by Jabantiz
You could use the generic
AddQuestStep() then set up gilrix and his grouped spawns with a spawn scripts and take advantage of the "group_dead" event to update the quest from there with
SetStepComplete(). If there is nothing special about gilrix you could use one script for the entire group instead of making a new script for each.