NPC Movement

Discussions of the design and development of in-game content.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

NPC Movement

Post by Ememjr » Sun Apr 23, 2017 5:10 am

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

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: NPC Movement

Post by Gangrenous » Sun Apr 23, 2017 12:01 pm

I think you need to pass the NPC.

MoveToLocation(NPC,1005,0,-253,10)
Resident Dirty Hippy

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: NPC Movement

Post by Ememjr » Sun Apr 23, 2017 4:14 pm

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

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: NPC Movement

Post by Jabantiz » Sun Apr 23, 2017 4:41 pm

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.

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: NPC Movement

Post by Cynnar » Sun Apr 23, 2017 5:02 pm

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
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

User avatar
Gangrenous
Posts: 812
Joined: Sun Apr 24, 2016 6:54 am
Characters: Dinsmoor

Re: NPC Movement

Post by Gangrenous » Sun Apr 23, 2017 5:32 pm

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.
Resident Dirty Hippy

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: NPC Movement

Post by Jabantiz » Sun Apr 23, 2017 5:43 pm

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.

User avatar
Cynnar
Project Leader
Posts: 738
Joined: Sat Sep 27, 2014 1:22 am
EQ2Emu Server: Eq2emulator
Characters: Vlash
Veinlash
Taragak
Cynnar

Re: NPC Movement

Post by Cynnar » Mon Apr 24, 2017 12:07 am

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.
[ 01000011 01111001 01101110 01101110 01100001 01110010 ]

Follow on:
Twitter Facebook

Contact me:
PM Discord chat email

Hardware: the parts of a computer that can be kicked

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: NPC Movement

Post by Ememjr » Mon Apr 24, 2017 4:01 am

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

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: NPC Movement

Post by Ememjr » Mon Apr 24, 2017 4:11 am

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,

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: NPC Movement

Post by Jabantiz » Mon Apr 24, 2017 4:08 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests