• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[System Help] SetProjectileTarget

Status
Not open for further replies.
Level 2
Joined
Nov 7, 2007
Messages
8
Ok In the Particle system by HINDYhat and I want to use the following method "method SetProjectileTarget takes unit target, real speed, boolean staticHeight returns nothing" and make a spell like:
For example: A unit shots a ball that seeks the targeted unit (hyding or adding the Aloc ability to the caster) and when the ball encounters the targeted unit the caster will move instantly to this one (unhyding or removing the Aloc from the caster). The target should be only an ally/friend and the ball have to use the aforementioned funtion for moving of course
JASS:
// In this trigger, I will try to explain how to use the basics of this system...
// Look at the "Trig_How_To_Use_Actions" function first:
//*******************************************************************************

function Trig_How_To_Use_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000' // Checking if the casted ability is "Shoot"
endfunction

function Therequestedfunction takes nothing returns nothing
    call function
endfunction

function Trig_How_To_Use_Actions takes nothing returns nothing
    local unit caster=GetTriggerUnit() // Getting the caster for further reference.
    local unit target=GetSpellTargetUnit()    local particle ball=particle.CreateProjectile(GetOwningPlayer(caster),"Abilities\\Weapons\\AncientProtectorMissile\\AncientProtectorMissile.mdl",GetUnitX(caster),GetUnitY(caster),0.,GetUnitFacing(caster))
    // Above^^: Will create a projectile (particle) at the position of the casting unit with a rock as the model
    
    
    // First things first, we will add the gravity and collision parameters to the projectile:
    call ball.AddGravity() // Whenever we call a function that uses a particle, we use "call varname.functionName()"
    call ball.SetCollisions( 128.0 , 64.0 , 0.7 , 0.7 ) // The particle will have a height of 128, radius of 64, and friction/bounciness both set to 0.7
    call ball.SetCollisionFunc("Therequestedfunction")
0    call ball.SetProjectileTarget(target, 500 , true)
    //method SetProjectileTarget takes unit target, real speed, boolean staticHeight re//This wturns nothing
   
    // Removing memory leaks.
    set caster=null
    set target=null
endfunction

//===========================================================================
function InitTrig_How_To_Use takes nothing returns nothing
    set gg_trg_How_To_Use = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_How_To_Use, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_How_To_Use, Condition( function Trig_How_To_Use_Conditions ) )
    call TriggerAddAction( gg_trg_How_To_Use, function Trig_How_To_Use_Actions )
endfunction
Heres the example
Thx in advance
 
Status
Not open for further replies.
Top