'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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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