HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

collision missile set tag?

10-26-2007, 12:27 AM#1
waaaks
collision missile set tag...what does it do?
10-26-2007, 12:47 PM#2
Vexorian
It is like the units' custom data.
10-26-2007, 11:57 PM#3
waaaks
ah ok....

heres another annoying problem that rips my body half

remember that you helped me making collision missile spell to work?
yeah that works in my demo map

but when i tried to make another one, in that map, it didnt give me some errors, but it doesnt work ingame....so i deleted that spell

but when i tried to import the working collision missile spell into another map, it doesnt work like making a new one...im very proud of this :(

looks like newgen has the problem because last time i was using 3d, and the other version like 3e and now 3g, the spell doesnt work, just my opinion though, and i dont know if newgen is the problem

could you look at the trigger again?

This doesnt work

Collapse JASS:
scope Missile

globals
    private constant integer SPELL_ID  = 'A003' //Rawcode for spell
    private constant integer DUMMY_ID  = 'A004' //Rawcode for dummy spell
    private constant string  ORDER_ID  = "thunderbolt" //order id of the dummy spell
    private constant string  SFX       = "Abilities\\Spells\\Other\\FrostBolt\\FrostBoltMissile.mdl" //missile effect
    private constant real    COLLISION = 400.0 //collision size of the missile
    private constant real    SPEED     = 1000.0 //missile speed
    private constant real    RANGE     = 1000.0 //missile max range
    private constant real    Z_OFFSET  = 50.0 //missile's flying height
    private constant real    SCALE     = 5.0 //missile's scaling
endglobals

private struct missiledata
    unit castingunit
endstruct


private function Impact takes nothing returns nothing
 local unit targ = GetTriggerUnit()
 local unit m = GetTriggerCollisionMissile()
 local missiledata D= missiledata( CollisionMissile_GetTag(GetTriggerCollisionMissile()) )
 local location loc
 local location loc2
 local location loc3
 local integer l
 local integer dopt

    if(targ==null) then
        call D.destroy()
        return
    endif
    set loc  = GetUnitLoc(D.castingunit)
    set loc2 = GetUnitLoc(targ)
    set loc3 = GetUnitLoc(m)
    call SetUnitScale(m, SCALE, SCALE, SCALE)
    call CasterSetCastSourceLoc(loc3)
    call CasterSetRecycleDelay(3.00) 
    set l = GetUnitAbilityLevel( D.castingunit, SPELL_ID )
    if IsUnitEnemy(targ, GetOwningPlayer(D.castingunit)) and IsUnitAliveBJ(targ) then
       call CasterCastAbilityLevel(GetOwningPlayer(D.castingunit), DUMMY_ID, l, ORDER_ID, targ, false ) 
    endif
    call RemoveLocation(loc)
    call RemoveLocation(loc2)

 set loc = null
 set loc2 = null
 set targ = null  
endfunction

private function Start takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local missiledata D = missiledata.create()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local real face = AngleBetweenPoints(loc1, loc2)
 local unit m

     set D.castingunit = cast
     set m=CollisionMissile_CreateLoc( SFX, loc1, face, SPEED, 0, RANGE, Z_OFFSET, false, COLLISION, function Impact )
     call CollisionMissile_SetTag(m , integer(D) )

 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set cast = null 
 set m=null
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
 call OnAbilityEffect( SPELL_ID, SCOPE_PRIVATE+"Start" )
endfunction

endscope

same as this spell

Collapse JASS:
scope EtherealDagger

globals
    private constant integer EDSPELL_ID   = 'A006' //Rawcode for ethereal dagger
    private constant real    EDRANGE      = 1000.0 //max range of spell
    private constant real    EDCOLLISION  = 300.0  //collision size of the spell
    private constant real    EDSPEED      = 1000.0 //missile's speed
    private constant real    EDZ_OFFSET   = 50.0   //flying height of missile
    private constant real    EDSCALE      = 6.0    //scaling of missile
    private constant real    EDDMG        = 50.0   //heal or damage per level
    private constant string  EDSFX        = "Abilities\\Weapons\\BloodElfMissile\\BloodElfMissile.mdl" //missile model
    private constant string  EDSFX1       = "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile.mdl"  //enemy sfx when hit
    private constant string  EDSFX2       = "Abilities\\Spells\\Human\\Resurrect\\ResurrectTarget.mdl" //ally sfx when hit
endglobals

private struct data
    unit caster
endstruct

private function EDImpact takes nothing returns nothing
 local unit targ = GetTriggerUnit()
 local unit m = GetTriggerCollisionMissile()
 local data E= data(CollisionMissile_GetTag(GetTriggerCollisionMissile()))
 local location loc
 local location loc2
 local integer l
  if (targ==null) then
   call E.destroy()
   return
  endif
  set loc = GetUnitLoc(E.caster)
  set loc2 = GetUnitLoc(targ)
  call SetUnitScale(m, EDSCALE, EDSCALE, EDSCALE)
  set l = GetUnitAbilityLevel(E.caster, EDSPELL_ID)
  if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == true and IsUnitAliveBJ(targ) == true then
   call UnitDamageTargetBJ(E.caster, targ, l*EDDMG, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL)
   call DestroyEffect(AddSpecialEffectLoc(EDSFX1, loc2))
  else
   if IsUnitEnemy(targ, GetOwningPlayer(E.caster)) == false and IsUnitAliveBJ(targ) == true then
    call SetUnitLifeBJ( targ, ( GetUnitStateSwap(UNIT_STATE_LIFE, targ) + ( l * EDDMG ) ) )
    call DestroyEffect(AddSpecialEffectLoc(EDSFX2, loc2))
   endif
  endif
  call RemoveLocation(loc)
  call RemoveLocation(loc2)
  set loc = null
  set loc2 = null
  set targ = null
endfunction

private function EDStart takes nothing returns nothing
 local unit cast = GetTriggerUnit()
 local data E= data.create()
 local location loc1 = GetUnitLoc(cast)
 local location loc2 = GetSpellTargetLoc()
 local real face = AngleBetweenPoints(loc1, loc2)
 local unit m
 set E.caster = cast
 set m = CollisionMissile_CreateLoc(EDSFX, loc1, face, EDSPEED, 0.0, EDRANGE, EDZ_OFFSET, false, EDCOLLISION, function EDImpact)
 call CollisionMissile_SetTag(m, integer(E))
 call RemoveLocation(loc1)
 call RemoveLocation(loc2)
 set loc1 = null
 set loc2 = null
 set cast = null
 set m = null  
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    call OnAbilityEffect(EDSPELL_ID, SCOPE_PRIVATE+"EDStart")
endfunction

endscope

thanks in advance
10-27-2007, 02:27 AM#4
Toink
Did you even import the dummy unit and the model?
Na import mo ba yung dummy pati yung model?

And no, I didn't use any translator. I live in the same country as you are.
10-27-2007, 04:31 AM#5
waaaks
ok i got it working....the problem is about the scope thingy...i entirely removed the scope, privates, and public functions, and now working correctly...

any opinion why?

Toink
lol
pinoy ka pala...
naka register ka sa thehelper no?

add kita yahoo messenger ok?
10-28-2007, 02:18 PM#6
Vexorian
Could it be that the trigger was not named "EtherealDagger" ?
10-28-2007, 04:18 PM#7
Toink
Maybe it's because you use SCOPE_PREFIX+"EDStart" when the EDStart function is renamed to EtherealDagger01(or any random number)_EDStart

So the result is you do this:

call OnAbilityEffect(YourAbil,"EtherealDagger_EtherealDagger01_EDStart")
Quote:
Originally Posted by waaks
Toink
lol
pinoy ka pala...
naka register ka sa thehelper no?

add kita yahoo messenger ok?

Eww, why would I even want to visit thehelper? It's an infestation of elitist noobs XP
10-28-2007, 04:34 PM#8
Vexorian
If the problem was with a wrong argument given to OnAbilityEffect, the spell would crash, not just not work.