Jump to content

Scripting Help


VincentIcarus

Recommended Posts

Alright, I have a unique set of armor that I've created for myself and there is a Machete strapped on the back and a pistol in a thigh holster as a part of the armor. Well, obviously, whenever I enter a casino and they take my weapons, the machete and pistol are still there because they are a part of the armor. How would I make a mod so that when I enter a casino and they take my weapons, they take the machete and pistol off of the armor? I know I would probably have to make a separate .nif file for the "casino friendly" armor and probably have to make a script for the armors to be switched out when they take my weapons but I have absolutely no idea how to make a script like that. Is there any advice/help you can offer me?

 

Here's a halfway decent picture of my armor where you can see the machete and the pistol:

http://newvegasnexus.com/imageshare/images/2253779-1298703833.jpg

Link to comment
Share on other sites

Okay, well assuming you have two sets of armour, one with the strapped weapons and one without.

 

Find the script that takes all but your holdout weapons,

and just add this code in the place where all weapons are removed:

 

If Player.GetItemCount ArmourRefWithWeapons == 1
  Player.RemoveItem ArmourRefWithWeapons 1
  Player.AddItem ArmourRefWithoutWeapons 1
  Player.ForceEquip ArmourRefWithoutWeapons 1   ; note this will equip the armour even if you had the armour in your inventory but not equipped
endif 

 

Then when the weapons are given back, run the same script but with the references switched.

 

EDIT: It's actually a bit more complicated with that, I forgot to preserve the armour's damage

Edited by PaladinRider
Link to comment
Share on other sites

Okay, so adding a script to the armor sounds like the most stable way to do it. So I would add this script:

 

If Player.GetInCell TOPSCasino || Player.GetInCell TOPSrestaurant || Player.GetInCell ULCasino ; (and so on until you got ALL casino interiors in the IF condition)

set inCasino to 1

else

set inCasino to 0

 

 

if InCasino = 1

player.UnequipItem (ArmorWithPistol)

player.RemoveItem (ArmorWithPistol) [TempContainer - if it works in NV]

player.AddItem (ArmorWithOutPistol)

player.EquipItem (ArmorWithOutPistol)

elseif InCasino == 0

player.UnequipItem (ArmorWithOutPistol)

player.RemoveItem (ArmorWithOutPistol) [TempContainer - if it works in NV]

player.AddItem (ArmorWithPistol)

player.EquipItem (ArmorWithPistol)

endif

 

Is that what it would look like? Or am I completely off? (This is my very first attempt at trying to do any type of scripting)

Link to comment
Share on other sites

You will want to change this section, otherwise it will add the armor every frame and CTD.

The Player.GetItemCount part is redundant if the item is unique.

You won't be able to preserve the health of the armor unless you use NVSE, or unless you set up two remote containers - each with one version of the armor, and use RemoveAllTypedItems to swap them out. But thier health will not be in sync with each other.

 

 

if InCasino = 1
if (player.GetEquipped ArmorWithPistol)
 player.UnequipItem ArmorWithPistol
 if (Player.GetItemCount ArmorWithOutPistol == 0)
  player.AddItem ArmorWithOutPistol 1
 endif
 player.EquipItem ArmorWithOutPistol
 player.RemoveItem ArmorWithPistol 1
endif
else
if (player.GetEquipped ArmorWithOutPistol)
 player.UnequipItem ArmorWithOutPistol
 if (Player.GetItemCount ArmorWithPistol == 0)
  player.AddItem ArmorWithPistol 1
 endif
 player.EquipItem ArmorWithPistol
 player.RemoveItem ArmorWithOutPistol 1
endif
endif

 

 

Link to comment
Share on other sites

Okay and the script that defines whether or not I am in a casino is part of a separate script or is it also a part of that script?

 

The same script, like you had it.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...