Jump to content

[LE] Make script return to top?


Recommended Posts

You would need to add the reference up top also to make PayerRef actually be the player reference.

With: Actor Property PlayerREF Auto <- then to fill the reference press auto fill when you're in the kit on that entree.

I did that. I actually know the properties tab and auto-fill functions, believe it or not :D

Still, I can't get it to compile in this form.

I'll work in the arrays now, it's usually 5 potions except for one, and why they left that one out of the game, who knows...

 

 

 

Scriptname ApplyPoisonOnHitScript extends ActiveMagicEffect

Actor Property PlayerRef Auto
Potion Property DamageHealth01 Auto
Potion Property DamageHealth02 Auto
Potion Property DamageHealth03 Auto
Potion Property DamageHealth04 Auto
Potion Property DamageHealth05 Auto
Potion Property DamageHealthLinger01 Auto
Potion Property DamageHealthLinger02 Auto
Potion Property DamageHealthLinger03 Auto
Potion Property DamageHealthLinger04 Auto
Potion Property DamageHealthLinger05 Auto
Potion Property DamageMagicka01 Auto
Potion Property DamageMagicka02 Auto
Potion Property DamageMagicka03 Auto
Potion Property DamageMagicka04 Auto
Potion Property DamageMagicka05 Auto
Potion Property DamageMagickaLinger01 Auto
Potion Property DamageMagickaLinger02 Auto
Potion Property DamageMagickaLinger03 Auto
Potion Property DamageMagickaLinger04 Auto
Potion Property DamageMagickaLinger05 Auto
Potion Property DamageMagickaRecovery01 Auto
Potion Property DamageMagickaRecovery02 Auto
Potion Property DamageMagickaRecovery03 Auto
Potion Property DamageMagickaRecovery04 Auto
Potion Property DamageMagickaRecovery05 Auto
Potion Property DamageStamina01 Auto
Potion Property DamageStamina02 Auto
Potion Property DamageStamina03 Auto
Potion Property DamageStamina04 Auto
Potion Property DamageStamina05 Auto
Potion Property DamageStaminaLinger01 Auto
Potion Property DamageStaminaLinger02 Auto
Potion Property DamageStaminaLinger03 Auto
Potion Property DamageStaminaLinger04 Auto
Potion Property DamageStaminaLinger05 Auto
Potion Property DamageStaminaRate01 Auto
Potion Property DamageStaminaRate02 Auto
Potion Property DamageStaminaRate03 Auto
Potion Property DamageStaminaRate04 Auto
Potion Property Paralyze01 Auto
Potion Property Paralyze02 Auto
Potion Property Paralyze03 Auto
Potion Property Paralyze04 Auto
Potion Property Paralyze05 Auto
Spell Property DamageHealth01Spell Auto
Spell Property DamageHealth02Spell Auto
Spell Property DamageHealth03Spell Auto
Spell Property DamageHealth04Spell Auto
Spell Property DamageHealth05Spell Auto
Spell Property DamageHealthLinger01Spell Auto
Spell Property DamageHealthLinger02Spell Auto
Spell Property DamageHealthLinger03Spell Auto
Spell Property DamageHealthLinger04Spell Auto
Spell Property DamageHealthLinger05Spell Auto
Spell Property DamageMagicka01Spell Auto
Spell Property DamageMagicka02Spell Auto
Spell Property DamageMagicka03Spell Auto
Spell Property DamageMagicka04Spell Auto
Spell Property DamageMagicka05Spell Auto
Spell Property DamageMagickaLinger01Spell Auto
Spell Property DamageMagickaLinger02Spell Auto
Spell Property DamageMagickaLinger03Spell Auto
Spell Property DamageMagickaLinger04Spell Auto
Spell Property DamageMagickaLinger05Spell Auto
Spell Property DamageMagickaRecovery01Spell Auto
Spell Property DamageMagickaRecovery02Spell Auto
Spell Property DamageMagickaRecovery03Spell Auto
Spell Property DamageMagickaRecovery04Spell Auto
Spell Property DamageMagickaRecovery05Spell Auto
Spell Property DamageStamina01Spell Auto
Spell Property DamageStamina02Spell Auto
Spell Property DamageStamina03Spell Auto
Spell Property DamageStamina04Spell Auto
Spell Property DamageStamina05Spell Auto
Spell Property DamageStaminaLinger01Spell Auto
Spell Property DamageStaminaLinger02Spell Auto
Spell Property DamageStaminaLinger03Spell Auto
Spell Property DamageStaminaLinger04Spell Auto
Spell Property DamageStaminaLinger05Spell Auto
Spell Property DamageStaminaRate01Spell Auto
Spell Property DamageStaminaRate02Spell Auto
Spell Property DamageStaminaRate03Spell Auto
Spell Property DamageStaminaRate04Spell Auto
Spell Property Paralyze01Spell Auto
Spell Property Paralyze02Spell Auto
Spell Property Paralyze03Spell Auto
Spell Property Paralyze04Spell Auto
Spell Property Paralyze05Spell Auto
int scriptrunning = 0

Event OnInit()
GoToState("Standby")
EndEvent


Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)

GoToState("")

if scriptrunning == 0


if(akAggressor as Actor)
if(aksource as weapon)

int coinflip = Utility.RandomInt(1, 2)

if coinflip == 2

ApplyPoisonOnHitFunction(akAggressor)


endif

endif
else
Debug.Notification("Blocked")
endif

endif

GoToState("Standby")

EndEvent


Function ApplyPoisonOnHitFunction(ObjectReference akAggressor)

scriptrunning = 1

int random = Utility.RandomInt(1, 9)

int randommaster = random
int hasskipped = 0

If hasskipped == 0

If random == 1
If (akAggressor.GetItemCount(DamageHealth05) > 0)
akAggressor.DoCombatSpellApply(DamageHealth05Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth05, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth04) > 0)
akAggressor.DoCombatSpellApply(DamageHealth04Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth04, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth03) > 0)
akAggressor.DoCombatSpellApply(DamageHealth03Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth03, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth02) > 0)
akAggressor.DoCombatSpellApply(DamageHealth02Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth02, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth01) > 0)
akAggressor.DoCombatSpellApply(DamageHealth01Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 2
If (akAggressor.GetItemCount(DamageHealthLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 3
If (akAggressor.GetItemCount(DamageMagicka05) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka04) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka03) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka02) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka01) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 4
If (akAggressor.GetItemCount(DamageMagickaLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 5
If (akAggressor.GetItemCount(DamageMagickaRecovery05) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery04) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery03) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery02) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery01) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 6
If (akAggressor.GetItemCount(DamageStamina05) > 0)
akAggressor.DoCombatSpellApply(DamageStamina05Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina05, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina04) > 0)
akAggressor.DoCombatSpellApply(DamageStamina04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina04, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina03) > 0)
akAggressor.DoCombatSpellApply(DamageStamina03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina03, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina02) > 0)
akAggressor.DoCombatSpellApply(DamageStamina02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina02, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina01) > 0)
akAggressor.DoCombatSpellApply(DamageStamina01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 7
If (akAggressor.GetItemCount(DamageStaminaLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 8
If (akAggressor.GetItemCount(DamageStaminaRate04) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate04, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate03) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate03, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate02) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate02, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate01) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate01, 1)
Else
random = random + 1
EndIf
EndIf

If random == 9
If (akAggressor.GetItemCount(Paralyze05) > 0)
akAggressor.DoCombatSpellApply(Paralyze05Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze05, 1)
ElseIf (akAggressor.GetItemCount(Paralyze04) > 0)
akAggressor.DoCombatSpellApply(Paralyze04Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze04, 1)
ElseIf (akAggressor.GetItemCount(Paralyze03) > 0)
akAggressor.DoCombatSpellApply(Paralyze03Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze03, 1)
ElseIf (akAggressor.GetItemCount(Paralyze02) > 0)
akAggressor.DoCombatSpellApply(Paralyze02Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze02, 1)
ElseIf (akAggressor.GetItemCount(Paralyze01) > 0)
akAggressor.DoCombatSpellApply(Paralyze01Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze01, 1)
Else
random = 1
hasskipped = 1
EndIf
EndIf

EndIf

If hasskipped == 1

If random == 1
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageHealth05) > 0)
akAggressor.DoCombatSpellApply(DamageHealth05Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth05, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth04) > 0)
akAggressor.DoCombatSpellApply(DamageHealth04Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth04, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth03) > 0)
akAggressor.DoCombatSpellApply(DamageHealth03Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth03, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth02) > 0)
akAggressor.DoCombatSpellApply(DamageHealth02Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth02, 1)
ElseIf (akAggressor.GetItemCount(DamageHealth01) > 0)
akAggressor.DoCombatSpellApply(DamageHealth01Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealth01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 2
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageHealthLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageHealthLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageHealthLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageHealthLinger01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 3
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageMagicka05) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka04) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka03) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka02) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagicka01) > 0)
akAggressor.DoCombatSpellApply(DamageMagicka01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagicka01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 4
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageMagickaLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaLinger01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 5
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageMagickaRecovery05) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery05Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery05, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery04) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery04Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery04, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery03) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery03Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery03, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery02) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery02Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery02, 1)
ElseIf (akAggressor.GetItemCount(DamageMagickaRecovery01) > 0)
akAggressor.DoCombatSpellApply(DamageMagickaRecovery01Spell, PlayerRef)
akAggressor.RemoveItem(DamageMagickaRecovery01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 6
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageStamina05) > 0)
akAggressor.DoCombatSpellApply(DamageStamina05Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina05, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina04) > 0)
akAggressor.DoCombatSpellApply(DamageStamina04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina04, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina03) > 0)
akAggressor.DoCombatSpellApply(DamageStamina03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina03, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina02) > 0)
akAggressor.DoCombatSpellApply(DamageStamina02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina02, 1)
ElseIf (akAggressor.GetItemCount(DamageStamina01) > 0)
akAggressor.DoCombatSpellApply(DamageStamina01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStamina01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 7
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageStaminaLinger05) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger05Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger05, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger04) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger04, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger03) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger03, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger02) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger02, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaLinger01) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaLinger01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaLinger01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 8
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(DamageStaminaRate04) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate04Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate04, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate03) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate03Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate03, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate02) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate02Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate02, 1)
ElseIf (akAggressor.GetItemCount(DamageStaminaRate01) > 0)
akAggressor.DoCombatSpellApply(DamageStaminaRate01Spell, PlayerRef)
akAggressor.RemoveItem(DamageStaminaRate01, 1)
Else
random = random + 1
EndIf
EndIf
EndIf

If random == 9
If random == randommaster
random = 0
Else
If (akAggressor.GetItemCount(Paralyze05) > 0)
akAggressor.DoCombatSpellApply(Paralyze05Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze05, 1)
ElseIf (akAggressor.GetItemCount(Paralyze04) > 0)
akAggressor.DoCombatSpellApply(Paralyze04Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze04, 1)
ElseIf (akAggressor.GetItemCount(Paralyze03) > 0)
akAggressor.DoCombatSpellApply(Paralyze03Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze03, 1)
ElseIf (akAggressor.GetItemCount(Paralyze02) > 0)
akAggressor.DoCombatSpellApply(Paralyze02Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze02, 1)
ElseIf (akAggressor.GetItemCount(Paralyze01) > 0)
akAggressor.DoCombatSpellApply(Paralyze01Spell, PlayerRef)
akAggressor.RemoveItem(Paralyze01, 1)
Else
random = 0
EndIf
EndIf
EndIf

EndIf

scriptrunning = 0

GoToState("Standby")

EndFunction

State Standby

EndState

 

 

 

 

Well that was like pulling the pin on a grenade ... I applaud your tenacity.

 

Well, I can always abandon the project or if you're afraid I'm gonna hurt someone with it :ermm:

I do realize that it can be exhausting to deal with non-professionals, and I'm sorry.

Edited by TangerineDog
Link to comment
Share on other sites

"Well that was like pulling the pin on a grenade ... I applaud your tenacity." .. Is a complement

Like I said sometime PlayerRef can be fussy .. probably because it's in the same line and all ...

"non-professionals" .. I think you're way pass the noob phase my friend.

Edited by NexusComa
Link to comment
Share on other sites

"Well that was like pulling the pin on a grenade ... I applaud your tenacity." .. Is a complement

 

Like I said sometime PlayerRef can be fussy .. probably because it's in the same line and all ...

 

"non-professionals" .. I think you're way pass the noob phase my friend.

Phew, I'm glad to hear that :D Thanks!

In that case, I'll feel less bad for not knowing what it is I'm doing.

Link to comment
Share on other sites

Looks like you missed the one at the start of the line. Going off what you posted earlier.

Just use it when you can and if you can't use it the other way. It all comes down to some calls needing to know it in real time or if it can be a reference.

Also: random = random + 1 can be: random =+1 ; that's the same call

Edited by NexusComa
Link to comment
Share on other sites

"In that case, I'll feel less bad for not knowing what it is I'm doing."
We all start this way. Make sure to keep what you learn in a spot you can refer back to latter.
​Good programmers have a huge library like this of pass calls that worked out. So they don't have to keep reinventing the wheel.

​Also a good idea to add rem statements. Like ReDragon2013 did. ; this is so when I come back 3 years from now it don't take me 2 days to figure out what i was doing here and helps with de-bugging.

Edited by NexusComa
Link to comment
Share on other sites

"I do realize that it can be exhausting to deal with non-professionals, and I'm sorry."
On the contrary after a lifetime of programming watching others bloom like you are doing right now is one of my greatest joys.

​The arrays are nice. But here is one of them odd things .. the long form as you did in your 1st script is actually faster as the code doesn't need to trace the array each time. ;this however is debatable.
You can do some cool tricks with arrays so it is good to know how to use them. They can help make a code more generic and use some fancy math.

 

I wouldn't worry about script length .. I have a few scripts that are huge that work just fine. Like a random dungeon generator.

 

Also: I did think you were putting this on the player directly ... (my bad)


Edited by NexusComa
Link to comment
Share on other sites

Looks like you missed the one at the start of the line. Going off what you posted earlier.

Just use it when you can and if you can't use it the other way. It all comes down to some calls needing to know it in real time or if it can be a reference.

Also: random = random + 1 can be: random =+1 ; that's the same call

Slight error. It would be random += 1 rather than random =+ 1 at least I have never seen the latter and am unsure if it would even compile.

Link to comment
Share on other sites

Thanks for the advice! It will be heeded :wink:

 

Well, in this case, I'll leave the Game.GetPlayer() in and use it without arrays and go to testing it.

This is certainly gonna be interesting. FIngers crossed.

 

Edit: and no, += 1 didn't compile, but I got to =+1 on my own devices :)

Edited by TangerineDog
Link to comment
Share on other sites

  • Recently Browsing   0 members

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