Jump to content

Need help running other script's functions through properties


nickfelstone

Recommended Posts

Posted

Okay, I need help now. I've gotten to a point where I'm confused as to how I'm doing this wrong. I'm defining the property the same as Rats in the Wall and as suggested in the original post, as well as applying the amputator function the same as rats in the wall and as suggested. Here's my script, which is attached to a referencealias for the player in order for the OnHit event to register properly. I know everything but my function calls are running properly due to the debug messages appearing as intended. This is how Haeretic described the hookup process:

 

 

Add the Amputator script as a property to you script like this:
AmputatorMainScript Property AMS Auto

Call this Function to edit an actor:
AMS.ApplyAmputator(Actor akActor, int morphType ,int bothLeftRight)

morphType determines which bodypart to remove, the codes are:
0 = Heal all Amputations
1 = Feet
2 = Lower Legs
3 = Upper Legs
4 = Hands
5 = Forearms
6 = UpperArms

bothLeftRight determines which side to remove
0 = Both sides
1 = Left
2 = Right

 

 

My script:

 

 

Scriptname combatamputate extends ReferenceAlias
{comments are in curly-que brackets}

Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, \
bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
int AmpChance = Utility.RandomInt()
If(akSource as Weapon)
If abPowerAttack == 1
If abHitBlocked == 1
Else
debug.notification("You've been hit! AmpChance =" + AmpChance as Int)
If AmpChance >= 50
CombatAmputate()
Else
EndIf
EndIf
EndIf
EndIf
EndEvent

Function CombatAmputate()
int LimbSelect = Utility.RandomInt(1, 6)
int SideSelect = Utility.RandomInt(1, 2)
If SideSelect == 1
If LimbSelect == 1
debug.notification("Your left foot has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 2
debug.notification("Your lower left leg has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 3
debug.notification("Your left leg has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 4
debug.notification("Your left hand has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 5
debug.notification("Your lower left arm has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 6
debug.notification("Your left arm has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
EndIf
ElseIf SideSelect == 2
If LimbSelect == 1
debug.notification("Your right foot has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 2
debug.notification("Your lower right leg has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 3
debug.notification("Your right leg has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 4
debug.notification("Your right hand has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 5
debug.notification("Your lower right arm has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
ElseIf LimbSelect == 6
debug.notification("Your right arm has been cut off!")
AMS.ApplyAmputator(playerref, 3, 2)
EndIf
EndIf
EndFunction

AmputatorMainScript Property AMS Auto
Actor property playerref auto

 

 

I don't understand where I'm going wrong. It works in the case of Rats in the Wall, the WIP quest mod using the amputator framework.

 

For some background, this code is supposed to apply the amputator on an unblocked power attack, randomly removing a hand/foot/limb. I know that the numbers in my ApplyAmputator function calls don't line up with the random values or the text, but it's because it was easier to copy-paste lines while troubleshooting this issue.

CombatAmputationV05.7z

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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