Jump to content

[REL] Extra Health: Add more than normal health!


12p

Recommended Posts

Extra Health

Add more health than normal

You wanted to create a kind of boss ped, with more health than just 250 hitpoints? You can do it now with this script!

I just had this idea when my multimod server had Misterix Mods and I wanted to give them more health.

I decided to share this script because it is really useful, I think. Hope you think so, too ;)

And this post is for you guys, to think about it, what could I add, or delete, etc...

How to use

1. Create a ped.

2. exports.extrahealth:setElementExtraHealth(thePed, value)

3. Shoot to this ped!

Exported Functions

exports.extrahealth:setElementExtraHealth ( element, float value ) 
exports.extrahealth:getElementExtraHealth ( element ) 
exports.extrahealth:isElementWithExtraHealth ( element ) 
exports.extrahealth:addElementExtraHealth ( element, float value ) 
exports.extrahealth:takeElementExtraHealth ( element, float value ) 
exports.extrahealth:removeElementExtraHealth ( element ) 
exports.extrahealth:setElementInvulnerable ( element, bool state ) 

Events

onPedDamage

Function Parameters:

Attacker - The element that was attacking the ped.

Weapon - An integer representing the weapon that damaged the ped.

Bodypart - An integer indicating the body part where the ped got damaged.

Loss - A flotating point number that shows the damage the ped received.

Source:

The source of this event is the ped that got damaged.

Cancel Event:

This won't do anything, isn't like onClientPedDamage huh.

Edited by Guest
Link to comment
  • 3 weeks later...
  • 2 years later...

Can you tell me why this doesn`t work? I just get the following message:

attempt to call global "setElementExtraHealth (a nil value)

  
function pedLoad ( thePlayer ) 
exports.extrahealth:setElementExtraHealth ( thePed, value ) 
local x, y, z = getElementPosition(thePlayer) 
    x = x+1 
    local thePed1 = createPed ( 120, x, y, z ) 
    setElementExtraHealth ( thePed1, 50 ) 
    x = x+1 
    local thePed2 = createPed ( 0, x, y, z ) 
    setElementExtraHealth ( thePed2, 250 ) 
    y = y+1 
    local thePed3 = createPed ( 0, x, y, z ) 
    setElementExtraHealth ( thePed3, 1000 ) 
    local stat3 = getElementHealth (thePed3) 
    outputChatBox("Stat3: " ..stat3) 
end 
addCommandHandler ( "probe", pedLoad ) 

I try to reduce the Health of Peds, but it doesnt work. setElementHealth, setPedStat(thePed, 24, 50), nothing works. The Ped always has the same Health.

Link to comment
Can you tell me why this doesn`t work? I just get the following message:

attempt to call global "setElementExtraHealth (a nil value)

  
function pedLoad ( thePlayer ) 
exports.extrahealth:setElementExtraHealth ( thePed, value ) 
local x, y, z = getElementPosition(thePlayer) 
    x = x+1 
    local thePed1 = createPed ( 120, x, y, z ) 
    setElementExtraHealth ( thePed1, 50 ) 
    x = x+1 
    local thePed2 = createPed ( 0, x, y, z ) 
    setElementExtraHealth ( thePed2, 250 ) 
    y = y+1 
    local thePed3 = createPed ( 0, x, y, z ) 
    setElementExtraHealth ( thePed3, 1000 ) 
    local stat3 = getElementHealth (thePed3) 
    outputChatBox("Stat3: " ..stat3) 
end 
addCommandHandler ( "probe", pedLoad ) 

I try to reduce the Health of Peds, but it doesnt work. setElementHealth, setPedStat(thePed, 24, 50), nothing works. The Ped always has the same Health.

exports is needed. "How to use" is explains "How you can use it", not "How to copy paste".

Link to comment
function pedLoad(thePlayer) 
    local x, y, z = getElementPosition(thePlayer) 
    local thePed1 = createPed(120, x + 1, y, z) 
    exports.extrahealth:setElementExtraHealth(thePed1, 50) -- I don't see a point for this 
    local thePed2 = createPed(0, x + 1, y, z) 
    exports.extrahealth:setElementExtraHealth(thePed2, 250) 
    local thePed3 = createPed(0, x, y + 1, z) 
    exports.extrahealth:setElementExtraHealth(thePed3, 1000) 
    local stat3 = exports.extrahealth:getElementExtraHealth(thePed3) 
    outputChatBox("Stat3: "..stat3) 
end 
addCommandHandler("probe", pedLoad) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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