Jump to content

Scripting Help


Recommended Posts

I'm not really good with scripts too, but i do really want to learn it and since i also wondering the same thing a few months back. My first option is to find similar mod or close to it. Perhaps auto equip ammo/auto equip helmet from mitchalek.

 

Might be difficult because script need to detect for specific slot(s)/ first (the one that troubles me) to trigger an item to be equip/not. Maybe this discussion might help you.  

Link to comment

Haven't test it yet. Sure look so simple but still i dont really understand how it works.

 

Thought SlotMask was only refering for headgear, fool me, turn out in can go from slot30-61, thanks to SKSE. And thank you for the example b3lisario, one more thing may i request small description for the important line in the script (;) because i kind of twerp in scripting.

Link to comment

This stuff is goes so far over my head. I spent a lot of time just trying different things with the example above and ended up with a enchantment that uses the change armors function but my question what do I need to change so it works for any npc wearing the piece of gear with the enchantment. Here is the current script.

 

 

Scriptname CB01Equip  extends activemagiceffect

   Event OnObjectUnEquippd(Form akBaseObject, ObjectReference akObjectReference)
       if akBaseObject as Armor
           CheckArmors() 
           Debug.Notification("Checking Armor.")
      endif
   EndEvent

  

   Event OnObjectEquipped(Form akBaseObject, ObjectReference akObjectReference)
      if akBaseObject as Armor
           CheckArmors()
           Debug.Notification("Checking Armor.")
     endif
   EndEvent

 

Function CheckArmors()
    Actor player = Game.GetPlayer()
    int i = armorToEquip.length
    While (i > 0)
        i -= 1
        int slotMask = armorToEquip.GetSlotMask()
        Armor current = player.GetWornForm(slotMask) as Armor
        if current == None
            player.equipitem(armorToEquip, False, True)
        endif
    EndWhile
EndFunction

 

Armor[] Property ArmorToEquip  Auto

 

 

Thanks for any help you can give.

Link to comment

So I take it its not an easy fix. That's the only scripting I added and its just a magic effect used by as an enchant on a piece of armor. I can share an esp later if needed. I will have to set one up. The one I was testing it with isn't really fit for uploading. I would have fixed one up before asking but I just assumed the actor player = Game.Getplayer() was all that would need to be changed.

Link to comment
Scriptname EquipDaedricScript extends activemagiceffect  

Armor[] Property ArmorToEquip Auto

Actor Property ActorRef Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)
ActorRef = akTarget
CheckArmors()
EndEvent

Event OnObjectUnEquipped(Form akBaseObject, ObjectReference akObjectReference)
if akBaseObject as Armor
CheckArmors()
endif
EndEvent

Event OnObjectEquipped(Form akBaseObject, ObjectReference akObjectReference)
if akBaseObject as Armor
CheckArmors()
endif
EndEvent

Function CheckArmors()
int i = armorToEquip.length
While (i > 0)
i -= 1
int slotMask = armorToEquip[i].GetSlotMask()
Armor current = ActorRef.GetWornForm(slotMask) as Armor
if current == None
ActorRef.equipitem(armorToEquip[i], False, True)
endif
EndWhile
EndFunction

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use