Several Related Scripting Questions

Post » Sun Aug 08, 2010 5:05 pm

Hey folks,

I'm the guy who built HB's Wasteland Tent, and I'm looking to upgrade it to accomodate companions beyond the vanilla ones. These were easy, since they're present in the FalloutNV.esm.

I posted this over at the Nexus, but am getting no replies, so please forgive me for the cross-posting.

The issues and questions revolve around a characteristic of the Havoc door objects; when a door is moved, its' location is not updated by the engine; believe me, I've tried several different ways. Hence, the Wasteland Tent doesn't use a door; just a couple of travel markers and the MoveTo function (for both the player and the vanilla followers subject to some checks to make sure that they're actually following, not waiting and not disabled). In other words, the Tent model itself is an activator.

As stated above, I'd like to be able to support other companions, such as Fake Plastic Trees EDE and GurkMeja's Sunny Smiles Companion (and a number of others recently uploaded to Nexus).

One of the things I've tried to do in preparation for this is to generalize the code which tests follower/waiting/disabled status before moving a follower into or out of the tent after the player. I did this with a formlist and NVSE to loop over and process it. It doesn't work, even for the vanilla followers, apparently because the engine has no way of knowing that an aliased reference to a reference (set rFollower to ListGetNthForm VanillaFollowerList, index). When you attempt to test variables through rFollower, the engine has no way of knowing that rFollower actually points at a follower with a script which contains variables like Waiting.
I've only been able to make it work for vanilla followers by duplicating the same conditional code block for each one. So, if generalizing this code doesnt' work for vanilla followers, it seems to bode ill for others not even in FalloutNV.esm.

Here's the code which doesn't work:
			label 0 ; Loop Init			set FollowerCount to ListGetCount WSTVanillaFollowersList			set ListIndex to 0			set rFollower to 0			label 1 ; Loop Top						set rFollower to ListGetNthForm WSTVanillaFollowersList, ListIndex						if ( ( rFollower.Waiting == 0 ) && ( rFollower.GetInFaction FollowerFaction == 1 ) )				rFollower.Disable				rFollower.MoveTo WSTEntryMarker				rFollower.Enable			endif			set ListIndex to ( ListIndex + 1 )			if ( ListIndex <= ( FollowerCount - 1 )				goto 1			endif			label 2 ; Loop End


And this code does work; easy to see why I'd rather do the code above than this:
			; Boone			if ( ( CraigBooneREF.Waiting == 0 ) && ( CraigBooneREF.GetInFaction FollowerFaction == 1) ) 				CraigBooneREF.Disable				CraigBooneREF.MoveTo WSTEntryMarker				CraigBooneREF.Enable			endif						; Cass			if ( ( RoseofSharonCassidyREF.Waiting == 0 ) && ( RoseofSharonCassidyREF.GetInFaction FollowerFaction == 1) ) 				RoseofSharonCassidyREF.Disable				RoseofSharonCassidyREF.MoveTo WSTEntryMarker				RoseofSharonCassidyREF.Enable			endif						; Veronica			if ( ( VeronicaREF.Waiting == 0 ) && ( VeronicaREF.GetInFaction FollowerFaction == 1) ) 				VeronicaREF.Disable				VeronicaREF.MoveTo WSTEntryMarker				VeronicaREF.Enable			endif                                                   .                                                   .                                                   .


Anyone have any ideas as to how I might:

A) get a door object to actually update its world location if moved (with this, I could remove all special-case code),
or
B) Generalize the entry/exit code in such a way as to make it possible to test both vanilla followers and any others I might add to the list in the course of play?

I've been fighting this for weeks, now; if anyone has any workable ideas, I'd be most grateful.

Thanks!
-HB
User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Sun Aug 08, 2010 9:20 am

This should be in the GECK forum. Anyway, instead of trying to check the variables on the NPC you could check their package target or package type to see if they're following the player.
It'd probably be easier to just use GetFirstRef/GetNextRef and GetIsTeammate (or whatever it is) to look at all the nearby actors and see if any of them are teammates, then move them.
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am

Post » Sun Aug 08, 2010 1:23 pm

This should be in the GECK forum. Anyway, instead of trying to check the variables on the NPC you could check their package target or package type to see if they're following the player.
It'd probably be easier to just use GetFirstRef/GetNextRef and GetIsTeammate (or whatever it is) to look at all the nearby actors and see if any of them are teammates, then move them.


Thanks, TT; I'll post new questions there. Sorry about that...

-HB
User avatar
Horse gal smithe
 
Posts: 3302
Joined: Wed Jul 05, 2006 9:23 pm

Post » Sun Aug 08, 2010 10:00 am

I'm using your latter approach in my hoverboard code. If it's stupid, but it works, then it's not stupid. Anyway, you probably know this, but I'll say it anyway, you need to do something like this:

ref DoorRef;ref WhereYouWantIt;float DiddlyDum;DoorRef.disable;DoorRef.moveto WhereYouWantIt;DoorRef.enable;set DiddlyDum to DoorRef.getpos x;DoorRef.setpos x DiddlyDum;


in order to move activators like doors properly. And, heh, you forgot a parenthesis in the last if in your first example, but I'll assume that's not your problem. Have you looked at scripts that do stuff with your followers, like the one for entering the Arena in the Legion fort?
User avatar
Nathan Hunter
 
Posts: 3464
Joined: Sun Apr 29, 2007 9:58 am

Post » Sun Aug 08, 2010 9:33 pm

I'm using your latter approach in my hoverboard code. If it's stupid, but it works, then it's not stupid. Anyway, you probably know this, but I'll say it anyway, you need to do something like this:

ref DoorRef;ref WhereYouWantIt;float DiddlyDum;DoorRef.disable;DoorRef.moveto WhereYouWantIt;DoorRef.enable;set DiddlyDum to DoorRef.getpos x;DoorRef.setpos x DiddlyDum;


in order to move activators like doors properly. And, heh, you forgot a parenthesis in the last if in your first example, but I'll assume that's not your problem. Have you looked at scripts that do stuff with your followers, like the one for entering the Arena in the Legion fort?



Nekhanimal! This code actually moves a door?? I had tried something very close, but not exactly the same; I'll give this a try! And you're right; if it works, it isn't dumb! :wink_smile:
User avatar
Andrea Pratt
 
Posts: 3396
Joined: Mon Jul 31, 2006 4:49 am

Post » Sun Aug 08, 2010 12:05 pm

I'm using your latter approach in my hoverboard code. If it's stupid, but it works, then it's not stupid. Anyway, you probably know this, but I'll say it anyway, you need to do something like this:

ref DoorRef;ref WhereYouWantIt;float DiddlyDum;DoorRef.disable;DoorRef.moveto WhereYouWantIt;DoorRef.enable;set DiddlyDum to DoorRef.getpos x;DoorRef.setpos x DiddlyDum;


in order to move activators like doors properly. And, heh, you forgot a parenthesis in the last if in your first example, but I'll assume that's not your problem. Have you looked at scripts that do stuff with your followers, like the one for entering the Arena in the Legion fort?


Well, after a bunch of screwing around, I'm unable to get the door to move on a consistent basis; sometimes it does, and sometimes it doesn't. Add to this that the linked door on the inside dumps me somewhere in the wasteland, which tells me that something isn't updating. I've tried using SetPos instead of moveto with no better results. I'm gonna try Toaster's suggestion next...

Best!
-HB
User avatar
Peter lopez
 
Posts: 3383
Joined: Mon Sep 10, 2007 5:55 pm


Return to Fallout: New Vegas