Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Please Help Finish Mod...


StrikeForceX
 Share

Recommended Posts

Hey Guys

I am a noob when it comes to scripting i have read everything i can find about it and the only thing i have achieved is an headache. I have done a lot for a mod and the only thing left to do is to put a script on a sword that when the player equips gives him a set of armor and removes the armor when he unequips. I would be eternally grateful if someone could help

 

Thanks

Link to comment
Share on other sites

Check out the beginners scripting tutorial in this forum, or there will be no way to help you get the script into your game and working. It will explain that in easy to follow instructions.

 

You will need an event that captures when the armor is equipped and unequipped.

 

OnEquipped

OnUnequipped

 

You will need to add the adding and removing of the armor to the player, as well as the equipping of the newly added armor.

 

AddItem can be used to add your new armor.

RemoveItem can be used to remove it.

EquipItem can be used to force the armor to be worn.

Link to comment
Share on other sites

Thanks for the help, That is all i can seem to get out of it all. I understand doing the properties but would i do the Armor as ObjectRef or Armor ? 
 
Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
Game.GetPlayer().AddItem(DaedricHelmet, 1, true)
Game.GetPlayer().AddItem(DaedricArmor, 1, true)
Game.GetPlayer().AddItem(DaedricGauntlets, 1, true)
Game.GetPlayer().AddItem(DaedricShield, 1, true)
Game.GetPlayer().AddItem(DaedricBoots, 1, true)
      Game.GetPlayer().EquipItem(DaedricHelmet)
Game.GetPlayer().EquipItem(DaedricArmor)
Game.GetPlayer().EquipItem(DaedricGauntlets)
Game.GetPlayer().EquipItem(DaedricShield)
Game.GetPlayer().EquipItem(DaedricBoots)
       EndIf
EndEvent
 
Event OnUnequip(Actor akActor)
  if akActor == Game.GetPlayer()
Game.GetPlayer().UnequipItem(DaedricHelmet)
Game.GetPlayer().UnequipItem(DaedricArmor)
Game.GetPlayer().UnequipItem(DaedricGauntlets)
Game.GetPlayer().UnequipItem(DaedricShield)
Game.GetPlayer().UnequipItem(DaedricBoots)
Game.GetPlayer().RemoveItem(DaedricHelmet, 1)
Game.GetPlayer().RemoveItem(DaedricArmor, 1)
Game.GetPlayer().RemoveItem(DaedricGauntlets, 1)
Game.GetPlayer().RemoveItem(DaedricShield, 1)
Game.GetPlayer().RemoveItem(DaedricBoots, 1)
     EndIf
EndEvent
Link to comment
Share on other sites

If you have the armor laying in the world somewhere, you use its 'objectReference'. I would say your not doing that though.

 

So, you point to the 'Armor' property.

 

You also do not need to unequip the armor when you remove it, unless you plan on using vanilla armor.

 

Next, you might want to make the armor unique, so your not messing with vanilla armor objects.

And then also make the Equip so it cannot be removed manually.

Link to comment
Share on other sites

Look at the link for EquipItem above. There is an option to make it so it cannot be removed.

It should work, no way to know for sure until you test it.

 

Detecting 'equip' can sometimes be flunky or not work at all. So its a gamble it seems to me.

Link to comment
Share on other sites

Hey guys this is my working script i just need abSilent & abPreventRemoval to go in could someone help me please.

 

Event OnEquipped(Actor akActor)
   if akActor == Game.GetPlayer()
         Game.GetPlayer().AddItem(DaedricHelmet, 1)
         Game.GetPlayer().AddItem(DaedricCuirass, 1)
         Game.GetPlayer().AddItem(DaedricGauntlets, 1)
         Game.GetPlayer().AddItem(DaedricShield, 1)
         Game.GetPlayer().AddItem(DaedricBoots, 1)
         Game.GetPlayer().EquipItem(DaedricHelmet, true)
         Game.GetPlayer().EquipItem(DaedricCuirass, true)
         Game.GetPlayer().EquipItem(DaedricGauntlets, true)
         Game.GetPlayer().EquipItem(DaedricShield, true)
         Game.GetPlayer().EquipItem(DaedricBoots, true)
       EndIf
EndEvent
 
Event OnUnequipped(Actor akActor)
  if akActor == Game.GetPlayer()
        Game.GetPlayer().UnequipItem(DaedricHelmet)
        Game.GetPlayer().UnequipItem(DaedricCuirass)
        Game.GetPlayer().UnequipItem(DaedricGauntlets)
        Game.GetPlayer().UnequipItem(DaedricShield)
        Game.GetPlayer().UnequipItem(DaedricBoots)
        Game.GetPlayer().RemoveItem(DaedricHelmet, 1)
        Game.GetPlayer().RemoveItem(DaedricCuirass, 1)
        Game.GetPlayer().RemoveItem(DaedricGauntlets, 1)
        Game.GetPlayer().RemoveItem(DaedricShield, 1)
        Game.GetPlayer().RemoveItem(DaedricBoots, 1)
     EndIf
EndEvent
Edited by StrikeForceX
Link to comment
Share on other sites

Hi i have the abSilent working now but still no luck with abPreventRemoval i have tried (true, true) and get this error " too many arguments passed to function"

Here is my script all together now, I might have gone wrong somewhere, not to sure. Thanks

 

 

Scriptname SOTDGTest extends ObjectReference  
 
Armor Property DaedricHelmet  Auto  
Armor Property DaedricGauntlets  Auto  
Armor Property DaedricBoots  Auto  
Armor Property DaedricCuirass  Auto  
Armor Property DaedricShield  Auto  
Bool Property abPreventRemoval  Auto  
Bool Property abSilent  Auto  
Bool abPreventRemoval = false
Bool abSilent = false
 
 
Event OnEquipped(Actor akActor)
  if akActor == Game.GetPlayer()
Game.GetPlayer().AddItem(DaedricHelmet, 1, true)
Game.GetPlayer().AddItem(DaedricCuirass, 1, true)
Game.GetPlayer().AddItem(DaedricGauntlets, 1, true)
Game.GetPlayer().AddItem(DaedricShield, 1, true)
Game.GetPlayer().AddItem(DaedricBoots, 1, true)
      Game.GetPlayer().EquipItem(DaedricHelmet, 1, true, true)
Game.GetPlayer().EquipItem(DaedricCuirass, 1, true, true)
Game.GetPlayer().EquipItem(DaedricGauntlets, 1, true, true)
Game.GetPlayer().EquipItem(DaedricShield, 1, true, true)
Game.GetPlayer().EquipItem(DaedricBoots, 1, true, true)
       EndIf
EndEvent
 
Event OnUnequipped(Actor akActor)
  if akActor == Game.GetPlayer()
Game.GetPlayer().UnequipItem(DaedricHelmet, 1, true)
Game.GetPlayer().UnequipItem(DaedricCuirass, 1, true)
Game.GetPlayer().UnequipItem(DaedricGauntlets, 1, true)
Game.GetPlayer().UnequipItem(DaedricShield, 1, true)
Game.GetPlayer().UnequipItem(DaedricBoots, 1, true)
Game.GetPlayer().RemoveItem(DaedricHelmet, 1, true)
Game.GetPlayer().RemoveItem(DaedricCuirass, 1, true)
Game.GetPlayer().RemoveItem(DaedricGauntlets, 1, true)
Game.GetPlayer().RemoveItem(DaedricShield, 1, true)
Game.GetPlayer().RemoveItem(DaedricBoots, 1, true)
     EndIf
EndEvent
 
 
 
 
 

 

 

Link to comment
Share on other sites

Hi i did eventually realise that OnEquip did not need a numeric parameter so removed it and abSilent worked, however i have removed the numeric parameter on UnequippedItem but still has not helped towards getting abPreventRemoval from working. The script is compiling with no errors but abPreventRemoval just will not work. Is there anything else i could try ? Thanks

Edited by StrikeForceX
Link to comment
Share on other sites

Yes i have the script on a sword. I have all the script working apart from i can still remove the armor i just don't know how to turn the armor into quest items so they can't be removed, it's really confusing me, Lol. It's the only thing left to do on my mod.

Edited by StrikeForceX
Link to comment
Share on other sites

In the object window, double click on your armor to open its properties. There should be a check box to make it a quest item.

 

Another reason why you need to make unique armor since you don't want all your vanilla armor to be 'quest' items.

Edited by WillieSea
Link to comment
Share on other sites

In the item's alias screen there should be about 14 check boxes at the top right, above the scripts section there should be an option to select "Quest Object" you want to select that one. 

To be honest I have no idea how I got to that screen so.... I believe though that the object had to be already tied to a quest.

 

Also Williesea, your also kinda right. On the majority of other Beth games it's on the object window from what I've been told.

Hope this helps you out StrikeForceX

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...