'Minigun' using the particle system (Chocobo, 1337DOOD)

substance

New Member
Reaction score
34
I've been trying to figure this out for a while now. So far I've got pretty much everything down except for making the cone of fire (randomness based off the target point) and getting the attack animation to loop according to how long the effect is. Right now I got it to shoot particles towards a target point repeatdly with collision detection on the particles and all that good stuff, I just need the randomness.

I tried a buncha methods involving the trigger but I think the only way to get it to work is to edit the CreateParticle function but the math there is a bit over my head :/ I'm stumped.
 

Chocobo

White-Flower
Reaction score
409
Taken from Elimination Tournament 1.2 :

Code:
function AddSound takes unit u,string file,integer volume returns sound
local sound s=CreateSound(file,false,true,false,10,10,"")
call SetSoundPitch(s,GetRandomReal(0.75,1.25))
call SetSoundVolume(s,volume)
call SetSoundDistances(s,6000,60000)
call SetSoundDistanceCutoff(s,1000)
call AttachSoundToUnit(s,u)
call StartSound(s)
call KillSoundWhenDone(s)
return s
endfunction

function Collision_DamageMinigun takes nothing returns nothing
local unit c=udg_TUnit
local unit u=GetEnumUnit()
local real r=15
if UnitHasBuffBJ(udg_Hero[GetPlayerId(GetOwningPlayer(u))],'B005') then
set r=r*2
endif
call UnitDamageTarget(u,c,r,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call KillUnit(u)
call AddSound(c,"Sound\\Units\\Combat\\MetalLightSliceFlesh"+I2S(GetRandomInt(1,3))+".wav",32)
call DestroyEffect(AddSpecialEffectTargetUnitBJ("chest",udg_TUnit,"Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl"))
set u=null
endfunction

function Trig_Minigun_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A004'
endfunction
function Trig_Minigun_Timer takes nothing returns nothing
local unit h=I2U(GetStoredInteger(GC(),H2S(GetExpiredTimer()),"caster"))
local integer shotV=GetStoredInteger(GC(),H2S(GetExpiredTimer()),"shotv")
local real x=udg_vectorX[shotV]
local real y=udg_vectorY[shotV]
local real z=udg_vectorZ[shotV]
local real a=Atan2BJ(y,x)
local real aoa=Atan2(z,SquareRoot(x*x+y*y))
local unit u
if x==0 and y==0 then
set a=GetUnitFacing(h)
endif
set u=CreateProjectile(GetOwningPlayer(h),GetAbilityEffectById('A004',EFFECT_TYPE_MISSILE,1),GetUnitX(h),GetUnitY(h),a)
set a=a+GetRandomReal(-10,10)
set aoa=aoa+GetRandomReal(-0.08,0.08)
call ParticleSetSpeed(u,1124*CosBJ(a)*Cos(aoa),1124*SinBJ(a)*Cos(aoa),1124*Sin(aoa))
call ParticleLinkConditionTrigger2Func(u,ParticleGroundHit(),"GroundHit_Remove")
call ParticleLinkConditionTrigger2Func(u,ParticleDeath(),"Death_Remove")
call ParticleLinkConditionTrigger2Func(u,ParticleCollision(),"Collision_DamageMinigun")
call UnitApplyTimedLife(u,'BTLF',0.9)
call AddSound(h,"Units\\Human\\Rifleman\\RiflemanAttack"+I2S(GetRandomInt(1,2))+".wav",96)
call SetUnitAnimation(h,"Attack")
call SetUnitBlendTime(h,0.5)
call TimerStart(GetExpiredTimer(),0.2,false,function Trig_Minigun_Timer)
endfunction
function Trig_Minigun_Actions takes nothing returns nothing
local location l=GetSpellTargetLoc()
local unit h=GetSpellAbilityUnit()
local real x=GetLocationX(l)-GetUnitX(h)
local real y=GetLocationY(l)-GetUnitY(h)
local real z=GetLocationZ(l)-GetZ(GetUnitX(h),GetUnitY(h))
local timer t=I2T(GetStoredInteger(GC(),H2S(h),"multishottimer"))
if t==null then
set t=CreateTimer()
call StoreInteger(GC(),H2S(t),"caster",H2I(GetSpellAbilityUnit()))
call StoreInteger(GC(),H2S(t),"shotv",VectorCreate(x,y,z))
call StoreInteger(GC(),H2S(h),"multishottimer",H2I(t))
endif
call TimerStart(t,0.00,false,function Trig_Minigun_Timer)
call SetUnitTimeScale(h,3.00)
set l=null
set t=null
set h=null
endfunction

[B]function Init takes nothing returns nothing
set gg_trg_Minigun=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Minigun,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Minigun,Condition(function Trig_Minigun_Conditions))
call TriggerAddAction(gg_trg_Minigun,function Trig_Minigun_Actions)
endglobals[/B]

I added the bolded part.

You have to modify things inside.


Code:
function Collision_DamageMinigun takes nothing returns nothing
local unit c=udg_TUnit
local unit u=GetEnumUnit()
local real r=15
[B]if UnitHasBuffBJ(udg_Hero[GetPlayerId(GetOwningPlayer(u))],'B005') then
set r=r*2
endif[/B]
call UnitDamageTarget(u,c,r,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call KillUnit(u)
call AddSound(c,"Sound\\Units\\Combat\\MetalLightSliceFlesh"+I2S(GetRandomInt(1,3))+".wav",32)
call DestroyEffect(AddSpecialEffectTargetUnitBJ("chest",udg_TUnit,"Abilities\\Weapons\\HydraliskImpact\\HydraliskImpact.mdl"))
set u=null
endfunction

Bolded part is for 2x damage.
 

substance

New Member
Reaction score
34
sweet, i'll check it out and report back.

**Ok I have all the needed functions, well all but this 'GC'.

Code:
local unit h=I2U(GetStoredInteger([B]GC()[/B],H2S(GetExpiredTimer()),"caster"))

Not sure where they got this from but I changed it from 'GC()' to 'LocalVars()' and it seems to work fine. Right now its creating a wisp along with the bullet, and there's no end to the attack.. shouldnt be too hard to fix though.

*btw how did u get source to elim?
 

substance

New Member
Reaction score
34
Finished (cept for leaks and fixes).

I THINK I make it alot more simple, I'm not sure why they didnt use handlevars or the 'CreateParticle' function instead of 'CreateProjectile' but meh. Anyway here's my version if anyone cares :

PHP:
function MegaShoot takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit h = GetHandleUnit(t, "caster")
local player howner = GetOwningPlayer(h)
local integer shotV=GetStoredInteger(LocalVars(),H2S(GetExpiredTimer()),"shotv")
local real x=udg_vectorX[shotV]
local real y=udg_vectorY[shotV]
local real z=udg_vectorZ[shotV]
local real a=Atan2BJ(y,x)
local real aoa=Atan2(z,SquareRoot(x*x+y*y))
local unit u

if x==0 and y==0 then
set a=GetUnitFacing(h)
endif

set u=CreateParticle(howner,'e00U',GetUnitX(h),GetUnitY(h),a)
set a=a+GetRandomReal(-15,15)
set aoa=aoa+GetRandomReal(-0.08,0.08)
call ParticleSetSpeed(u,1124*CosBJ(a)*Cos(aoa),1124*SinBJ(a)*Cos(aoa),1124*Sin(aoa))
call ParticleLinkConditionTrigger2Func(u,ParticleGroundHit(),"GroundHit_Remove")
call ParticleLinkConditionTrigger2Func(u,ParticleDeath(),"Death_Remove")
call ParticleLinkConditionTrigger2Func(u,ParticleCollision(),"Collision_DamageMinigun")

call UnitApplyTimedLife(u,'BTLF',0.9)
endfunction


function Trig_Mega_Chaingun_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local location l = GetSpellTargetLoc()
local timer t = CreateTimer()
local real x=GetLocationX(l)-GetUnitX(caster)
local real y=GetLocationY(l)-GetUnitY(caster)
local real z=GetLocationZ(l)-GetZ(GetUnitX(caster),GetUnitY(caster))

call StoreInteger(LocalVars(),H2S(t),"shotv",VectorCreate(x,y,z))
call SetHandleHandle(t, "caster",caster)

call TimerStart(t, .10, true, function MegaShoot)
call TriggerSleepAction(2.80)
call DestroyTimer(t)
call SetUnitAnimation(caster,"Stand")

endfunction

Thanks alot choco! You're awesome =p

Hope you finish those particle tuts.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top