• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Healing a thousand HP

Status
Not open for further replies.
Level 7
Joined
Jun 23, 2009
Messages
297
I decided to make a personalized pot, but I couldnt find anything in a trigger that healed 1000 hp for a especific unit (if you know, please let me know)
So Ive decided to learn JASS, and I got this far:


JASS:
//Start
Function Potion takes unit u returns noting
local unit u
loop
set u = Player(1)
exitwhen u == null
call unitstate(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))
endloop
endfunction
//End


But that would only heal all the HP of a unit, wich I dont want...
What do I do next?
Thnks :grin:
 
Level 8
Joined
Feb 15, 2009
Messages
463
JASS:
//Start
Function Potion takes unit u returns noting
local unit u
loop
set u = Player(1)// u cant set unit to a player u need GetTriggerUnit()
exitwhen u == null// and not a loop

call unitstate(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))
endloop
endfunction
//End
so thats what it should be

JASS:
function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
call SetUnitState( u , UNIT_STATE_LIFE , GetUnitState( u , UNIT_STATE_LIFE) + 1000 )
endfunction
 
Last edited:
Level 5
Joined
May 20, 2008
Messages
138
why not just

  • Unit - set life of (triggering unit) to (life of (triggering unit) + 1000)
replace (triggering unit) with whatever is needed in your trigger
 
Level 7
Joined
Jun 23, 2009
Messages
297
actually, im trying to learn JASS to actually do this pot...
i just didnt look well enough....
thnks a lot guys (specially Marsmallos)
Now i have one last problem:

dibujodyb.png


Now each time a hero moves the pot, itll give him 1000 htps =(
 
Status
Not open for further replies.
Top