• 🏆 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!

Help with new environment function

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
I've recently tried to work with a new integer function that checks for terrain pathebility. Can someone explain to me how this trigger works because i've treid to used it to detect if my unit was in shallow water (amphibious terrain) and the thing crashed.
 
Level 7
Joined
Jul 30, 2004
Messages
451
i don't know how to use it myself, i've never tried, but my first assumption would be 1 = true, 0 = false

if ((point) is (amphibous-pathable) == 1) then

but if u tried that and it didn't work i dunno, just fool around
 
Level 10
Joined
Apr 9, 2004
Messages
502
I tried that once but it said there was error in the script and it also considered the function a boolen even though it was an integer comparison. I dunno but i'll try setting it to 0 (perhaps that will work)


[edit] nope that doesn't work but i've found the problem. I'm 99% sure this was the map editor creator's fault because this is suppose to be a boolean but it's treated in GUI as an integer. All i had to do was change it to custom text and set it to true/false to make it work properly


Here's what i ended up with and it works perfectly

function Trig_Test_trig_terrain_check_Func001Func002A takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Test_trig_terrain_check_Func001Func003C takes nothing returns boolean
if ( not ( CountUnitsInGroup(GetUnitsOfTypeIdAll('h00Q')) > 1 ) ) then
return false
endif
return true
endfunction

function Trig_Test_trig_terrain_check_Func001C takes nothing returns boolean
if ( not ( IsTerrainPathableBJ(GetUnitLoc(gg_unit_E003_0009), PATHING_TYPE_FLOATABILITY) == false ) ) then
return false
endif
return true
endfunction

function Trig_Test_trig_terrain_check_Actions takes nothing returns nothing
if ( Trig_Test_trig_terrain_check_Func001C() ) then
if ( Trig_Test_trig_terrain_check_Func001Func003C() ) then
call DoNothing( )
else
call CreateNUnitsAtLoc( 1, 'h00Q', GetOwningPlayer(gg_unit_E003_0009), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endif
else
call UnitRemoveBuffBJ( 'B00U', gg_unit_E003_0009 )
call ForGroupBJ( GetUnitsOfTypeIdAll('h00Q'), function Trig_Test_trig_terrain_check_Func001Func002A )
endif
endfunction

//===========================================================================
function InitTrig_Test_trig_terrain_check takes nothing returns nothing
set gg_trg_Test_trig_terrain_check = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Test_trig_terrain_check, 0.01 )
call TriggerAddAction( gg_trg_Test_trig_terrain_check, function Trig_Test_trig_terrain_check_Actions )
endfunction
 
Level 7
Joined
Jul 30, 2004
Messages
451
lorothrigs said:
wtf, post it in non-jass :/

why?

the only part you're concerned with is

if ( not ( IsTerrainPathableBJ(GetUnitLoc(gg_unit_E003_0009), PATHING_TYPE_FLOATABILITY) == false ) ) then

the rest is just junk that came from his trigger that does other stuff and sets up the trigger
 
Status
Not open for further replies.
Top