nerdcav Posted August 6, 2014 Share Posted August 6, 2014 (edited) I'm trying to create a visor that adds the Living Anatomy perk on equip, and removes it on unequip. I want to check for the existence of the perk first, so I don't accidentally remove a permanent instance with my temporary effect. This is what I have so far. scn ShootingGlassesScript Begin OnAdd IF Player.HasPerk LivingAnatomy != 1 OnEquip Player.addperk, 00146099 OnUnequip Player.removeperk, 00146099 EndIf EndSo, hopefully, on adding the item, a check for LivingAnatomy is made. If the perk doesn't exist, the temp effect applies on equip, and removes on unequip. If the player has LivingAnatomy, the script ends. This script has errors, since I can't save it, but I'm not familiar with the syntax and can't see them right off the bat. I assume the problem lies in the OnEquip/OnUnequip section, but I'm guessing. I could set a boolean variable for HasPerk and toggle it - referencing the variable for further actions - but that would make the script more complex and create additional opportunities for errors I don't recognize. I could also create a unique copy of the perk, to remove collisions with the vanilla perk, but I'd like to figure out the script first. Can I get someone to look at this and point me in the right direction? Thank you! Edited August 6, 2014 by nerdcav Link to comment Share on other sites More sharing options...
TrueSaiko Posted August 6, 2014 Share Posted August 6, 2014 (edited) i am no scripter.... by far... all i can successfully do is edit what other people provide.... but from what i have learned by fiddling around, i think you should add another block in the middle so it would be something like: if playerhasperk livinganatomy == 1returnelseonequip addperk blahblah poor formating, i know.... see if this works? edit: "Edit what other people provide.... and even then only successful about half the time" ** Edited August 6, 2014 by TrueSaiko Link to comment Share on other sites More sharing options...
nerdcav Posted August 6, 2014 Author Share Posted August 6, 2014 I think I can use this: scn ShootingGlassesScript short alreadyHad Begin ScriptEffectStart set alreadyHad to player.HasPerk LivingAnatomy if alreadyHad == 0 player.addperk LivingAnatomy endif End Begin ScriptEffectFinish if alreadyHad == 0 player.removeperk LivingAnatomy endif EndI can apply that as a scripted Object Effect and apply it to the visor. Link to comment Share on other sites More sharing options...
AxlDave Posted August 8, 2014 Share Posted August 8, 2014 (edited) If it's an Object Script, you can use the BEGIN OnEquip / OnUnEquip blocks. That would be better, because then the script would just run the once on each instance. Also, you would need to set AlreadyHad in both the equip and unequip blocks: scn ShootingGlassesScript short AlreadyHad BEGIN OnEquip set AlreadyHad to Player.HasPerk LivingAnatomy if AlreadyHad == 0 Player.AddPerk LivingAnatomy endif END BEGIN OnUnEquip set AlreadyHad to Player.HasPerk LivingAnatomy if AlreadyHad == 0 Player.RemovePerk LivingAnatomy endif END I think that should do the trick, provided you have the correct EditorID for Living Anatomy. --EDIT-- Alternatively, you could just create a copy of the Living Anatomy perk with a different EditorID - like ShootingGlassesPerk - and then you could just have the add and remove commands in your script, referencing your perk instead of Living Anatomy. Edited August 8, 2014 by AxlDave Link to comment Share on other sites More sharing options...
Recommended Posts