HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Collision Missile hits but no damage!? Wtf..

05-04-2007, 12:32 PM#1
Toink
Collapse JASS:
function GhostShip takes nothing returns nothing
local unit m = GetTriggerCollisionMissile()
local unit t = GetTriggerUnit()
local real dmg = GetAttachedReal(m, "dmg")
local integer opt = DamageTypes(ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)+DamageOnlyEnemies()+DamageException(UNIT_TYPE_STRUCTURE, 0.20)+DamageTrees()
    call BJDebugMsg("Boat Collided!")
    call DamageUnitByOptions(m, t, dmg, opt)
    if GetBooleanAnd(IsUnitAlly(t, GetOwningPlayer(m)) != true, IsUnitType(t, UNIT_TYPE_STRUCTURE) != true) then
        call KnockbackFunctions_KBUnit(t, AngleBetweenPointsXY(GetUnitX(m), GetUnitY(m), GetUnitX(t), GetUnitY(t)), 35, 1, 0.05, true, true)
        call BJDebugMsg("Knocked that mofo back!! :P")
    endif
    set m = null
    set t = null
endfunction

function Trig_Ghost_Ship_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit m
local location ul = GetUnitLoc(u)
local location p = GetSpellTargetLoc()
local real d = DistanceBetweenPoints(ul, p)
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real x2 = GetLocationX(p)
local real y2 = GetLocationY(p)
local real a1 = AngleBetweenPointsXY(x1, y1, x2, y2)
local real a2 = ModuloReal(a1+90, 360)
local real a3 = ModuloReal(a2-90, 360)
local real x3 = ProjectX(x2, d, a3)
local real y3 = ProjectY(y2, d, a3)
local integer i = GetUnitAbilityLevelSwapped('A007', u)
local real dmg = 350+200*i
    call RemoveLocation(p)
    set m = CollisionMissile_Create("units\\creeps\\UndeadDestroyerShip\\UndeadDestroyerShip.mdl", x3, y3, a2, 1000, 0, 1500, 0, true, 200, function GhostShip)
    call SetUnitScalePercent(m, 250, 250, 250)
    call SetUnitVertexColor(m, 255, 255, 255, 75)
    call AttachReal(m, "dmg", dmg)
    call TriggerSleepAction(0.99)
    call CleanAttachedVars(m)
    set m = null
    set u = null
    set ul = null
    set p = null
endfunction

//===========================================================================
function InitTrig_Ghost_Ship takes nothing returns nothing
    call OnAbilityEffect('A007', "Trig_Ghost_Ship_Actions")
endfunction

Ignore the BJDebugMsg's, they're only there for my testing purposes.

Anyway, it sais it collides with a unit, but it doesn't actually damage it.. Any advice or point out to me something that I may have missed?
05-04-2007, 12:50 PM#2
Vexorian
function GhostShip can be called when the collision missiles expires without hiting a unit, add a check for t==null just in case
05-04-2007, 12:51 PM#3
Toink
I know that, but when it hits a unit it shows up a debug msg saying that it hits. But still no damage.
05-04-2007, 01:06 PM#4
Vexorian
Err, I am not sure if the CollisionMissile is actually owned by a player so DamageOnlyEnemies doesn't seem like it.

You'll have to change ownership of the m unit after creating the collision missile.
05-04-2007, 01:08 PM#5
Toink
Not quite sure but I'm pretty sure it shows the "Boat Collided".

I'm gonna test it again, i'm gonna post a screenshot.
05-04-2007, 01:12 PM#6
Vexorian
Quote:
Originally Posted by Vexorian
Err, I am not sure if the CollisionMissile is actually owned by a player so DamageOnlyEnemies doesn't seem like it.

You'll have to change ownership of the m unit after creating the collision missile.
..
05-04-2007, 01:27 PM#7
Toink
Yet how come in the "Spell Failure, Collision Missiles" thread he gets double damage and he didn't change the ownership?

Zoom (requires log in)

Along time ago I used collision missiles and they worked perfectly, even though I didn't set the ownership.
Attached Images
File type: jpgGhost Shit.JPG (72.5 KB)
05-04-2007, 01:30 PM#8
Vexorian
....

Collapse JASS:
function GhostShip takes nothing returns nothing
local unit m = GetTriggerCollisionMissile()
local unit t = GetTriggerUnit()
local real dmg = GetAttachedReal(m, "dmg")
local integer opt = DamageTypes(ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL)+DamageOnlyEnemies()+DamageException(UNIT_TYPE_STRUCTURE, 0.20)+DamageTrees()
    call BJDebugMsg("Boat Collided!")
    call DamageUnitByOptions(m, t, dmg, opt)
    if GetBooleanAnd(IsUnitAlly(t, GetOwningPlayer(m)) != true, IsUnitType(t, UNIT_TYPE_STRUCTURE) != true) then
        call KnockbackFunctions_KBUnit(t, AngleBetweenPointsXY(GetUnitX(m), GetUnitY(m), GetUnitX(t), GetUnitY(t)), 35, 1, 0.05, true, true)
        call BJDebugMsg("Knocked that mofo back!! :P")
    endif
    set m = null
    set t = null
endfunction
05-04-2007, 01:33 PM#9
Toink
Oh shiznit >_<

And I totally overlooked at your post >_<

Well thanks XD I'll spam ur rep again.. But I'll have to spread it first :P
05-04-2007, 10:25 PM#10
TheSecretArts
no offense toink, u seem to have lots of problems...