Changing creatures on a cells reset?

Post » Tue May 17, 2011 2:51 pm

So, I've been working on a cell recently that the first time the player enters the cell, will have some unique enemies and nothing more. After the player has successfully cleared the cell though, I'd like it to respawn with a more generic population. I've thought of a few ways to do that but not sure if there might be a better. At the moment, I have the creatures set up, the unique ones don't respawn, and the others are initially disabled, I've looked at enabling them by having the player passing through a trigger in a cell farther in the dungeon however that would set them to spawn as soon as they were enabled I'd assume? I'd like there to be a little time between the initial creatures and the generic to simulate the cell being repopulated. Any thoughts?
User avatar
Heather Kush
 
Posts: 3456
Joined: Tue Jun 05, 2007 10:05 pm

Post » Tue May 17, 2011 3:11 pm

You may want to take a look at the Bonnie Springs location in the base game, which works exactly as you suggest. It is initially populated by some raiders. Once you kill the raiders, a timer starts, and four days later, a bunch of cazador nests appear. In general, you can have a trigger, which starts a quest script, which runs occasionally to check how much time has passed. Once N number of days have passed, the script can then populate your area with new creatures.
User avatar
Trent Theriot
 
Posts: 3395
Joined: Sat Oct 13, 2007 3:37 am

Post » Tue May 17, 2011 12:39 am

Put a sctipt like this on an activator somewhere in the cell
float TimeToNextBegin OnLoadif getdeadcount MyCreature == 6 ;where 6 is the total number of creatures if TimeToNext < gamedayspassed   MyOtherCreature.enableendifendifEnd


Put a script like this on the first run of creatures

Begin OnDeath   set MyActivatorRef.TimeToNext to gamegayspassed + 4  :where 4 is the number of days till new creatures respawnEnd


Then make the MyOtherCreature the parent of all the second group of creatures, and they will all enable when he does. Pretty efficient, and no need to run any gamemode stuff.
User avatar
Jonathan Egan
 
Posts: 3432
Joined: Fri Jun 22, 2007 3:27 pm

Post » Tue May 17, 2011 8:13 am

Fantastic, thank ya kindly folks! :D
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Mon May 16, 2011 11:52 pm

There is one small drawback to this approach, that may not be a problem. Suppose the player kills the six creatures and then waits in the area, without leaving, for the four days. Onload only executes when the cell is loaded, so it will never trigger until the player actually leaves.
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Tue May 17, 2011 12:35 pm

I assumed that the first run of creatures will all be from the same base object, but if not then the code below would be needed to keep track of the number killed.

If the point davidlallen brings up is relevant then you can just change the OnLoad to a GameMode block.

I also added the short once in there so the script only executes one time. Could get a crash when that block runs and the second wave of creatures has been cleaned up by a cell reset without it.

float TimeToNextshort countshort onceBegin OnLoadif once == 0if count == 6 ;where 6 is the total number of creatures if TimeToNext < gamedayspassed   MyOtherCreature.enable   set once to 1endifendifendifEnd


Put a script like this on the first run of creatures

Begin OnDeath   set MyActivatorRef.count to MyActivatorRef.count + 1   set MyActivatorRef.TimeToNext to gamegayspassed + 4  :where 4 is the number of days till new creatures respawnEnd

User avatar
Claudz
 
Posts: 3484
Joined: Thu Sep 07, 2006 5:33 am

Post » Tue May 17, 2011 8:20 am

I dont believe that would matter, this is simply a cell the player will be passing through (multiple times, hence wanting new creatures to respawn) but they should have no reason to actually stay in the cell. And I'll update the scripts, thanks again. :)

Edit: Ok, was hoping to avoid this, but it turns out I'll have to show just how much of a noob at scripting I am. The OnDeath script wont validate, I've run it through cipsis validator but no dice, doesnt tell me what the issue is. I'm assuming MyActivatorRef is the activator I dropped and placed the first script on, correct? I'm sure it's something easy I'm missing, so if you could just point me in the right direction.... :)
User avatar
ONLY ME!!!!
 
Posts: 3479
Joined: Tue Aug 28, 2007 12:16 pm

Post » Tue May 17, 2011 7:26 am

MyActivatorRef needs to be the Reference ID of the activator, not the Editor ID. To Create a reference id double click the activator in the render window to open its properties. Then you can fill in a name at the top where it says Reference Editor ID. Make sure to check persistent near the bottom too. Then this will be the name you can use in your script.

If you dont have gerk power up installed you should get it. It will turn on the warnings when scripts won't compile helping you troubleshoot your code.
User avatar
Bones47
 
Posts: 3399
Joined: Fri Nov 09, 2007 11:15 pm

Post » Tue May 17, 2011 5:12 am

Yeah, set up the activator with a ref ID, persistent object as well. I didn't realize the geck power up turned on the script warnings though, will have to download that now. Will get back to you.

Edit: Found the problem....

Begin OnDeath   set MyActivatorRef.count to MyActivatorRef.count + 1   set MyActivatorRef.TimeToNext to gameGAYSpassed + 4  ;where 4 is the number of days till new creatures respawnEnd


:facepalm: I need to learn to read better. Though in my defense, spell checking was never my forte. Anyway, thanks b3w4r3 and david, much appreciated of the help.
User avatar
Yung Prince
 
Posts: 3373
Joined: Thu Oct 11, 2007 10:45 pm

Post » Tue May 17, 2011 5:17 am

lol I see now. Typical typo for me.
User avatar
Da Missz
 
Posts: 3438
Joined: Fri Mar 30, 2007 4:42 pm


Return to Fallout: New Vegas