• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

ADDitional Vaules

Status
Not open for further replies.
Level 8
Joined
Mar 23, 2007
Messages
302
Hey , i have a problem

whats about:
A unit only has 2 stats. Hp and Mana. But i want to make a unit more that
only this 2 stats. Like Fatigue, Way the unit did, Every hit the unit take or did
+ how much damage it did......... .. ........... much much more.

More details:
the thing is that i just do have no clue how to start...
And is there a way to make this automatic to every unit that is already on the
map or will be.

I could do this for every unit, but this is way to much work creating 1000 of
triggers only to store and change the stats of 30 units.

Hope some one can help me
 
Level 8
Joined
Mar 23, 2007
Messages
302
k, but i think i will use Handle Vars.

i did somthing, but it does not work, and I do not know why.

heres the code to store the Deald attacks (Datt) and the Taken Attacks (Tatt)
JASS:
function Trig_Takes_Damage_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2 = GetAttacker()          
local integer Datt = GetHandleInt(u2, "Datt")
local integer Tatt = GetHandleInt(u, "Tatt")
set Datt = Datt+1
set Tatt = Tatt+1
call SetHandleInt(u2, "Datt", Datt)
call SetHandleInt(u, "Tatt", Tatt)
set u = null
set u2 = null
endfunction  

//===========================================================================
function InitTrig_Deals_or_Takes_Damage takes nothing returns nothing
    set gg_trg_Deals_or_Takes_Damage = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Deals_or_Takes_Damage, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerAddAction( gg_trg_Deals_or_Takes_Damage, function Trig_Takes_Damage_Actions )
endfunction

and heres the function to get the stats show:
JASS:
function Trig_Text_Actions takes nothing returns nothing
local group G = GetUnitsSelectedAll(Player(0))
local integer M = CountUnitsInGroup(G)
local unit u
local integer Datt
local integer Tatt
if M == 1 then
    set u = FirstOfGroup(G)
    set Datt = GetHandleInt(u, "Datt")
    set Tatt = GetHandleInt(u, "Tatt")
    call DisplayTextToForce( GetPlayersAll(), "The Units Stats are: dealed attacks: "+I2S(Datt)+" and has taken attacks:  "+I2S(Tatt)+"." )
endif
endfunction   

//===========================================================================
function InitTrig_Text takes nothing returns nothing
    set gg_trg_Text = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_Text, Player(0), "A", true )
    call TriggerAddAction( gg_trg_Text, function Trig_Text_Actions )
endfunction

fixing the leak will be done, asa the trigger works.
 
Last edited:
Status
Not open for further replies.
Top