Page 1 of 1

Spawn scripts

Posted: Tue Oct 31, 2017 6:57 pm
by Ememjr
when you have a spawn scripy that does mulitple things, is there a way to make sure that functions dont run till the previous function is done
for example, the following is a list of things the npc does

of course the ***** lines are not in my code, just a note of what needs to happen

Code: Select all

PlayFlavor(NPC,"voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_005.mp3","We are heading to the Island of Refuge.","",1602680439,2810422278,Spawn)
**** here need to wait till the above playfovor finishes
	PerformCameraShake(Spawn,52429,15948)
***** wiat till above finishes
	PerformCameraShake(Spawn,52429,15820)
***** add ingrid running to the captins location
	PerformCameraShake(Spawn,52429,15820)
***** wait till ingrid starts running and to this one
	PlayFlavor(NPC,"voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_006.mp3","Ingrid! Quit gawking at the shorty and fix that yard-arm!","",2753489262,3183736171,Spawn)
***** ingrid runns up and talks need to wiat till this done beofre proceding
	PlayFlavor(NPC,"voiceover/english/captain_varlos/boat_06p_tutorial02_fvo_007.mp3","Don't want the ship to come apart in these high winds, do ya'?!","",517097409,4194681002,Spawn)

Re: Spawn scripts

Posted: Tue Oct 31, 2017 7:00 pm
by Jabantiz
It will go in order however in the case of the camera shakes it will build and send the packet and once done it will build and send the next one probably well before the first is done and either overriding the first or adding to it. If you want to add a delay you will likely need to use spawn timers with the required delay and the next camera shake and another timer in the call back function.

Re: Spawn scripts

Posted: Wed Nov 01, 2017 6:54 am
by Ememjr
so continueing on with the headache, after my first performcamerashake i want Ingrid to move up to where the captain is (MovetoLocation)
can i have the captains spawn script tell ingrid to move at that specific time in this script

just to be know all this happens without user intervention
1. performcamerashake
2. playfavor of captain yelling at ingrid ( this may actually trigger ingrid to run up
3. ingrid starts running up ( i know that Move to location will move her but how do i tell her script to move after the captain yells
4. another camera shake
5. igrid and the captain have words between them selfs(same here who do we control a conversation between npcs, so they dont get out of sync
6. ingrid runs away
7. captain offers quest

i figure out useing the getspawn()

Re: Spawn scripts

Posted: Wed Nov 01, 2017 5:01 pm
by Jabantiz
Ememjr wrote: Wed Nov 01, 2017 6:54 am i figure out useing the getspawn()
I assume you solved this then.

But yea you can get a pointer to Ingrid with GetSpawn() and as Ingrid is a unique spawn it should be simple. In the event there is multiple of the same spawn in a zone then GetSpawn() will return the closest to the first spawn and if that is not what you want you would need to use GetSpawnByLocationID() and use the location id, not the spawn id, instead. But again Ingrid should be unique so not an issue in this case.

Re: Spawn scripts

Posted: Wed Nov 01, 2017 7:09 pm
by Ememjr
actaully i figured out step 2
3. should be resolve from other movement post, so 5 would be next getting the convo betwen NPC's without them tlaking over each other or talking out of turn

Re: Spawn scripts

Posted: Wed Nov 01, 2017 7:34 pm
by Jabantiz
For 5 I would have the entire convo in one spawn script and use timers and GetSpawn() when the other spawn (that doesn't belong to this script) talks. Or if you want the dialog in their own spawn scripts you could set the timers to go to the other spawn and have the callback function in the other spawns script.