|
|
#1 |
|
User
Join Date: Jan 2007
Posts: 172
|
Im trying to make a Trigger that makes a unit shoot a bullet at an area, and if the bullet collides into a unit then the bullet will disapear and deal damage, like on Elimination Tournament, well this is my first attempt, it works creating the bullet and ordering it, but it doesnt collide into people or deal damage...
__________________Heres the code: JASS:function Trig_Shoot_Conditions takes nothing returns boolean return ( GetSpellAbilityId() == 'A000' ) endfunction function Trig_Shoot_Actions takes nothing returns nothing local unit uu = GetTriggerUnit() local player u = GetOwningPlayer( uu ) local real spawnx = GetLocationX(PolarProjectionBJ(GetUnitLoc(uu), 20.0, GetUnitFacing(uu))) local real spawny = GetLocationY(PolarProjectionBJ(GetUnitLoc(uu), 20.0, GetUnitFacing(uu))) local real gotox = GetLocationX(GetSpellTargetLoc()) local real gotoy = GetLocationY(GetSpellTargetLoc()) local real bulletx local real bullety local real bulletloc local real gotoloc local unit targ set udg_bullet = CreateUnit( u, 'h001', spawnx, spawny, GetUnitFacing(uu)) call IssuePointOrder( udg_bullet, "move", gotox, gotoy ) //===== loop exitwhen bulletloc == gotoloc + 1.0 set udg_collision = GetUnitsInRangeOfLocAll( 20.0, GetUnitLoc(udg_bullet) ) set targ = GroupPickRandomUnit(udg_collision) if bulletloc == gotoloc then call RemoveUnit( udg_bullet ) endif if ( CountUnitsInGroup(udg_collision) >= 1 ) then call UnitDamageTarget( uu, targ, 500.0, false, true, ATTACK_TYPE_PIERCE, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS ) call RemoveUnit(udg_bullet) endif set bulletx = GetUnitX( udg_bullet ) set bullety = GetUnitY( udg_bullet ) set bulletloc = (bulletx + bullety) endloop set uu = null set u = null set targ = null set udg_bullet = null set udg_collision = null endfunction //=========================================================================== function InitTrig_Shoot takes nothing returns nothing set gg_trg_Shoot = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shoot, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Shoot, Condition( function Trig_Shoot_Conditions ) ) call TriggerAddAction( gg_trg_Shoot, function Trig_Shoot_Actions ) endfunction If you could help id appreciate it.. =] |
|
|
|
| Sponsored Links - Login to hide this ad! |
|
|
|
|
#2 |
|
User
Join Date: Dec 2006
Posts: 67
|
You should make it slide forward instead of issuing it an order.
And if you want a premade bullet system, use iNfraNe's particle system. That's the system used in Elimination Tournament. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
|
Donate |