Jump to content


  • Content Count

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you so much, Fenris_Wolf! That was exactly the solution to my problem. I greatly appreciate the help ProjectSky, thank you for your suggestion as well, although my goal isn't to actually use this code to heal the player. I was just using those calls as an example of the problem I was having while attempting to loop through each of the body parts. I apologize for not coming up with a better example
  2. Thank you for your suggestion Fenris_Wolf and you're absolutely right! However, when I implement your suggestion, like so: local parts = getPlayer():getBodyDamage():getBodyParts(); for i=0, 16 do if parts[i] then parts[i]:RestoreToFullHealth() end if not parts[i] then getPlayer():Say("uh oh") end end , the behavior I witness in game is the player character repeatedly saying "uh oh" without any healing happening at all (I'm calling the function using this code with the OnPlayerUpdate event). This leads me to believe that maybe lua isn't capable of handling the BodyPartType types
  3. I'm attempting to write a function that will loop over each of the body parts of a player and restore them to full health using RestoreToFullHealth(), but it seems that if I loop over them as so: local parts = getPlayer():getBodyDamage():getBodyParts(); for i=0, (getPlayer():getBodyDamage():getBodyParts():size() - 1) do parts[i]:RestoreToFullHealth(); end then I get a "java.lang.RuntimeException: attempted index: RestoreToFullHealth of non-table: null" error and I'm not sure why. Can anyone explain to me why this is happening and/or the appropriate way to accomplish what I
  4. Does anyone happen to know if OnWeaponHitCharacter will trigger when a zombie hits a player? I know zombies are IsoGameCharacters, but I'm unsure if a zombie hitting a player counts as a HandWeapon being used, so I'm unsure if this event will trigger when it happens. If not, does anyone know what event I should be hooking with to run code when a zombie strikes a player? Additionally, can anyone explain the differences and/or purpose between the keyID field for IsoObjects and the ID field for MovingObjects? Can either of these be used to uniquely identify a IsoZombie or IsoPlayer? Specifical
  5. Thank you both so much, this is exactly what I had needed. Originally, I wasn't sure why my global variables weren't behaving that way, but later discovered that's because of a design error that was resetting those variables. I've since fixed that. Extra kudos to nater for bringing ModData to my attention, as I didn't know doing that was a possibility and I do need these values to persist across save/load.
  6. Is it possible to declare variables in a lua script that will persistent beyond the lifetime of the function and into further instances? In other words, if I have a script that's called by Events.OnPlayerUpdate.Add(), can I declare a variable that will retain it's value and be used in future instances of that script being triggered by Events.OnPlayerUpdate.Add()? What I want in the end is the ability to store a value that will increment each time that function runs, but the problem I'm having is that the variable appears to get dropped and thus never actually increments. I'm not sure if what I
  • Create New...