Jump to content

Scripting Help, things not behaving as I'd expect.


Nephenee13

Recommended Posts

 

Ok, I'll give it a shot after work.

its working in my game (your script),i guess hickory's too but i didnt test it.perhaps you should look at your leveled lists

 

I thought the same, actually. The script's totally fine, and there is no way for the "AddItem" call 'not' to be executed as soon as the player's level reaches "5" (and the script next executes, of course).

You could also check what's happening when you proceed to level "6" 'without' wearing the item. Then you'd know for sure it's the lists to blame here. Or even better yet, add some debug output to the "AddItem" lines.

 

On the other hand though... if it reacts to the proceeding to level "6", the proceed to level "5" can impossibly have entered the "getlevel > 4" condition before, or the "DoOnce" condition would've prevented the re-enter now!

I'm beginning to wonder what exactly "getlevel" returns anyways... is it '0 to N-1' or '1 to N'? Because the former would lead to level "6" being returned as "5" and enter the condition, whereas level "5", i.e. return value "4" now, simply wouldn't for that reason.

 

...I feel like something crucial is going on, outside of our view here.

Edited by DrakeTheDragon
Link to comment
Share on other sites

Ok, I almost have it working right, just one issue left.

I've introduced a new variable "InInvent" which tracks whether or not the armor is in inventory, preventing the adding of a new copy if it isn't. Works perfectly.

 

However I still have the issue where if the armor is removed from inventory, then returned, it won't update until the next time it crosses an update threshold.

 

 

 

Scriptname NephRoseKvatchControlScript

 

Short DoOnce
Short Equipped
Short InInvent

 
Begin Gamemode




If ( DoOnce == 5 )
    StopQuest NephRoseKvatchControlQuest
    Return
EndIf
 
If ( Player.getlevel > 24 ) && ( DoOnce < 5 )

        Set Equipped to 0
        If ( player.GetItemCount NephRoseKvatchHeavy20 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy20 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy20 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight20 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight20 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight20 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy15 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy15 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy15 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight15 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight15 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight15 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy10 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight10 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy05 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight05 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy01 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight01 1
    EndIf


     If ( ( player.GetItemCount NephRoseKvatchHeavy25 < 1 || player.GetItemCount NephRoseKvatchLight25 < 1 ) && InInvent == 1 )
        If player.GetAV LightArmor > player.GetAV HeavyArmor
            player.AddItem NephRoseofKvatchLightList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchLight25
            EndIf
        Else
            player.AddItem NephRoseofKvatchHeavyList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchHeavy25
            EndIf
        Endif
        Set InInvent to 0
    Endif
    Set DoOnce to 5
    

 
ElseIf ( Player.getlevel < 25 ) && ( Player.getlevel > 19 ) && ( DoOnce < 4 )
        
        Set Equipped to 0
      If ( player.GetItemCount NephRoseKvatchHeavy15 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy15 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy15 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight15 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight15 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight15 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy10 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight10 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy05 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight05 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy01 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight01 1
    EndIf


     If ( ( player.GetItemCount NephRoseKvatchHeavy20 < 1 || player.GetItemCount NephRoseKvatchLight20 < 1 ) && InInvent == 1 )
        If player.GetAV LightArmor > player.GetAV HeavyArmor
            player.AddItem NephRoseofKvatchLightList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchLight20
            EndIf
        Else
            player.AddItem NephRoseofKvatchHeavyList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchHeavy20
            EndIf
        Endif
        Set InInvent to 0
    Endif
    Set DoOnce to 4


ElseIf ( Player.getlevel < 20 ) && ( Player.getlevel > 14 ) && ( DoOnce < 3 )
         
        Set Equipped to 0
    If ( player.GetItemCount NephRoseKvatchHeavy10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy10 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight10 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight10 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight10 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy05 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight05 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy01 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight01 1
    EndIf


     If ( ( player.GetItemCount NephRoseKvatchHeavy15 < 1 || player.GetItemCount NephRoseKvatchLight15 < 1 ) && InInvent == 1 )
        If player.GetAV LightArmor > player.GetAV HeavyArmor
            player.AddItem NephRoseofKvatchLightList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchLight15
            EndIf
        Else
            player.AddItem NephRoseofKvatchHeavyList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchHeavy15
            EndIf
        Endif
        Set InInvent to 0    
    Endif
    Set DoOnce to 3

ElseIf ( Player.getlevel < 15 ) && ( Player.getlevel > 9 ) && ( DoOnce < 2 )
        
        Set Equipped to 0
    If ( player.GetItemCount NephRoseKvatchHeavy05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy05 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight05 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight05 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight05 1
        ElseIf ( player.GetItemCount NephRoseKvatchHeavy01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy01 1
        ElseIf ( player.GetItemCount NephRoseKvatchLight01 > 0 )
            Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchLight01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight01 1
    EndIf


     If ( ( player.GetItemCount NephRoseKvatchHeavy10 < 1 || player.GetItemCount NephRoseKvatchLight10 < 1 ) && InInvent == 1 )
        If player.GetAV LightArmor > player.GetAV HeavyArmor
            player.AddItem NephRoseofKvatchLightList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchLight10
            EndIf
        Else
            player.AddItem NephRoseofKvatchHeavyList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchHeavy10
            EndIf
        Endif
        Set InInvent to 0    
    Endif
    Set DoOnce to 2


ElseIf ( Player.getlevel < 10 ) && ( Player.getlevel > 4 ) && ( DoOnce < 1 )
        
        Set Equipped to 0
    If ( player.GetItemCount NephRoseKvatchHeavy01 > 0 )
        Set InInvent to 1
        If ( player.GetEquipped NephRoseKvatchHeavy01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchHeavy01 1
    ElseIf ( player.GetItemCount NephRoseKvatchLight01 > 0 )
        Set InInvent to 1    
        If ( player.GetEquipped NephRoseKvatchLight01 == 1 )
            Set Equipped to 1
        EndIf
        player.RemoveItem NephRoseKvatchLight01 1
    EndIf


     If ( InInvent == 1 )
        If player.GetAV LightArmor > player.GetAV HeavyArmor
            player.AddItem NephRoseofKvatchLightList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchLight05
            EndIf
        Else
            player.AddItem NephRoseofKvatchHeavyList 1
            If ( Equipped == 1 )
                player.EquipItem NephRoseKvatchHeavy05
            EndIf
        Endif
        Set InInvent to 0
    Endif
    Set DoOnce to 1

    endif
    
 

End

 

 

 

Edit: AAAAAHHHHH I figured it out! The DoOnce were in the wrong place! Moving them inside the If statement makes it work properly!

 

Ok. I've got it working now. Finally.

 

Anyone know anything about what that Wiki article says about this sort of script causing problems if run while on horseback?

Edited by Nephenee13
Link to comment
Share on other sites

 

Anyone know anything about what that Wiki article says about this sort of script causing problems if run while on horseback?

i think scripts run( variables change)when you are on a horse but functions dont execute - probably :unsure: not

- but when i took the armor from a container while on horse it didnt upgrade

Edited by kastano
Link to comment
Share on other sites

  • Recently Browsing   0 members

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