Advertisement
DieFeM

ShockCollarScript

Jun 6th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. Scriptname NukaWorldPlus:System:ShockCollarScript extends ObjectReference
  2.  
  3. ;Author : Simon Grunwald, @Systoliker#6260
  4. ;First Date : 05.06.2019
  5. ;Last Date : 05.06.2019
  6.  
  7. ;Editor : DieFeM, @DieFeM#3996
  8. ;First Date : 06.06.2019
  9. ;Last Date : 06.06.2019
  10.  
  11. Function BlowUp()
  12. if !Wearer.getActorBase().isEssential()
  13. if Wearer.getActorBase().isProtected()
  14. Wearer.setProtected(false)
  15. endif
  16. Wearer.PlaceAtMe(pFragExplosion)
  17. Wearer.kill()
  18. Wearer.Dismember("Head1", true, false, false)
  19. Wearer.Dismember("Torso", true, false, false)
  20. Wearer.Dismember("LeftArm1", false, false, false)
  21. Wearer.Dismember("RightArm1", true, false, false)
  22. Wearer.Dismember("LeftLeg1", true, false, false)
  23. Wearer.Dismember("RightLeg1", false, false, false)
  24. else
  25. Wearer.PlaceAtMe(pFragExplosion)
  26. Wearer.kill()
  27. endif
  28. EndFunction
  29.  
  30. Bool Function CheckLocation(Actor ActorRef)
  31. return ActorRef.GetCurrentLocation() == NukaWorldLoc || ActorRef.GetWorldspace() == NukaWorld
  32. EndFunction
  33.  
  34. Event OnEquipped(Actor akEquipper)
  35. Wearer = akEquipper
  36. RegisterForRemoteEvent(akEquipper, "OnLocationChange")
  37. EndEvent
  38.  
  39. Event OnUnequipped(Actor akUnequipper)
  40. Wearer = None
  41. UnregisterForRemoteEvent(akUnequipper, "OnLocationChange")
  42. if akUnequipper == game.getPlayer()
  43. int iButton = DisarmMessage.show()
  44. if iButton == 0
  45. CancelTimer(BlowUpTimerId)
  46. akUnequipper.RemoveItem(DisarmKey)
  47. akUnequipper.RemoveItem(GetBaseObject())
  48. elseif iButton == 1
  49. int i = utility.RandomInt(1, 15)
  50. if i <= akUnequipper.getValue(DisarmPerk)
  51. CancelTimer(BlowUpTimerId)
  52. akUnequipper.RemoveItem(GetBaseObject())
  53. else
  54. BlowUp()
  55. endif
  56. elseif iButton == 2
  57. akUnequipper.EquipItem(GetBaseObject())
  58. endif
  59. endif
  60. EndEvent
  61.  
  62. Event Actor.OnLocationChange(Actor akSender, Location akOldLoc, Location akNewLoc)
  63. If !CheckLocation(akSender)
  64. WarningMessage.show()
  65. Debug.Notification("Death Counter started!")
  66. StartTimer(40, BlowUpTimerId)
  67. Else
  68. CancelTimer(BlowUpTimerId)
  69. EndIf
  70. EndEvent
  71.  
  72. Event onTimer(int aiTimerId)
  73. if aiTimerId == BlowUpTimerId
  74. if Wearer.isEquipped(GetBaseObject())
  75. BlowUp()
  76. endif
  77. endif
  78. EndEvent
  79.  
  80. Group HUD
  81. Explosion Property pFragExplosion Auto Const
  82. Message Property DisarmMessage Auto Const
  83. Message Property WarningMessage Auto Const
  84. EndGroup
  85.  
  86. Group System
  87. MiscObject Property DisarmKey Auto Const
  88. Location Property NukaWorldLoc Auto Const
  89. WorldSpace Property NukaWorld Auto Const
  90. ActorValue Property DisarmPerk Auto Const
  91. EndGroup
  92.  
  93. Group assisstance
  94. Actor Property Wearer Auto Hidden
  95. Int Property BlowUpTimerId = 34 Auto Hidden
  96. endGroup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement