GoGo-Boy
You can change this now in User CP
- Reaction score
- 40
So do you think it is speed-wise better to use UnitAlive() instead of GetWidgetLife()>=4.05?
library TestNatives initializer Init
private function Actions takes nothing returns boolean
call DisplayText( 0, "Hellu !" )
if UnitAlive( gg_unit_Hpal_0003 ) then
call DisplayText( 0, "He039;s breathing !" )
endif
/*if UnitInvis( gg_unit_Hpal_0003 ) != true then
call DisplayText( 0, "I can see him !" )
endif*/
call DisplayText( 0, I2S( GetHeroId() ) )
call DisplayTextI( 0, "Huh !", 123 )
return false
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterTimerEvent( t, 0.00, false )
call TriggerAddCondition( t, Condition( function Actions ) )
endfunction
endlibrary
call CreateCaptains()
call DisplayTextToPlayer( Player( 0 ), 0.0, 0.0, I2S( GetUnitCount( 039;hpea039; ) ) )
private function GetLastStructure takes player p returns unit
local unit u
if GetLocalPlayer() == p then
set u = GetBuilding( p )
endif
return u
endfunction
Are you sure that that won't desync if used online in combination with something else?
GetPlayerUnitCountOfTypeOrWhatever works fine, and I found a perfect use for it, since it doesn039;t count dead units.
Nah, but why would it ? :S
It's not like it'll change anything right ? :S
If u is null for everyone but one player, then you kill u, what do you think will happen
Desync... I guess you could use it with select unit or something.
Komaqtion, 100% chance that will desynch (on the condition it works at all).And also, and this is quite useful I'd believe, this will give you the last built structure of a player (Though, don't know if it'll desync :S But wouldn't think so ):
Komaqtion, 100% chance that will desynch (on the condition it works at all).
Well, might there be a way to prevent it ? :S
XDIs this a momentous event for JASS coding? xD
"The discovery of new natives found in the ancient, forgotten civilisation that is the Common.ai"
That's why I had to ask.PS. Does this detect a unit with 5 health and no dead status as dead, if it is?
function SchrodingersCat takes nothing returns unit
local unit u=CreateUnit(Player(15),039;hfoo039;,0,0,0)
call SetWidgetLife(u,0)
call SetWidgetLife(u,9001)
call UnitRemoveType(u,UNIT_TYPE_DEAD)
return u
endfunction
function Test takes nothing returns nothing
if UnitAlive(SchrodingersCat()) then
call BJDebugMsg("Alive")
else
call BJDebugMsg("Dead")
endif
endfunction
function HiddenDragon takes nothing returns unit
local unit u=CreateUnit(Player(15),039;hpea039;,0,0,0)
call ShowUnit(u,false)
return u
endfunction
function Test takes nothing returns nothing
if UnitAlive(HiddenDragon()) then
call BJDebugMsg("Alive")
else
call BJDebugMsg("Dead")
endif
endfunction