• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] SetUnitMaxLife isnt working?

Status
Not open for further replies.
Level 9
Joined
Aug 21, 2008
Messages
533
JASS:
function Trig_test_Func001A takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(6), udg_startpoint[GetConvertedPlayerId(GetEnumPlayer())], bj_UNIT_FACING )
    call SetUnitMaxLife(GetLastCreatedUnit(),udg_maxlife[GetOwningPlayer(GetLasCreatedUnit())]
    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetRectCenter(udg_rect[GetConvertedPlayerId(GetEnumPlayer())]) )
endfunction

function Trig_test_Actions takes nothing returns nothing
    call ForForce( udg_activaded_players, function Trig_test_Func001A )
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_test, 1.00 )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction

Since i used the SetUnitMaxLife the hole thing isnt working anymore... Someone know way?
 
Level 9
Joined
Aug 21, 2008
Messages
533
i m not using vJass... i already begunn with jasss..
I need something easier cause i dont need a system to change everything i just need to change the life- upgrades arent working like i want them to work(i cant make the upgrades multipicating the life * 1,10 more than once without bugs)
 
i m not using vJass... i already begunn with jasss..
I need something easier cause i dont need a system to change everything i just need to change the life- upgrades arent working like i want them to work(i cant make the upgrades multipicating the life * 1,10 more than once without bugs)

Just get vJASS..

Anyways, you need that function in order to use it. It also requires you to copy some abilitys.
 
C/P'd from thehelper.

Make sure you have all of the abilities copied, as well as the function.

Try this, (btw, it leaks)

JASS:
function Trig_test_Func001A takes nothing returns nothing
    set bj_lastCreatedUnit = CreateUnitAtLoc(Player(6), 'hfoo', udg_startpoint[GetConvertedPlayerId(GetEnumPlayer())], bj_UNIT_FACING)
    call SetUnitMaxLife(bj_lastCreatedUnit,udg_maxlife[GetOwningPlayer(bj_lastCreatedUnit)]
    call IssuePointOrderLoc(bj_lastCreatedUnit, "move", GetRectCenter(udg_rect[GetConvertedPlayerId(GetEnumPlayer())]))
endfunction

function Trig_test_Actions takes nothing returns nothing
    call ForForce(udg_activaded_players, function Trig_test_Func001A)
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_test, 1.00 )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction
 
Level 9
Joined
Aug 21, 2008
Messages
533
hmm dont works like i want to... solved it this way:
JASS:
function Trig_test_Func001A takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'H005', Player(6), udg_startpoint[GetConvertedPlayerId(GetEnumPlayer())], 270 )
    call SetHeroStr(GetLastCreatedUnit(),R2I(udg_maxl[GetConvertedPlayerId(GetEnumPlayer())]), true )
    call IssuePointOrderLocBJ( GetLastCreatedUnit(), "move", GetRectCenter(udg_rect[GetConvertedPlayerId(GetEnumPlayer())]) )
endfunction

function Trig_test_Actions takes nothing returns nothing
    call ForForce( udg_activaded_players, function Trig_test_Func001A )
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    set gg_trg_test = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_test, 1.00 )
    call TriggerAddAction( gg_trg_test, function Trig_test_Actions )
endfunction

was easier for me
 
Status
Not open for further replies.
Top