Constant running Scripts

Post » Tue May 17, 2011 10:58 am

Hi all,

it must be very simple what I'm trying to achieve, but I'm not having much joy.

I'm trying to have it so that an NPC spawns before the player after a certain amount of time has passed within the game. For argument's and testing's sake, let's say 10 seconds.

I place the NPC in an incredibly obscure and unreachable part of the wasteland, assign them an ID and when the timer hits 10, the NPC 'teleports' to the players location.

This however doesn't seem to be happening. I apply the script to the NPC and zilcho.

Is this because I'm using a Begin GameMode when I'm not in the same 'cell' as the NPC?

scn mytestnpcFOLLOWERSCRIPTfloat timerbegin gamemode   if timer < 10      set timer to timer + GetSecondsPassed   else      	ShowMessage mytestnpcMsgDEBUG	PlaySound FXMissileFlyBy	imod FlashBangISfx	mytestnpc00.MoveTo Player     set timer to 0   endifend


Cheers
User avatar
Gemma Archer
 
Posts: 3492
Joined: Sun Jul 16, 2006 12:02 am

Post » Tue May 17, 2011 12:03 pm

Yes. You'll want to use a quest script for something like this.

Cipscis
User avatar
Christine Pane
 
Posts: 3306
Joined: Mon Apr 23, 2007 2:14 am

Post » Tue May 17, 2011 1:54 am

Yep, it's because you're not in the same cell. Gamemode scripts run when the object is processed- if an object/NPC is in a cell adjacent to the player, they're processed every frame. If the NPC isn't, they're only run when the NPC is processed to check their AI package, about once every game hour (slightly more often if the NPC is flagged as a Quest Object, never if the NPC has No Low-Leveled Processing enabled). If you want to set up a timer that's not dependent on a particular object, you'll need to make a Quest and use a Quest Script.
User avatar
willow
 
Posts: 3414
Joined: Wed Jul 26, 2006 9:43 pm

Post » Tue May 17, 2011 9:11 am

Yes. You'll want to use a quest script for something like this.

Cipscis


Aaaaahh, I see! So effectively, what I need to do is place the script on the NPC's speech 'Quest', enable it to start when the game is running and then utilise the gameMode as per norm?

Yep, it's because you're not in the same cell. Gamemode scripts run when the object is processed- if an object/NPC is in a cell adjacent to the player, they're processed every frame. If the NPC isn't, they're only run when the NPC is processed to check their AI package, about once every game hour (slightly more often if the NPC is flagged as a Quest Object, never if the NPC has No Low-Leveled Processing enabled). If you want to set up a timer that's not dependent on a particular object, you'll need to make a Quest and use a Quest Script.


Gotcha :) Confirmed my suspicions but wasn't too sure, many thanks.
User avatar
Brandon Wilson
 
Posts: 3487
Joined: Sat Oct 13, 2007 1:31 am

Post » Tue May 17, 2011 4:11 am

Brilliant, resolved that one thanks :) But not entirely dissimilar to the same question... if I'm trying to get an NPC to disappear when you've finished a convo, putting:

mytestnpc.disable


into the result script of the topic crashes the game. I've been sat here scratching my head trying so hard to think of a way around this and for the life of me I can't. Any theories?
User avatar
Ally Chimienti
 
Posts: 3409
Joined: Fri Jan 19, 2007 6:53 am

Post » Mon May 16, 2011 10:53 pm

Its probably because you are disabling the NPC "as you are talking to them". How can you be talking to somebody who is suddenly disabled?

It would be better to add an AI package on the NPC that tells them to 'go somewhere else' and be disabled when they get there.
User avatar
Peter P Canning
 
Posts: 3531
Joined: Tue May 22, 2007 2:44 am


Return to Fallout 3