Jump to content

Script Help


Recommended Posts

I have this script that I'm using from another mod (with permission):

 

ScriptName CorpseEquipGameModeQuestScript

 

ref rTarget

 

Begin GameMode

 

if rTarget

if rTarget.IsActor

if rTarget.GetIsCreature

elseif rTarget.GetDead

rTarget.AddItem CorpseEquipToken 1 1

rTarget.EquipItem CorpseEquipToken 0 1

rTarget.RemoveItem CorpseEquipToken 1 1

endif

endif

set rTarget to 0

endif

 

StartQuest CorpseEquipMenuModeQuest

StopQuest CorpseEquipGameModeQuest

 

End

 

 

 

This scripts works great for what I want it to do, but I'd also like to add items based on the npc's sex, but nothing I add seems to work. Is anyone good with scripts that could give me some guidance?

Link to comment
Share on other sites

I am having a little trouble understanding the goal of this script. How does rTarget ever get set to any value? Without this it seems it will run every frame, taking up time, but never do anything.

 

If the goal is to add an item to a particular NPC after it is dead, have you considered using a DeathItem? This is how most items in the base game are handled. You can see this in the traits tab of the NPC dialog box.

Link to comment
Share on other sites

The script above causes the npc to auto equip whatever is the strongest armor in their inventory. So you can re-equip a body after it's dead so it's not naked. In my mod's case it causes them to auto-equip underwear in their inventory so they're not naked when you remove their armor. I just wanted to add a bit in so that it would also add the underwear to their inventory based on sex, that way I don't have to manually add it to each npc.

 

Does the GetIsSex need a 0 or 1 after it to determine if it's male or female? Also, should I add it to this script or would it be wise to create a whole new script since rTarget doesn't have any value?

 

Scripting is completely foreign to me :confused: I've tried writing many different scripts using various guides, but they never work. :wallbash:

Link to comment
Share on other sites

Here is the script I came up with using samples and directions I found on that site:

 

-------------------------------------

 

SCN MaleUndiesScript

 

Begin GameMode

if GetIsSex Male == 1

 

addItem MaleUndies 1

 

endif

End

 

-------------------------------------

 

 

It saves fine in GECK so I don't think there are any errors in the script. Still, in game it doesn't add underwear to the male's inventory. Seems like a really simple script and it makes sense in my head, but I'm sure I'm not doing something correctly. Is it because what I'm trying to add is a leveled item?

 

 

I also tried this with no luck:

 

-------------------------------------

 

SCN MaleUndiesScript

 

short doOnceGetClothes

 

Begin GameMode

if doOnceGetClothes == 0

if GetIsSex Male == 1

 

addItem MaleUndies 1

 

set doOnceGetClothes to 1

endif

endif

 

End

 

-------------------------------------

 

Which is almost directly copied off of the GECK website, but it still doesn't add anything to male npc inventories.

Edited by kellogsfrostedflakes
Link to comment
Share on other sites

  • Recently Browsing   0 members

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