• 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.

[JASS] Cliffs and units

Status
Not open for further replies.
Level 5
Joined
Sep 11, 2006
Messages
142
Wait.. would this script work? (if you cba to read that, then all i need you to see is- set udg_BulletOffset = PolarProjectionBJ(GetNearestPathableLoc(GetUnitLoc (udg_Bullet)), 50.00, GetUnitFacing(udg_Bullet)) that works right?

function Trig_Bullet_Move_Func001Func001Func005002003001 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Bullet)) == true )
endfunction

function Trig_Bullet_Move_Func001Func001Func005002003002 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction

function Trig_Bullet_Move_Func001Func001Func005002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Bullet_Move_Func001Func001Func005002003001(), Trig_Bullet_Move_Func001Func001Func005002003002() )
endfunction

function Trig_Bullet_Move_Func001Func001Func006A takes nothing returns nothing
// Sniper Rifle
set udg_WeaponDamage = 100.00
call UnitDamageTargetBJ( udg_Bullet, GetEnumUnit(), udg_WeaponDamage, ATTACK_TYPE_MELEE, DAMAGE_TYPE_UNIVERSAL )
call GroupRemoveUnitSimple( udg_Bullet, udg_Bullets )
call RemoveUnit( udg_Bullet )
endfunction

function Trig_Bullet_Move_Func001Func001Func008C takes nothing returns boolean
if ( not ( GetUnitUserData(udg_Bullet) >= 100 ) ) then
return false
endif
return true
endfunction

function Trig_Bullet_Move_Func001Func001A takes nothing returns nothing
set udg_Bullet = GetEnumUnit()
call SetUnitUserData( udg_Bullet, ( GetUnitUserData(udg_Bullet) + 1 ) )
set udg_BulletOffset = PolarProjectionBJ(GetNearestPathableLoc(GetUnitLoc(udg_Bullet)), 50.00, GetUnitFacing(udg_Bullet))
call SetUnitPositionLoc( udg_Bullet, udg_BulletOffset )
set udg_BulletHit = GetUnitsInRangeOfLocMatching(50.00, GetUnitLoc(udg_Bullet), Condition(function Trig_Bullet_Move_Func001Func001Func005002003))
call ForGroupBJ( udg_BulletHit, function Trig_Bullet_Move_Func001Func001Func006A )
// End of the Line
if ( Trig_Bullet_Move_Func001Func001Func008C() ) then
call GroupRemoveUnitSimple( udg_Bullet, udg_Bullets )
call RemoveUnit( udg_Bullet )
else
call DoNothing( )
endif
call RemoveLocation (udg_BulletOffset)
call DestroyGroup (udg_BulletHit)
endfunction

function Trig_Bullet_Move_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 3
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call ForGroupBJ( udg_Bullets, function Trig_Bullet_Move_Func001Func001A )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction

//===========================================================================
function InitTrig_Bullet_Move takes nothing returns nothing
set gg_trg_Bullet_Move = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Bullet_Move, 0.01 )
call TriggerAddAction( gg_trg_Bullet_Move, function Trig_Bullet_Move_Actions )
endfunction

And @Wrym Lord,how do i find out the TerrainCliffLevel that a particular unit is on?
 
Last edited:
Level 5
Joined
Sep 11, 2006
Messages
142
so...GetTerrainCliffLevel (GetUnitX(udg_bullet)), (GetUnitY(udg_Bullet))
not sure about the commands to get a units X and Y,
not amazing at JASS
EDIT:Nevermind found a way, so will this work?
endif
call GetTerrainCliffLevel Location(GetLocationX(GetUnitLoc(udg_Bullet)), GetLocationY(GetUnitLoc(udg_Bullet)>= 1))
 
Last edited:
Level 11
Joined
Oct 13, 2005
Messages
233
ahhh i see :) thanks for the help so
endif
GetTerrainCliffLevel(GetUnitX(udg_bullet), GetUnitY(udg_Bullet))>=1

will stop the trigger if the cliff height is greaterthan or equal to 1?
Fixed. You were putting the >= 1 inside the function call, which would have made the second parameter boolean instead of real. This would stop it if the cliff level was greater than 1, but not if it was 1 higher than the current level of the unit. To do this, you'd do the same thing, but first do it for the unit and then for the location the bullet would be moved to. If the second location had a higher cliff level, destroy the bullet.
 
Status
Not open for further replies.
Top