Scaling NPCs

Post » Sat May 28, 2011 11:17 am

I'm sure a lot of people remember MMM for Oblivion, and I seem to remember it having an optional plugin that would scale NPCs based on their Endurance-equivalent stat. Anyone have any ideas on how to do this?
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Sat May 28, 2011 11:19 am

A long long time ago, someone asked me to make a gun that would increase an NPC scale when hit with it. I did this, but have subsequently removed all traces of it. So, I guess what I am saying is that it is possible from an individual point of view. Now, if you want to adjust the scale of every NPC in the game, that might become a bit tricky. I suppose you could do it with some FOSE commands. You could perform ref-walks on all nearby NPC and adjust their scale this way, then add their ref to a form list. Then on future re-walks, NPCs in the Form list would be skipped by the ref-walk. But I am not sure how efficient this approach would be. Its an awful lot of ref-walking and form list searching. I can't think of any way to perform this on a one time basis for every NPC in the game.
User avatar
Marina Leigh
 
Posts: 3339
Joined: Wed Jun 21, 2006 7:59 pm

Post » Sat May 28, 2011 6:45 pm

Just use http://geck.gamesas.com/index.php/GetItemCount and a token instead of a form list to check if actors have been scaled already. A quest script running a ref-walk every 5 seconds or so should be sufficient:
ref rCurrentReffloat fScaleBegin GameMode	set rCurrentRef to GetFirstRef 200 1 0	Label 10	if rCurrentRef		if rCurrentRef.GetItemCount ScaleToken == 0			rCurrentRef.AddItem ScaleToken 1 1			; Calculate new scale and apply to fScale			rCurrentRef.SetScale fScale		endif		set rCurrentRef to Pencil01 ; Prevent apple bug		set rCurrentRef to GetNextRef		Goto 10	endifEnd

Cipscis
User avatar
Calum Campbell
 
Posts: 3574
Joined: Tue Jul 10, 2007 7:55 am

Post » Sat May 28, 2011 10:08 am

Yes, of course! *bows to his master*
User avatar
Mari martnez Martinez
 
Posts: 3500
Joined: Sat Aug 11, 2007 9:39 am

Post » Sat May 28, 2011 8:21 pm

I just remembered about this:
http://www.fallout3nexus.com/downloads/file.php?id=3202 by Luchaire @Fallout 3 Nexus

It might be worth having a look at the back end of this.

Cipscis
User avatar
katie TWAVA
 
Posts: 3452
Joined: Tue Jul 04, 2006 3:32 am

Post » Sat May 28, 2011 9:20 am

Hey thanks a bunch guys, will get on this once I'm reunited with my modding rig.
User avatar
Margarita Diaz
 
Posts: 3511
Joined: Sun Aug 12, 2007 2:01 pm

Post » Sat May 28, 2011 11:56 am

I'm sure a lot of people remember MMM for Oblivion, and I seem to remember it having an optional plugin that would scale NPCs based on their Endurance-equivalent stat. Anyone have any ideas on how to do this?

Actually it was the other way around :) NPCs and creatures were scaled up or down randomly (variance depending on type etc), and then STR, END and Health were set accordingly, such that larger creatures were stronger, had more health etc.

MMM for F3 does this too, if you're interested check out the script aMMMzCreatureOnLoadStats (there's also an aMMMzNPCOnLoadStats).

If you're playing around with scaling note there are two bugs in Fallout 3 to be aware of:

  • Creatures and NPCs scaled at placement in the GECK will become invincible if scaled afterwards in-game. Elminster added a function in FO3Edit to help me find these ('Scaled Actors'). MMM first checks to ensure a scale hasn't been changed and won't apply its own scaling if it has.

  • There's an obscure bug when reading the health of an actor with getav that's been scaled -- it returns a negative value instead of the actual health. We never tracked down how this occurs, there appeared to be no pattern whether they are ACRE or ACHR entries or placeatme, whether they are originally scaled or not, whether realted to scale changes in the first few frames after spawning etc. It just pops up every now and then, not common but not rare. MMM checks for this occuring and if detected won't modify the health of that actor.


You can see the checks and workarounds for both of these in the aforementioned scripts.
User avatar
Joe Alvarado
 
Posts: 3467
Joined: Sat Nov 24, 2007 11:13 pm

Post » Sat May 28, 2011 4:45 am

Actually it was the other way around :) NPCs and creatures were scaled up or down randomly (variance depending on type etc), and then STR, END and Health were set accordingly, such that larger creatures were stronger, had more health etc.

MMM for F3 does this too, if you're interested check out the script aMMMzCreatureOnLoadStats (there's also an aMMMzNPCOnLoadStats).

If you're playing around with scaling note there are two bugs in Fallout 3 to be aware of:

  • Creatures and NPCs scaled at placement in the GECK will become invincible if scaled afterwards in-game. Elminster added a function in FO3Edit to help me find these ('Scaled Actors'). MMM first checks to ensure a scale hasn't been changed and won't apply its own scaling if it has.

  • There's an obscure bug when reading the health of an actor with getav that's been scaled -- it returns a negative value instead of the actual health. We never tracked down how this occurs, there appeared to be no pattern whether they are ACRE or ACHR entries or placeatme, whether they are originally scaled or not, whether realted to scale changes in the first few frames after spawning etc. It just pops up every now and then, not common but not rare. MMM checks for this occuring and if detected won't modify the health of that actor.


You can see the checks and workarounds for both of these in the aforementioned scripts.


Alright sweet, thanks so much Mart! But for the negative health, could you not run an abs function on the returned health, so that getav always returns the proper value?
User avatar
i grind hard
 
Posts: 3463
Joined: Sat Aug 18, 2007 2:58 am

Post » Sat May 28, 2011 5:59 am

Alright sweet, thanks so much Mart! But for the negative health, could you not run an abs function on the returned health, so that getav always returns the proper value?

Honestly, I can't remember if the problem was a negative version of the actor's health or an arbitrary negative value that didn't correspond. Probably the latter, as I'd likely have applied a fixed result, but instead (looking at my script now, this was over a year ago!) I leave the actor's health at default if the bug exhibits.
User avatar
Elizabeth Falvey
 
Posts: 3347
Joined: Fri Oct 26, 2007 1:37 am


Return to Fallout 3