Tutorial Creating Realistic Projectiles With The Particle System (W.I.P.)

L

Leafs

Guest
That line of code is checking the grenade conditions. To be put simply, it makes it so every time you cast an ability, it runs the conditions which makes sure the ability being cast is your throw grenade.

And could you post your full trigger so I can try to help with the error?
 

oscarheights

New Member
Reaction score
0
Code:
function Trig_ThrowGrenade_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Trig_ThrowGrenade_Actions takes nothing returns nothing
local location casterpos = GetUnitLoc(GetSpellAbilityUnit())
local location topos = GetSpellTargetLoc()
local unit u = CreateParticle(GetOwningPlayer(GetSpellAbilityUnit()),'e000',GetLocationX(casterpos),GetLocationY(casterpos),GetUnitFacing(GetSpellAbilityUnit()))
call ParticleSetSpeed(u,GetLocationX(topos)-GetLocationX(casterpos),GetLocationY(topos)-GetLocationY(casterpos),1200)
call ParticleLinkConditionTrigger2Func(u, ParticleGroundHit(), "GroundHit_Bounce")
call ParticleLinkConditionTrigger2Func(u, ParticleDeath(), "Death_Remove")
call ParticleAddForce(u, G())
call RemoveLocation(casterpos)
call RemoveLocation(topos)
set casterpos=null
set topos=null
set u = null
endfunction

//===========================================================================
function InitTrig_ThrowGrenade takes nothing returns nothing
    set gg_trg_ThrowGrenade = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_ThrowGrenade, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_ThrowGrenade, Condition( function Trig_ThrowGrenade_Conditions ) )
    call TriggerAddAction( gg_trg_ThrowGrenade, function Trig_ThrowGrenade_Actions )
endfunction

This is my trigger, it is also pretty much what has been posted throughout this topic isn't it?
So this is my trigger named ThrowGrenade and the rest of the stuff was supposed to be in the Map Header, correct?

Edit: BAM FOUND THE PROBLEM! =) my function that should have been called Trig_ThrowGrenade_Conditions was simply named ThrowGrenade_Conditions.

Ok, but now that I test my map I see that when I cast the spell, the grenade is spawned at my caster- but just stays there until dead. When it dies, there is no explosion.
 
L

Leafs

Guest
1337D00D described how to add an explosion effect in the main post.
And for the damage, something along the lines of:
Generic Unit Event - A unit dies
Condition - Dying unit is equal to: "Dummy grenade unit here"
Actions - Order dying unit to damage circular area after 0 seconds of radius (however large you want it here) at position of dying unit, dealing (however much damage you want here).

(And thanks for the response Chocobo, hope I don't screw something up ^.^)
 

oscarheights

New Member
Reaction score
0
Yes I think I have those functions. I took everything that I was told to copy over into the map straight in the map header. I have no triggers but the ThrowGrenade one. Is this right? That is how I reduced my errors from hundreds to 1 so I assumed I was in the right track.
 
L

Leafs

Guest
Heh, no.
You should have copied the ParticleMain and the Particle Supplement Functions triggers and the GUI one that places the variables. Once you paste in the GUI trigger, you can delete it. I'm guessing you got errors in the ParticleMain and PSF because you didn't copy the variables, but if that's not it, then I'm not sure.

And with the projectiles.
I added the function groundhit_bounce instead of Death_Remove, but when the projectile hits a wall it simply flies straight up... I was wonder how I'd make it reflect from the wall. Kind of like the laser in Elimination Tournament.
 

Chocobo

White-Flower
Reaction score
409
And with the projectiles.
I added the function groundhit_bounce instead of Death_Remove, but when the projectile hits a wall it simply flies straight up... I was wonder how I'd make it reflect from the wall. Kind of like the laser in Elimination Tournament.

Change angle of the laser.
 

oscarheights

New Member
Reaction score
0
You should have copied the ParticleMain and the Particle Supplement Functions triggers and the GUI one that places the variables. Once you paste in the GUI trigger, you can delete it. I'm guessing you got errors in the ParticleMain and PSF because you didn't copy the variables, but if that's not it, then I'm not sure.

I did copy the variables with that create variables from copied triggers thing checked off. So, I should have 3 triggers? : ThrowGrenade, ParticleMain and the Particle Suppliment one?

Well I think fiddled around with it a little more and discovered something perplexing to me. When I use the spell, a grenade is created at the position of the caster that does nothing until dead- however fog of war is revealed as if there was a grenade being thrown that had a sight range but there is nothing there. And if I throw it at myself I take damage.
 
L

Leafs

Guest
Set your grenade dummy unit's sight radius to 0 and then set the area revealed for the far sight to 0 as well.
 
L

Leafs

Guest
You didn't use the dummy unit that came with the system... Did you? You have to create one of your own with the model you want, then change the dummy unit raw code in the trigger you made.
 

oscarheights

New Member
Reaction score
0
Yikes, that must have been it or something of that nature- I just replaced my dummy with a normal peasent for testing purposes and it worked perfectly. Thank you so much for your help :) guess I'm not the sharpest tool in the shed after all.
 
L

Leafs

Guest
Nah, there's alot to take in at once, and it's easy to miss minor details. Glad I could be of help.
 
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