Jump to content

script help please


GrimGus

Recommended Posts

ok basically the plan is once the player takes the base perk, say stealth, as he/she gets skill to 20 the script gives 2nd perk free. later at 40 it give 3rd ect.

 

so i'm thinking the script should be attached to the perk itself. and this is what i have but it's not right.

 

Scriptname aaPerkAgileScr extends Perk

 

event OnStoryIncreaseSkill(lightarmor)

 

if player.hasperk((AgileDefender00) == true) ++ player.hasperk((AgileDefender20) == false)

if (player.GetBaseActorValue(lightArmor >= 20)

player.addperk(agileDefender20)

endif

endif

 

endevent

 

 

basically: if player has base perk but not second, and player is eligible for second, then give player second perk.

 

 

i think i can elseif the rest or just do them as second scripts if need be.

 

thanks in advance,

grim

Link to comment
Share on other sites

I don't know whether it will work while attached to the perk, but I do see a number of errors with your script. First, rather than simply typing "player.function()" you have to use "Game.GetPlayer().function()". Also, Papyrus uses the syntax "&&" rather than "++" for the logical AND operator.

 

Also, you need to declare the perks as Properties. Here is what the script would look like cleaned up:

 

Scriptname aaPerkAgileScr extends Perk 

Perk Property AgileDefender00 auto
Perk Property AgileDefender20 auto

Event OnStoryIncreaseSkill(Lightarmor)
if 	Game.GetPlayer().HasPerk((AgileDefender00) == true) && Game.GetPlayer().HasPerk((AgileDefender20) == false)
	if 	(Game.GetPlayer().GetBaseActorValue("LightArmor" >= 20) 
		Game.GetPlayer().AddPerk(AgileDefender20)
	endif
endif
EndEvent

Link to comment
Share on other sites

That simply won't work. The event "OnStoryIncreaseSkill" is part of the Quest script, so any script that uses that event must extend Quest, and it would have to be attached to a quest that is started by the Story Manager.

 

"OnStoryIncreaseSkill: Event called when this quest is started via an increase level story manager event."

 

The script should be something like this:

 

Scriptname aaPerkAgileScr extends Quest

Perk Property AgileDefender00 auto 
Perk Property AgileDefender20 auto 

Event OnStoryIncreaseSkill(string asSkill)
Actor player = Game.GetPlayer()
if asSkill == "LightArmor" && player.HasPerk(AgileDefender00) && !player.HasPerk(AgileDefender20) && player.GetBaseAV("LightArmor") >= 20
	player.AddPerk(AgileDefender20) 
endif 
EndEvent

 

Here is the link to the Creation Kit Wiki on how to set up the Story Manager to monitor for specific events. I have never used the SM myself, so I can't help you with that.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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