Jump to content

A supposedly simple (only a few lines) script isn't working.


Prismuth

Recommended Posts

All the script is doing is adding a perk to the player. The effects of the perk are determined by the perk entries. So if you have a perk entry that says give all armor pieces +1000, then of course all armor pieces are going to have +1000 from that point on.

 

You COULD add another block to the script that would remove the perk if the item is unequipped. I don't recommend doing that for the same reason that the USKP team removed that block from the silver weapon script and the Dawnguard team never added the block to the Dawnguard item script. It can lead to oddities based on when the script fires, which can be unpredictable. None of these conditions are resource intensive so your best bet is to just add the perk to the player and then leave it alone.

Link to comment
Share on other sites

Perk is still crashing the inventory.

 

I removed the script from both my files and from the armor pieces, made a perk for each piece, and put them where they belong. Then I assigned the perk entries to the keywords using WornHasKeyword. Loaded up a save before the script was working and opened my inventory. No issues. Activated the perk via console, opened the inventory, and CTD'd. u.u I'm really not sure what's going wrong here. >_>

 

EDIT: I FOUND THE PROBLEM. The spell condition somehow ended up in the wrong place. *facepalm* I think things should still work better than prior though. I'll want to do some tests to ensure things aren't stacking. The effects I actually want are so minor, I can't really test just them. I'm surprised I don't seem to need any spells and magic effects. Happily surprised though. Thank you very much for all your patience with this.

 

Now, since apparently scripts behave difficultly, what method would you recommend for getting the perk placed properly?

Edited by Prismuth
Link to comment
Share on other sites

This script should do you.

 

 

 

scriptname ArmorEquipTest extends ObjectReference

perk property PerkToAdd auto

event OnEquipped(actor akActor)

	if(akActor == game.GetPlayer())
		if(akActor.HasPerk(PerkToAdd) == false)
			akActor.AddPerk(PerkToAdd)
		endif
	endif
endEvent
 

 

 

 

Another alternative would be to remove the script from the armor and just use a quest to give it to the player. Create a new quest, set it to start game enabled. Create a new stage and a new log entry. Check "start up stage." In the Papyrus fragment box, type a semicolon ( ; ). Click OK.

 

Reopen the quest. Delete the semicolon.

 

Then add this for the Papyrus fragment:

Game.GetPlayer().AddPerk(PerkToAdd)
stop()

Of course you will also have to create a property on this script called PerkToAdd and point it to your perk.

Edited by lofgren
Link to comment
Share on other sites

  • Recently Browsing   0 members

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