Jump to content

cerati

Member
  • Posts

    31
  • Joined

  • Last visited

Reputation Activity

  1. Like
  2. Spiffo
    cerati got a reaction from ATPHHe in drainableComboItem   
    I cannot find an example of an item of this Type in the script files. Anyone know an example of one? A radio?
  3. Pie
    cerati got a reaction from ATPHHe in Dangerous Zombies (B40, B41 IWBUMS)   
    Nice, gonna be insane with sprinters!
     
  4. Spiffo
    cerati got a reaction from ATPHHe in Question about the OnWeaponHitCharacter event   
    Thank you ATPHHe and EnigmaGrey for solving my question! This helps immensely!  
  5. Like
    cerati reacted to ATPHHe in rain barrel functions for self made barrels   
    There we go, after playing around with the lua coding for a bit, I managed to get the Metal Drum to spawn and be placed down.
    They can be interacted with.
    They can also be disassembled. (Disassembling the Drums will put them back in your inventory or on the ground)
     
    I'll PM you the mod folder which contains all of the recipes and lua scripts.
     
    If you have any questions about the mod, feel free to ask me.
    Here's some screenshots:




     
     
  6. Like
    cerati reacted to ATPHHe in Question about the OnWeaponHitCharacter event   
    After doing some of my own tests I can confirm that it includes hitting other players and zombies.
     
    OnWeaponHitCharacter calls functions added to it when triggered. You must name the 4 parameters in the function you give to the OnWeaponHitCharacter Event.
    You can call those parameters any variable name you want in your lua functions.
     
    Here's a simple example lua code that prints out the attacker's name, target's name, weapon name, and the damageSplit variable.
    Feel free to modify/use this code.
    --[[ Triggered when a "IsoGameCharacter" has been hit by a "HandWeapon". https://pzwiki.net/wiki/Modding:Lua_Event/OnWeaponHitCharacter Parameters: IsoGameCharacter attacker IsoGameCharacter target HandWeapon weapon Float damageSplit ]] local function onWeaponHit(attacker, target, weapon, damageSplit) local attackerName = tostring( attacker:getFullName() ) local targetName = tostring( target:getFullName() ) local weaponName = tostring( weapon:getName() ) -- Print out the attacker's name, target's name, weapon name, and the damageSplit variable. print(string.format("%s | %s | %s | %f", attackerName, targetName, weaponName, damageSplit)) --print(attackerName.." | "..targetName.." | "..weaponName.." | "..damageSplit) end -- Add the function named "onWeaponHit" to the OnWeaponHitCharacter Event. Events.OnWeaponHitCharacter.Add(onWeaponHit)  
    It prints out this on the Build 40 console. (I am hitting super survivors and zombies with a hammer. Apparently zombies have names.)

  7. Like
    cerati reacted to EnigmaGrey in Question about the OnWeaponHitCharacter event   
    You’ll want to use getType() to check if it’s an IsoZombie or an IsoPlayer, iirc.  So, attacker.getType() should return a string with the class name that you can compare.
     
    IsoGameCharacter is the just patent class these two inherit from, rather than what’s actually passed to the function.
     
    Zombies have full player descriptions, but they’re not used for much (if anything) in practice. It’s inherited from IsoGameCharacter.
     
    I’ve not touched this stuff in a long time though, personally. I might well have it confused with getClass() or toString(). There should be examples of this in the game code regardless.
     
     
  8. Spiffo
    cerati got a reaction from ATPHHe in rain barrel functions for self made barrels   
    I'm new to modding in lua and haven't revisited my amateur Java skills but you might have to call a method that tracks the coords of your mouse, call a method to return those coords to a variable and then send those coords into another function that calls methods to make it an item you can place and collide with.  You really might have to decompile the source code and track down the mthods that allow you to do the things you want to do. I hope this helps.
  9. Spiffo
    cerati got a reaction from ATPHHe in Question about the OnWeaponHitCharacter event   
    Hi! does this mean when you hit a different player, or a hit a zombie? Also, How do I satisfy the Float parameter called damageSplit? Can I just fill in any number with my own variable or do I have to call a specific method that returns the value? I'm defintely new to LUA coding, so thanks for your time replying to this!
×
×
  • Create New...