D1kaios Posted May 5, 2013 Posted May 5, 2013 Hi. I am in the final steps of completing a complete Body and Armor replacer for fallout 3 and I need some help with a concept I've been thinking about. My idea was to find a way to have the game use separate armor meshes for two separate female races. At first I thought I might be able to do this by creating another "gender". Of course, right now, the game is able to differentiate between a characters gender so that it can apply the appropriate armor (male or female). Unfortunately, I haven't found a way to do this through script. Second, I created a script for each piece of clothing that would check the race, and then, when the armor was equipped, switch to my own mesh. I wasn't able to find a way to cleanly unequip the item and a way to preserve the item condition. I'm starting to wonder if this is possible at all, so I figured that I would ask to see if anyone might have any ways to make this happen. Thanks,
Halstrom Posted May 5, 2013 Posted May 5, 2013 One thing I can warn you of is if you use a clothing effect to get a NPC to add a token to itself, it will fail, but it can add an effect spell ok. You probably want to look at how my outfit swapping scripts in SCR handle this for the vaultsuits & combat armor, what I do is have an object effect running on the outfit and it then adds an actor effect to handle the swapping, the actor effect grabs the health of the item then does the swap and then waits till it sees the new item is worn then updates it's health to that of the previous outfit variation and the spell removes itself.
D1kaios Posted May 5, 2013 Author Posted May 5, 2013 Thanks a lot, mate! I think that I found the armor script (SexoutSCRS6AddVaultSuit...), but I'm having some trouble understanding it completely... Which scripts should I be looking at here? From what I can tell, there are at least 3... Thanks, EDIT: EDIT: Yeah... I am completely confused... What exactly is the script supposed to do? I tried to figure it out, but the each script seems to reference other scripts which seem to reference other scripts...
Halstrom Posted May 6, 2013 Posted May 6, 2013 Thanks a lot, mate! I think that I found the armor script (SexoutSCRS6AddVaultSuit...), but I'm having some trouble understanding it completely... Which scripts should I be looking at here? From what I can tell, there are at least 3... Thanks, EDIT: EDIT: Yeah... I am completely confused... What exactly is the script supposed to do? I tried to figure it out, but the each script seems to reference other scripts which seem to reference other scripts... There are only 2 scripts for each outfit: SexoutSCRS6EFFSwapVaultSuit is inside and ObjectEffect activated by wearing the outfit, it checks the outfit / outfit health / bodytype each run and compares them to the previous run. If there's a change it casts an EffectSpell on the Actor wearing the outfit. SexoutSCRS6STokSwapVaultSuit is inside that EffectSpell so it then looks at the outfit currently worn then checks tokens etc to see what shape the Actors body should be or what the health of the outfit is, it records the current outfits current health, if that health is less then 75% or 50% or 25% of the 100% outfit it then decides to change outfit, removes the current outfit and adds the correct variation, so it equip's the new outfit on the first run, then it keeps checking in Swapstage 1 to see if the outfit is really equipped, because it may take a 2-3 runs of the script before it completes swapping, then it changes the worn outfits health to the health of the start outfit it recorded and removes its SpellEffect ending & removing itself. I have a big confusing bit in the middle there you won't need that works out which outfits are tight for a Pregnancy belly and which don't stretch or restrict the belly to a certain size and add penalty effects. You won't need that I suspect. The Script does all Vaultsuits based on the standard Vaultsuit mesh, every outfit covered by this is in the VaultsuitGroup, and all of these outfits have this Object script in them ; *** Start Outfit ***************************************************************************************************** if NX_IsInList SexoutSLOutfitVaultSuit101All rCurrOutfit > 0 Set iHealth100Perc to 100 ; **** Set this to the 100% health value of the undamaged base outfit Set iHealth75Perc to iHealth100Perc * .75 Set iHealth50Perc to iHealth100Perc * .5 Set iHealth25Perc to iHealth100Perc * .25 Set rNewOutfit to VaultSuit101 This then checks which Texture variation it is so all the Vaultsuit 3 or 101's swap to the same number, Vaultsuit101All contains all the variations of the Vaultsuit101, pregnant, damaged, big or small boobs, whatever, but they all have the 101 texture on the back. It could be done with a script for each outfit but that would be 2 scripts for every outfit eventually, there was some reason I didn't put the Armored Vaultsuits, Vault Security outfits and utility Vaultsuits into this, but I can't remember why. Because you just want the bodyswapping you could only need the following for each outfit: ; *** Start Outfit ****************************************************************** if NX_IsInList SexoutSLOutfitVaultSuit101All rCurrOutfit > 0 Set rNewOutfit to VaultSuit101 if rCurrBodyType == SexoutS9TokenBodyT3M Set rNewOutfit to SexoutSVaultSuit1013MP0B3 elseif rCurrBodyType == SexoutS9TokenBodyT6M Set rNewOutfit to SexoutSVaultSuit1016MP0B3 endif ; *** End body type
D1kaios Posted May 7, 2013 Author Posted May 7, 2013 Thanks a lot for all of the help! I think I have almost got it... One question though, how does the script find the item condition? I wasn't able to find a function that returned it... Thanks,
Halstrom Posted May 7, 2013 Posted May 7, 2013 Thanks a lot for all of the help! I think I have almost got it... One question though, how does the script find the item condition? I wasn't able to find a function that returned it... Thanks, This just gives you the health of the object worn in slot 2 (upperbody), there's no simple way to work out the maximum health of the object, but you probably don't need that in your application. WARNING if there is no object in slot 2 and you try to read it's health the script will crash so make sure you do a check first like below Set rCurrOutfit to rZActor.GetEquippedObject 2 if rCurrOutfit Set iCurrOutfitHealth to rZActor.GetEquippedCurrentHealth 2 else Set iCurrOutfitHealth to -1 endif
D1kaios Posted May 8, 2013 Author Posted May 8, 2013 I got it working for maybe 2 runs then all of a sudden it started to crash every time the Outfit I am testing is added to my inventory... I am assuming that this problem must be caused by the add token script which I shortened down to: scn SexoutSCRS6AddCasualWear ref rZActor ref rControlToken Begin GameMode Set rZActor to GetContainer Set rControlToken to SexoutS6TokenTornSwapCasualWear if rZActor.GetIsRace MyRace if rZActor.GetItemCount rControlToken < 1 rZActor.AddItem rControlToken 1 1 DebugPrint "SCRS6Add %n : %n added" rZActor rControlToken endif endif End Is there anything wrong with that script? Also, what is the purpose of this line? There is another one similar to it in the other script, the only things are really understand in it are the operators, but the functions of iCound, SexoutSQVAR.iSCRStartCounter, and SexoutSQVAR.iDamageSwapActivated remain a mistery to me... if rZActor && iCount > 49 && SexoutSQVAR.iSCRStartCounter > 11 && SexoutSQVAR.iDamageSwapActivated Again, thanks a lot for all of the help! EDIT: Is there anything wrong with what I have in the 3rd line of this script? if rTornUpperBody != 0 Set fCurrOutfitHealth to rZActor.GetEquippedCurrentHealth 2 rZActor.AddItemHealthPercent rTornUpperBody 1 fCurrOutfitHealth 1 rZActor.EquipItem rTornUpperBody 0 1 DebugPrint "SCRS9TornClothSwap %n : Equiping %n, Health %3.1f" rZActor rTornUpperBody fCurrOutfitHealth if rCurrOutfit ; *** avoid removing "no body" or causes ScriptCrash rZActor.RemoveItem rCurrOutfit 1 1 endif endif
Halstrom Posted May 8, 2013 Posted May 8, 2013 Set rZActor to GetContainer Set rControlToken to SexoutS6TokenTornSwapCasualWear Set iCurrRaceMyRace to 0 if rZActor Set iCurrRaceMyRace to rZActor.GetIsRace MyRace endif if iCurrRaceMyRace if rZActor.GetItemCount rControlToken < 1 rZActor.AddItem rControlToken 1 1 DebugPrint "SCRS6Add %n : %n added" rZActor rControlToken endif endif End I'd set iCurrRaceMyRace at the start of the script especially if it's used more than once, I've found sometimes the result doesn't update fast enough for the line below to get the right answer and also it does reduce lag a little I suspect if it doesn't keep asking the same question 4 or 5 times in the same script. But I don't see that as an issue what you've done looks fine. Also, what is the purpose of this line? There is another one similar to it in the other script, the only things are really understand in it are the operators, but the functions of iCound, SexoutSQVAR.iSCRStartCounter, and SexoutSQVAR.iDamageSwapActivated remain a mistery to me...if rZActor && iCount > 49 && SexoutSQVAR.iSCRStartCounter > 11 && SexoutSQVAR.iDamageSwapActivated iCount just reduces the lag by only running the check every 50th time the script runs, it also gives it time to settle between swaps. StartCounter just gives NewVegas time to start up before SCR scripts run as I've found a lot of stuff isn't finished loading till around 10 seconds. You don't need it or need to do your own timer for it, DamageSwapActivated is the way I turn the swapping on and off, you won't need that either. rZActor.AddItemHealthPercent rTornUpperBody 1 fCurrOutfitHealth 1 rZActor.EquipItem rTornUpperBody 0 1 Interesting, I never tried it that way, I suspect because what happens when you say EquipItem Vaultsuit21 and there are more than one Vaultsuit21 it usually equips the best condition one, which may not be the one you just added or correct as the original one it swapped may have been damaged.
D1kaios Posted May 9, 2013 Author Posted May 9, 2013 Thanks a bunch mate! I hate to say it, but something isn't working... As soon as the outfit is added to my inventory, my game crashes. I tried it with the second script disable and it seems to work, so the add Token script must be fine... Would you mind taking a look at the second part for me? scn SexoutSCRS6TornSwapCasualWear ref rZActor ref rCurrOutfit float fCurrOutfitHealth ref rTornUpperBody int iRemoving int iOkToRun ref rControlToken Begin GameMode Set rZActor to GetContainer Set rControlToken to SexoutS6TokenTornSwapCasualWear if rZActor && iRemoving < 1 Set iOkToRun to 0 if rZActor.GetIsRace MyRace Set iOkToRun to 1 endif if rZActor.GetItemCount rControlToken > 1 && GetRandomPercent > 90 Set iRemoving to 1 RemoveMe endif if iOKToRun DebugPrint "Checking to Swap" Set rCurrOutfit to rZActor.GetEquippedObject 2 Set rTornUpperBody to 0 if rCurrOutfit == OutfitPrewarSpring Set rTornUpperBody to FOutfitPrewarSpring else Set iRemoving to 1 RemoveMe endif if rTornUpperBody != 0 Set fCurrOutfitHealth to rZActor.GetEquippedCurrentHealth 2 rZActor.AddItemHealthPercent rTornUpperBody 1 fCurrOutfitHealth 1 rZActor.EquipItem rTornUpperBody 0 1 DebugPrint "SCRS9TornClothSwap %n : Equiping %n, Health %3.1f" rZActor rTornUpperBody fCurrOutfitHealth if rCurrOutfit ; *** avoid removing "no body" or causes ScriptCrash rZActor.RemoveItem rCurrOutfit 1 1 endif endif endif endif End Thanks again,
Halstrom Posted May 9, 2013 Posted May 9, 2013 I'd set rTornUpperBody to NVGolfBall or some other misc object then check it doesn't equal that setting it to 0, I don't think 0 worked for me at some point. Other than that the only difference I see is the AddHealthPercent method. Maybe it's removing stuff whilst checking health, try putting "&& 1=0" to the end of the if rTornUpperbody != NVGolfBall condition just to disable it to prove that's where the crash is. I just realised you must be doing this in a token instead of a spell effect, I found that if an object script on an NPC adds any object it will cause a crash, perhaps this happens on the player too, that is why I used SpellEffects instead. There's a good chance that's your problem. You might want to start changing the script & variable names too to more relevant to your mod.
D1kaios Posted May 9, 2013 Author Posted May 9, 2013 I'll give that a shot. I changed the references and whatnot in the script that I am using, I just set them back because I thought that it might help show what I am trying to do. The scripts are butchered from the SCR mod downloaded on this mod page. Is there an updated one that works differently? I am correct, the scripts you are referring to might be different than the ones that I am looking at. Anyways, I really can't thank you enough for all of the help. I hope Im not being too much of a pain... EDIT: Is there any documentation that might help me understand how to add a spell effect? The SCR scripts that I have been looking at appear to use tokens and object effects.
Halstrom Posted May 9, 2013 Posted May 9, 2013 I'll give that a shot. I changed the references and whatnot in the script that I am using, I just set them back because I thought that it might help show what I am trying to do. The scripts are butchered from the SCR mod downloaded on this mod page. Is there an updated one that works differently? I am correct, the scripts you are referring to might be different than the ones that I am looking at. Anyways, I really can't thank you enough for all of the help. I hope Im not being too much of a pain... Ah, I forgot they were even in the stable version, in the beta version you will find the latest scripts, very similar, just effects instead of objects. If you rename them well enough it should be obvious to others what the variables do
D1kaios Posted May 10, 2013 Author Posted May 10, 2013 -snip- Ah, I forgot they were even in the stable version, in the beta version you will find the latest scripts, very similar, just effects instead of objects. If you rename them well enough it should be obvious to others what the variables do Took me a while, but it appears to be working! Just one question: Now that I can have the item swap itself on equipping, is there a way to swap it back when I unequip it? Using an object script, I could just use "OnActorUnequipped". I don't think that would work in this case...
Halstrom Posted May 10, 2013 Posted May 10, 2013 -snip- Ah, I forgot they were even in the stable version, in the beta version you will find the latest scripts, very similar, just effects instead of objects. If you rename them well enough it should be obvious to others what the variables do Took me a while, but it appears to be working! Just one question: Now that I can have the item swap itself on equipping, is there a way to swap it back when I unequip it? Using an object script, I could just use "OnActorUnequipped". I don't think that would work in this case... `You could use OnActorUnEquipped to add a SpellEffect like I have done to swap it back, and because you know there should be only one version of your "MyRace" outfit in the inventory, you could just remove it and re-add the vanilla one, that gives me a damn good idea actually I could try the same expanding my scripts to turn my pregnant versions of outfits back to normal versions. Just be sure when you release this, you mention it will conflict with the SCR Outfit swapping system on any outfits covered by both systems, unfortunately I don't see a way to make them work as they will overwrite each other Object Effect scripts.
D1kaios Posted May 10, 2013 Author Posted May 10, 2013 Hmmm... I'll give that a shot. Will the script only work if it is on an individual outfit? I tried running 14 or so different outfits through it and the health preservation doesn't seem to be working. 2 of the outfits also just refuse to work...
D1kaios Posted May 11, 2013 Author Posted May 11, 2013 I fixed the health system. I'm not sure if those applies to New Vegas, but in Fallout 3 "setequippedcurrenthealth" has the "health" before the item slot.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.