| 04-09-2005, 12:40 AM | #1 |
Ok, i've tried(unsuccesfully) to make a trigger so when a unit that is being moved by triggers(move unit to offset of position of unit by ## every #.## seconds) uses the "machine gun" ability(cusotm ability, obviously) it creates a a machine attack effect that does damage, kinda like the Azeroth Grand Prix( Azeroth Grand Prix) if anybody knows how Blizzard did that or knows how to do that help would be apprectiated...and rep would be rewarded. |
| 04-09-2005, 12:43 AM | #2 |
Could have been done via the Unit - Damage Unit trigger. I glaced through it just now and i didn't find exactly how it was done. |
| 04-09-2005, 12:46 AM | #3 | |
Quote:
|
| 04-09-2005, 05:27 AM | #4 | |
Quote:
i believe this is what you're looking for from the gradprix map, unless i read your request wrong... do i need to explain it? Code:
function BigGun takes unit uCart returns nothing
local integer nPlayerIndex = 0
local integer nPlayerSelf = -1
local integer nPlayerTarget = -1
local real rAngle = 0
local boolean bContinue = false
local location loc = null
local location loc1 = null
local location locVH = Location( -1, -1 )
local group g = null
local unit uSheep
local unit uSheepTarget
local unit uWagon
local effect effShoot = null
local real rHP = 0
local integer nLoopIndex = 0
set nPlayerSelf = GetPlayerIndex( GetOwningPlayer(uCart) )
if ( nPlayerSelf < 0 ) then
return
endif
if ( udg_GunAmmo[nPlayerSelf] <= 0 ) then
if ( not udg_AmmoWarning[nPlayerSelf] ) then
set udg_AmmoWarning[nPlayerSelf] = true
call ShowWarningMsg( Player(nPlayerSelf), "Out of Ammo!!! Reload ammo at pit stop." )
call PolledWait( 5 )
set udg_AmmoWarning[nPlayerSelf] = false
endif
return
endif
set udg_GunAmmo[nPlayerSelf] = udg_GunAmmo[nPlayerSelf] - 1
set udg_GunAttackTick[nPlayerSelf] = 0
set loc = GetUnitLoc( uCart )
set rAngle = GetUnitFacing( uCart )
set nLoopIndex = 0
call StopSound( udg_BigGunSound[nPlayerSelf], false, false )
call PlaySoundOnUnitBJ( udg_BigGunSound[nPlayerSelf], 100, uCart )
// loop
// exitwhen nLoopIndex >= 4
// set loc1 = PolarProjectionBJ( loc, 350 + RealSpeed(udg_Speed[nPlayerSelf]) * 5 + nLoopIndex * 50, rAngle )
// set effShoot = AddSpecialEffectLoc( "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl", loc1 )
// call RemoveLocation( loc1 )
// call DestroyEffect( effShoot )
// set nLoopIndex = nLoopIndex + 1
// endloop
//Killing Sheep
set g = GetUnitsInRangeOfLocMatching( 1500, loc, Condition(function CheckSheepFilter) )
loop
set uSheep = FirstOfGroup( g )
exitwhen uSheep == null
set loc1 = GetUnitLoc( uSheep )
if ( UnitCatchGunFire( loc, rAngle, loc1, locVH ) ) then
call KillUnit( uSheep )
endif
call RemoveLocation( loc1 )
call GroupRemoveUnit( g, uSheep )
endloop
call DestroyGroup( g )
//Killing Wagon
set g = GetUnitsInRangeOfLocMatching( 1520, loc, Condition(function CheckWagonFilter) )
loop
set uWagon = FirstOfGroup( g )
exitwhen uWagon == null
set loc1 = GetUnitLoc( uWagon )
if ( UnitCatchGunFire( loc, rAngle, loc1, locVH ) ) then
set rHP = GetUnitState( uWagon, UNIT_STATE_LIFE )
if ( rHP <= 25 ) then
call KillUnit( uWagon )
else
call SetUnitState( uWagon, UNIT_STATE_LIFE, rHP - 25 )
set effShoot = AddSpecialEffectTarget( "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl", uWagon, "chest" )
call DestroyEffect( effShoot )
set effShoot = AddSpecialEffectTarget( "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl", uWagon, "chest" )
call DestroyEffect( effShoot )
endif
endif
call RemoveLocation( loc1 )
call GroupRemoveUnit( g, uWagon )
endloop
call DestroyGroup( g )
call MoveLocation( locVH, -1, -1 )
loop
exitwhen nPlayerIndex >= 8
set bContinue = false
if ( nPlayerIndex != nPlayerSelf and udg_Carts[nPlayerIndex] != null and IsUnitAliveBJ( udg_Carts[nPlayerIndex] ) ) then
set bContinue = true
endif
if ( bContinue and IsCartVulnerable( udg_Carts[nPlayerIndex] ) ) then
set bContinue = false
set loc1 = GetUnitLoc( udg_Carts[nPlayerIndex] )
set bContinue = UnitCatchGunFire( loc, rAngle, loc1, locVH )
call RemoveLocation( loc1 )
if ( bContinue ) then
set nPlayerTarget = nPlayerIndex
endif
endif
set nPlayerIndex = nPlayerIndex + 1
endloop
if ( nPlayerTarget >= 0 ) then
set rHP = GetUnitState( udg_Carts[nPlayerTarget], UNIT_STATE_LIFE )
if ( rHP <= 25 ) then
call KillUnit( udg_Carts[nPlayerTarget] )
else
call SetUnitState( udg_Carts[nPlayerTarget], UNIT_STATE_LIFE, rHP - 25 )
set effShoot = AddSpecialEffectTarget( "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl", udg_Carts[nPlayerTarget], "chest" )
call DestroyEffect( effShoot )
set effShoot = AddSpecialEffectTarget( "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl", udg_Carts[nPlayerTarget], "chest" )
call DestroyEffect( effShoot )
endif
else
set loc1 = PolarProjectionBJ( loc, 1450, rAngle )
set effShoot = AddSpecialEffectLoc( "Abilities\\Weapons\\GyroCopter\\GyroCopterImpact.mdl", loc1 )
call RemoveLocation( loc1 )
call DestroyEffect( effShoot )
endif
call RemoveLocation( loc )
call RemoveLocation( locVH )
endfunction |
| 04-09-2005, 05:11 PM | #5 |
thnx a ton, thats exactly what i needed, rep shall be rewarded! |
