• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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