Jump to content

Simple Scripting problem. actor.getlevel()


Lyrahel

Recommended Posts

Hey guys, I got a little problem with me scripting.

 

I got the following script and I want to get the level of my actor before a fight starts so he will summon a bound weapon, but it should depend on the level he is currently on.

Scriptname ToniBoundSPellscast extends Actor  

spell property boundSwordRightweapon auto
spell property boundSwordweapon auto
spell property boundBowweapon auto

int i = self.getlevel()

event OnCombatStateChanged(Actor akTarget, int aeCombatState)
if(aeCombatState==1)
if (i <=10)
    boundSwordRightweapon.Cast(self, self)
elseif (i>=11 && i<=20)
    boundSwordweapon.Cast(self, self)
elseif (i >=21 )
    boundBowweapon.Cast(self, self)
endif
endif
endevent


I think the problem is the underlined line. I don't know how to get the current level of my actor and store it in an int or float so I can make the comparison down below. :(

 

Anyone got a simple solution?

 

I have been trying to find something on the creation kit papyrus page and searched for other people with a similiar problem, buuuut it seems I am very bad at searching.

 

 

Link to comment
Share on other sites

Below should work. Since the actor's level can change, you need to get the current value before using the value. Defining the value outside of the event without making any changes to it inside the event means that the value will always be the same. You want it to change as the level changes, so define the variable inside the event that it is called every time it is needed.

 

 

 

Scriptname ToniBoundSPellscast extends Actor  

spell property boundSwordRightweapon auto
spell property boundSwordweapon auto
spell property boundBowweapon auto

int i 

event OnCombatStateChanged(Actor akTarget, int aeCombatState)
i = self.getlevel()
if(aeCombatState==1)
if (i <=10)
    boundSwordRightweapon.Cast(self, self)
elseif (i>=11 && i<=20)
    boundSwordweapon.Cast(self, self)
elseif (i >=21 )
    boundBowweapon.Cast(self, self)
endif
endif
endevent

 

 

Link to comment
Share on other sites

Hey guys, I got a little problem with me scripting.

 

I got the following script and I want to get the level of my actor before a fight starts so he will summon a bound weapon, but it should depend on the level he is currently on.

Scriptname ToniBoundSPellscast extends Actor

 

spell property boundSwordRightweapon auto

spell property boundSwordweapon auto

spell property boundBowweapon auto

 

int i = self.getlevel()

 

event OnCombatStateChanged(Actor akTarget, int aeCombatState)

if(aeCombatState==1)

if (i <=10)

boundSwordRightweapon.Cast(self, self)

elseif (i>=11 && i<=20)

boundSwordweapon.Cast(self, self)

elseif (i >=21 )

boundBowweapon.Cast(self, self)

endif

endif

endevent

 

 

I think the problem is the underlined line. I don't know how to get the current level of my actor and store it in an int or float so I can make the comparison down below. :sad:

 

Anyone got a simple solution?

 

I have been trying to find something on the creation kit papyrus page and searched for other people with a similiar problem, buuuut it seems I am very bad at searching.

 

 

 

 

I am currently trying to have my Actor summon a bound weapon as soon as combat starts, but I want first to look at his level. If he is below level 10 he will summon a small onehanded sword. If he is over level 11 and below level 20 he will summon a two-handed sword and if he is above lvl 21 he will summon a bow.

 

So this script just checks what level my actor is and swhat weapon he will summon. That is basically it.

 

 

Below should work. Since the actor's level can change, you need to get the current value before using the value. Defining the value outside of the event without making any changes to it inside the event means that the value will always be the same. You want it to change as the level changes, so define the variable inside the event that it is called every time it is needed.

 

 

 

Scriptname ToniBoundSPellscast extends Actor

 

spell property boundSwordRightweapon auto

spell property boundSwordweapon auto

spell property boundBowweapon auto

 

int i

 

event OnCombatStateChanged(Actor akTarget, int aeCombatState)

i = self.getlevel()

if(aeCombatState==1)

if (i <=10)

boundSwordRightweapon.Cast(self, self)

elseif (i>=11 && i<=20)

boundSwordweapon.Cast(self, self)

elseif (i >=21 )

boundBowweapon.Cast(self, self)

endif

endif

endevent

 

 

 

Thank you so much. Compilation successful and I learned something today. :D

Edited by Lyrahel
Link to comment
Share on other sites

  • Recently Browsing   0 members

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