• 🏆 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!

Missile Trigger

Status
Not open for further replies.
Level 17
Joined
Mar 21, 2011
Messages
1,597
Hi, i'm using Missile by BPower and got a problem with a trigger.
Missile should act like a knockback in this case, but i get an error when saving the map: "m is not a type that allows .syntax"


JASS:
scope Bash initializer Event

    private struct CreateEx extends array
        implement MissileStruct
    endstruct
    
    function Actions takes nothing returns boolean
        local unit u = GetTriggerUnit()
        local real x = GetUnitX(u)
        local real y = GetUnitY(u)
        local real x2 = GetSpellTargetX()
        local real y2 = GetSpellTargetY()
        local real x3
        local real y3
        local real angle = bj_RADTODEG * Atan2(y2 - y, x2 - x)
        local real angle2
        local unit FoG
        local group g = CreateGroup()
        local Missle m
        call GroupEnumUnitsInRange(g, x, y, 225.00, null)
        loop
            set FoG = FirstOfGroup(g)
            exitwhen FoG == null
            call GroupRemoveUnit(g, FoG)
            set x3 = GetUnitX(FoG)
            set y3 = GetUnitY(FoG)
            set angle2 = bj_RADTODEG * Atan2(y3 - y, x3 - x)
            if (angle > angle2 - 40.00) and (angle < angle2 + 40.00) and UnitAlive(FoG) and IsUnitEnemy(FoG, GetTriggerPlayer()) then
                call UnitDamageTarget(u, FoG, 300.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
                set m = Missile.createEx(FoG, x3 + 500*Cos(angle2), y3 + 500*Sin(angle2), 0)
                set m.speed = 15.
                set m.collision = 32
                set m.acceleration = -0.2
                call CreateEx.launch(m)
            endif
        endloop
        call DestroyGroup(g)
        set g = null
        set u = null
        return false
    endfunction
    
    private function Event takes nothing returns nothing
        call RegisterSpellEffectEvent('Absh', function Actions)
    endfunction
    
endscope


what did i do wrong?
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
Your code needs to be inside the struct in which you implemented MissileStruct.

it is just the setup that is not inside the struct, i think thats fine. Here is the example lab for creating a MissileEx

JASS:
scope LAB8 initializer Init


    private struct CreateExExample extends array
        
        private static method onRemove takes Missile missile returns boolean
            call SetUnitFacing(LAB_UNIT[8], missile.angle*bj_RADTODEG + 180.)
            return false
        endmethod
        
        implement MissileStruct

    endstruct
    
    function fireArrow8 takes nothing returns nothing
        local Missile m 
        local real angle = GetUnitFacing(LAB_UNIT[8])*bj_DEGTORAD
        call TriggerSleepAction(.5)
        if UnitAddAbility(LAB_UNIT[8], 'Amrf') then
        endif
        set m           = Missile.createEx(LAB_UNIT[8], GetUnitX(LAB_UNIT[8]) + 500*Cos(angle), GetUnitY(LAB_UNIT[8]) + 500*Sin(angle), 0)
        set m.speed     = 10.
        set m.collision = 32
        set m.curve     = GetRandomReal(-bj_PI/4, bj_PI/4)
        set m.arc       = GetRandomReal(bj_PI/7, bj_PI/2.5)
        call CreateExExample.launch(m)
    endfunction

    //! runtextmacro LAB_MAIN("8", "'Hpal'", "2410", "-700", "90", "\ncreateEx:\nallows to shoot any unit", "4.")
    
endscope
 
Status
Not open for further replies.
Top