• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Difficult Problem (this is not like the other i posted, it is the next level in J

Status
Not open for further replies.
Level 40
Joined
Dec 14, 2005
Messages
10,532
Blarg, my last post had a few typo thingees

Anyways, try making the loop this;

JASS:
        loop
            call TriggerSleepAction(0.5)
            loop
                set u = FirstOfGroup(ng)
                exitwhen u == null or not b
                set b = RectContainsUnit(gg_rct_p1_workers_start,u)
                call GroupAddUnit(ng2, u)
                call GroupRemoveUnit(ng, u)
            endloop
            call DestroyGroup(g)
            set ng = ng2
            exitwhen b
            set ng2 = CreateGroup()
        endloop

Also, try moving call KillUnit(gate) to after the loop.
 
Okidoki, i will see what i can do.

EDIT: Done, i will test the map now.

Well, new script:
JASS:
function army_acts takes nothing returns nothing
    local integer P1 = 0 
    local unit t = GetTrainedUnit()
    local rect m = gg_rct_Region_033
    local group g = CreateGroup()
    local unit f
    local location p = Location(GetRectCenterX(gg_rct_p1_workers_start), GetRectCenterY(gg_rct_p1_workers_start))
    local player pg = Player(5)
    local player p1 = Player(0) 
    local unit gate
    local effect ef
    local integer mi = 1
    local integer ri = 1
    local unit h1
    local unit array m1
    local unit array r1
    local boolean b = true
    local unit u
    local group ng = CreateGroup()
    local group ng2 = CreateGroup()  
    call GroupAddUnit(udg_UT[P1], t)
    set t = null
    if CountUnitsInGroup(udg_UT[P1]) == 20 then 
        set h1 = CreateUnit(pg, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set gate = CreateUnit( pg, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", GetRectCenterX(m), GetRectCenterY(m))  
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(p1) + "|r and his alliance !!!!! " ) ) )
        call CameraSetTargetNoiseEx(10, 500000, true)
        call CameraSetSourceNoiseEx(10, 500000, true)
        call GroupEnumUnitsInRect(udg_UT[P1], m, null)      
        loop 
            exitwhen mi > 4
            set m1[mi] = CreateUnit(pg, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)
            set mi = mi +1
        endloop      
        loop 
            exitwhen  ri > 4
            set r1[ri] = CreateUnit(pg, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)    
            set ri = ri +1
        endloop      
        loop
            set f = FirstOfGroup(g)
            exitwhen f == null
            call IssuePointOrder(f, "attack", GetRectCenterX(m), GetRectCenterY(m))
            call GroupRemoveUnit(g, f)
        endloop
        call DestroyEffect(ef)
        loop 
            call TriggerSleepAction(0.5)
            loop
                set u = FirstOfGroup(ng)
                exitwhen u == null or not b
                set b = RectContainsUnit(gg_rct_p1_workers_start,u)
                call GroupAddUnit(ng2, u)
                call GroupRemoveUnit(ng, u)
            endloop
            call DestroyGroup(g)
            set ng = ng2
            exitwhen b
            set ng2 = CreateGroup()
        endloop     
        set mi = 0
        loop
            exitwhen mi > 4
            call SetUnitOwner(m1[mi], p1, true)
            set mi = mi +1
        endloop
        set ri = 0
        loop 
            exitwhen ri > 4
            call SetUnitOwner(r1[ri], p1, true)
            set ri = ri + 1
        endloop
        call SetUnitOwner(h1, p1, true)
        call CameraSetTargetNoiseEx(0, 0, true)
        call CameraSetSourceNoiseEx(0, 0, true)
        call RemoveRect(m)
        call RemoveLocation(p)
        call DestroyGroup(ng)
        set gate = null
        set ef = null
        set m = null
        set p = null
        set m1[mi] = null
        set r1[ri] = null
        set h1 = null
        set pg = null
        set p1 = null
        set g = null
        call DestroyTrigger(GetTriggeringTrigger())
    endif
endfunction
//===========================================================================
function InitTrig_Army_P1 takes nothing returns nothing
    local trigger army = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)
    call TriggerAddAction( army, function army_acts )
    set army = null
endfunction

Good news:
1 - the gate is created

Bad news:
1 - i did the required changes and still i have a critical error that shuts down the application ...

=s help !!!
 
Last edited by a moderator:
Level 40
Joined
Dec 14, 2005
Messages
10,532
You forgot to kill the gate after the wait! (not the cause of the crash)

Fixed a little leak of yours and did some other tweaks. If it still crashes, try replacing DestroyTrigger with DisableTrigger.

JASS:
function army_acts takes nothing returns nothing
    local integer P1 = 0 
    local unit t = GetTrainedUnit()
    local rect m = gg_rct_Region_033
    local group g = CreateGroup()
    local unit f
    local location p = Location(GetRectCenterX(gg_rct_p1_workers_start), GetRectCenterY(gg_rct_p1_workers_start))
    local player pg = Player(5)
    local player p1 = Player(0) 
    local unit gate
    local effect ef
    local integer mi = 1
    local integer ri = 1
    local unit h1
    local unit array m1
    local unit array r1
    local boolean b = true
    local unit u
    local group ng = CreateGroup()
    local group ng2 = CreateGroup()  
    call GroupAddUnit(udg_UT[P1], t)
    set t = null
    if CountUnitsInGroup(udg_UT[P1]) == 20 then 
        set h1 = CreateUnit(pg, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set gate = CreateUnit( pg, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", GetRectCenterX(m), GetRectCenterY(m))  
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(p1) + "|r and his alliance !!!!! " ) ) )
        call CameraSetTargetNoiseEx(10, 500000, true)
        call CameraSetSourceNoiseEx(10, 500000, true)
        call GroupEnumUnitsInRect(udg_UT[P1], m, null)      
        loop 
            exitwhen mi > 4
            set m1[mi] = CreateUnit(pg, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)
            set mi = mi +1
        endloop      
        loop 
            exitwhen  ri > 4
            set r1[ri] = CreateUnit(pg, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)    
            set ri = ri +1
        endloop      
        loop
            set f = FirstOfGroup(g)
            exitwhen f == null
            call IssuePointOrder(f, "attack", GetRectCenterX(m), GetRectCenterY(m))
            call GroupRemoveUnit(g, f)
        endloop
        call DestroyEffect(ef)
        loop 
            call TriggerSleepAction(0.5)
            loop
                set u = FirstOfGroup(ng)
                exitwhen u == null or not b
                set b = RectContainsUnit(gg_rct_p1_workers_start,u)
                call GroupAddUnit(ng2, u)
                call GroupRemoveUnit(ng, u)
            endloop
            call DestroyGroup(ng)
            set ng = ng2
            exitwhen b
            set ng2 = CreateGroup()
        endloop     
        set mi = 0
        loop
            exitwhen mi > 4
            call SetUnitOwner(m1[mi], p1, true)
            set m1[mi] = null
            set mi = mi +1
        endloop
        set ri = 0
        loop 
            exitwhen ri > 4
            call SetUnitOwner(r1[ri], p1, true)
            set r1[ri] = null
            set ri = ri + 1
        endloop
        call KillUnit(gate)
        call SetUnitOwner(h1, p1, true)
        call CameraSetTargetNoiseEx(0, 0, true)
        call CameraSetSourceNoiseEx(0, 0, true)
        call RemoveRect(m)
        call RemoveLocation(p)
        call DestroyGroup(ng)
        call DestroyTrigger(GetTriggeringTrigger())
    endif
    set gate = null
    set ef = null
    set m = null
    set p = null
    set h1 = null
    set pg = null
    set p1 = null
    set g = null
endfunction

function InitTrig_Army_P1 takes nothing returns nothing
    local trigger army = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)
    call TriggerAddAction( army, function army_acts )
    set army = null
endfunction
 
Well, i did did all you asked me to .. both ways didn't work .. still after testing them i decided to do some changes myself:

JASS:
globals 
    rect gg_rct_Region_033
    rect gg_rct_p1_workers_start
    group array udg_UT 
endglobals   
function army_acts takes nothing returns nothing  
    local integer P1 = 0 
    local unit t = GetTrainedUnit()  
    local rect m = gg_rct_Region_033 
    local group g = CreateGroup()  
    local unit f 
    local rect p = gg_rct_p1_workers_start
    local player pg = Player(5)  
    local player p1 = Player(0)  
    local unit gate 
    local effect ef 
    local integer mi = 1 
    local integer ri = 1 
    local unit h1 
    local unit array m1 
    local unit array r1 
    local boolean b = true  
    local unit u 
    local group ng = CreateGroup()  
    local group ng2 = CreateGroup()  
    call GroupAddUnit(udg_UT[P1], t)  
    set t = null  
    if CountUnitsInGroup(udg_UT[P1]) == 20 then  
        set h1 = CreateUnit(pg, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
        set gate = CreateUnit( pg, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)  
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", GetRectCenterX(m), GetRectCenterY(m))  
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(p1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        call GroupEnumUnitsInRect(udg_UT[P1], m, null)  
        loop  
            exitwhen mi > 4 
            set m1[mi] = CreateUnit(pg, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
            set mi = mi +1 
        endloop  
        loop  
            exitwhen ri > 4 
            set r1[ri] = CreateUnit(pg, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
            set ri = ri +1 
        endloop  
        loop  
            set f = FirstOfGroup(g)  
            exitwhen f == null  
            call IssuePointOrder(f, "attack", GetRectCenterX(p), GetRectCenterY(p))  
            call GroupRemoveUnit(g, f)  
        endloop  
        call DestroyEffect(ef)  
        loop  
            call TriggerSleepAction(0.5)  
            loop  
                set u = FirstOfGroup(ng)  
                exitwhen u == null or not b 
                set b = RectContainsUnit(gg_rct_p1_workers_start,u)  
                call GroupAddUnit(ng2, u)  
                call GroupRemoveUnit(ng, u)  
            endloop  
            call DestroyGroup(ng)  
            set ng = ng2 
            exitwhen b 
            set ng2 = CreateGroup()  
        endloop  
        set mi = 0 
        loop  
            exitwhen mi > 4 
            call SetUnitOwner(m1[mi], p1, true)  
            set m1[mi] = null  
            set mi = mi +1 
        endloop  
            set ri = 0 
        loop  
            exitwhen ri > 4 
            call SetUnitOwner(r1[ri], p1, true)  
            set r1[ri] = null  
            set ri = ri + 1 
        endloop  
        call KillUnit(gate)  
        call SetUnitOwner(h1, p1, true)  
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        call RemoveRect(m)  
        call RemoveRect(p)  
        call DestroyGroup(ng)  
        call DisableTrigger( GetTriggeringTrigger() )  
    endif  
    set gate = null  
    set ef = null  
    set m = null  
    set p = null  
    set h1 = null  
    set pg = null  
    set p1 = null  
    set g = null 
endfunction 
function InitTrig_Army_P1 takes nothing returns nothing  
    local trigger army = CreateTrigger()  
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
    call TriggerAddAction( army, function army_acts )  
    set army = null 
endfunction


Changes:
1 - Changed location (p) to a rect so units can mpve to unit.
2 - Also corrected the order attack move, now units are created in "m" and ordered to move to "p".

Problems:
1 - The gate is not created (again).
2 - The units don't move.
3 - When the units are created, i get their ownership immediately (which is bad, they should belong to player(5) and when they get to rect p their ownership should change).
4 - Game still crashes ... but i am working on it and i may have found the reason, but don't know yet.

Help !?
 
Last edited by a moderator:
Ok, i did the changes you requested.

JASS:
function army_acts takes nothing returns nothing  
    local integer P1 = 0 
    local unit t = GetTrainedUnit()  
    local rect m = gg_rct_Region_033 
    local group g = CreateGroup()  
    local unit f 
    local rect p = gg_rct_p1_workers_start
    local player pg = Player(5)  
    local player p1 = Player(0)  
    local unit gate 
    local effect ef 
    local integer mi = 1 
    local integer ri = 1 
    local unit h1 
    local unit array m1 
    local unit array r1 
    local boolean b = true  
    local unit u 
    local group ng = CreateGroup()  
    local group ng2 = CreateGroup()  
    call GroupAddUnit(udg_UT[P1], t)  
    set t = null  
    if CountUnitsInGroup(udg_UT[P1]) == 20 then  
        set h1 = CreateUnit(pg, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
        set gate = CreateUnit( pg, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)  
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportTo.mdl", GetRectCenterX(m), GetRectCenterY(m))  
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(p1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        call GroupEnumUnitsInRect(udg_UT[P1], m, null)  
        loop  
            exitwhen mi > 4 
            set m1[mi] = CreateUnit(pg, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
            set mi = mi +1 
        endloop  
        loop  
            exitwhen ri > 4 
            set r1[ri] = CreateUnit(pg, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
            set ri = ri +1 
        endloop  
        loop  
            set f = FirstOfGroup(g)  
            exitwhen f == null  
            call IssuePointOrder(f, "attack", GetRectCenterX(p), GetRectCenterY(p))  
            call GroupRemoveUnit(g, f)  
        endloop  
        call DestroyEffect(ef)  
        loop  
            call GroupAddUnit(ng, m1[mi])
            call GroupAddUnit(ng, r1[ri])
            call TriggerSleepAction(0.5)  
            loop  
                set u = FirstOfGroup(ng)  
                exitwhen u == null or not b 
                set b = RectContainsUnit(gg_rct_p1_workers_start,u)  
                call GroupAddUnit(ng2, u)  
                call GroupRemoveUnit(ng, u)  
            endloop  
            call DestroyGroup(ng)  
            set ng = ng2 
            exitwhen b 
            set ng2 = CreateGroup()  
        endloop  
        set mi = 0 
        loop  
            exitwhen mi > 4 
            call SetUnitOwner(m1[mi], p1, true)  
            set m1[mi] = null  
            set mi = mi +1 
        endloop  
            set ri = 0 
        loop  
            exitwhen ri > 4 
            call SetUnitOwner(r1[ri], p1, true)  
            set r1[ri] = null  
            set ri = ri + 1 
        endloop
        call GroupRemoveUnit(ng, m1[mi])
        call GroupRemoveUnit(ng, r1[ri])  
        call KillUnit(gate)  
        call SetUnitOwner(h1, p1, true)  
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        call RemoveRect(m)  
        call RemoveRect(p)  
        call DestroyGroup(ng)  
        call DisableTrigger( GetTriggeringTrigger() )  
    endif  
    set gate = null  
    set ef = null  
    set m = null  
    set p = null  
    set h1 = null  
    set pg = null  
    set p1 = null  
    set g = null 
endfunction 
function InitTrig_Army_P1 takes nothing returns nothing  
    local trigger army = CreateTrigger()  
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
    call TriggerAddAction( army, function army_acts )  
    set army = null 
endfunction

The problem was NOT solved =s
 
AAARRGGHHH MY own system annoys me greatly !!!!!
I know why the game crashes .... the game crashes when i SELECT the units ....
ya, if i don't select them, there is no problem .... arrghh! why !!!
And PurplePoot i am remaking all the system. I will soon post here a long a not very efficient script for player one. I will ask your help to improve its quality, once it is done.

And, i saved the system we were working together on, in case i need it.

EDIT I DID IT !!! MUHAHHAHHAHAAHAH AFTER WEEKS OF HEAD HAKES TRYING TO FIND WHAT WAS WRONG WITH MY SYSTEM !!! NOW IT WORKS !!!! and the best part is that i created it in about 5 minutes ..... ya that is stupid ... so many months trying to do it and now i just make it .... 5 mins .... ARRRGHHHHH

New system:

JASS:
globals 
    rect gg_rct_Region_033
    rect gg_rct_p1_workers_start
    group array udg_UT 
endglobals
//====================================================
function army_acts takes nothing returns nothing  
    local player P1 = Player(0)
    local player P6 = Player(5) 
    local unit gate
    local rect m = gg_rct_Region_033  
    local rect p = gg_rct_p1_workers_start
    local effect ef 
    local unit m1
    local unit m2
    local unit m3
    local unit m4 
    local unit r1
    local unit r2
    local unit r3
    local unit r4 
    local unit h1 
    local unit t = GetTrainedUnit()
    call GroupAddUnit(udg_UT[0], t)
    set t = null  
    if CountUnitsInGroup(udg_UT[0]) == 20 then
        set gate = CreateUnit( P6, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)
        call TriggerSleepAction(2.00)
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        set h1 = CreateUnit(P6, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90.00)  
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", GetRectCenterX(m), GetRectCenterY(m))
        set m1 = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00) 
        set m2 = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set m3 = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set m4 = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set r1 = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00) 
        set r2 = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set r3 = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        set r4 = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90.00)
        call TriggerSleepAction(2.00)
        call IssuePointOrder(m1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m2, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m3, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m4, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r2, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r3, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r4, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(h1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call TriggerSleepAction(10.00)
        call SetUnitOwner(m1, P1, true) 
        call SetUnitOwner(m2, P1, true)
        call SetUnitOwner(m3, P1, true)
        call SetUnitOwner(m4, P1, true)
        call SetUnitOwner(r1, P1, true)
        call SetUnitOwner(r2, P1, true)
        call SetUnitOwner(r3, P1, true)
        call SetUnitOwner(r4, P1, true)
        call SetUnitOwner(h1, P1, true)
        call KillUnit(gate)
        call DestroyEffect(ef)
        call IssuePointOrder(m1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m2, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m3, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(m4, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r2, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r3, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(r4, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call IssuePointOrder(h1, "attack", GetRectCenterX(p), GetRectCenterY(p))
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        set gate = null
        set ef = null
        set m1 = null
        set m2 = null
        set m3 = null
        set m4 = null
        set r1 = null
        set r2 = null
        set r3 = null
        set r4 = null
        set h1 = null
        set P1 = null
        set P1 = null
    endif
endfunction
//===============================================================
function InitTrig_Army_P1 takes nothing returns nothing  
    local trigger army = CreateTrigger()  
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
    call TriggerAddAction( army, function army_acts )  
    set army = null 
endfunction

LOOOL Well, the system DOES work, finally. However it is very complicated for the computer as you can see ... I would like to improve it now if possible. This is the Player 1 part. I believe now the work will be much easier because the spell does work, and i only need help to improve it =).
Any suggestions ????

You may wonder about some things, like, why i give the order 2 times. I do that because when a unit changes it's owner it cancels all it's orders, thus making me giving them again. =)
now plz if you have more question, ask them to me as i want to explain stuff to you because i need to improve this =P

unbelievable ... 1,5 months think on this crazy system ... and 1 night in 5 mins ... the world is upside down ...
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
Toyed with it a bit, try this out

JASS:
globals 
    rect gg_rct_Region_033
    rect gg_rct_p1_workers_start
    group array udg_UT 
endglobals

function army_acts_unit takes nothing returns nothing
    local unit u = bj_ghoul[100]
    call TriggerSleepAction(2)
    call IssuePointOrder(u,"attack",GetRectCenterX(gg_rct_p1_workers_start),GetRectCenterY(gg_rct_p1_workers_start))
    call TriggerSleepAction(10)
    call SetUnitOwner(u,Player(0),true)
    call IssuePointOrder(u,"attack",GetRectCenterX(gg_rct_p1_workers_start),GetRectCenterY(gg_rct_p1_workers_start))
    //the last IssuePointOrder may be redundant, just CnPing your script though
    set u = null
endfunction

function army_acts takes nothing returns nothing  
    local player P1 = Player(0)
    local player P6 = Player(5) 
    local unit gate
    local rect m = gg_rct_Region_033  
    local rect p = gg_rct_p1_workers_start
    local effect ef
    local unit t = GetTrainedUnit()
    call GroupAddUnit(udg_UT[0], t)
    set t = null  
    if CountUnitsInGroup(udg_UT[0]) == 20 then
        set gate = CreateUnit( P6, 'hprt', GetRectCenterX(m), GetRectCenterY(m), 270.0)
        call TriggerSleepAction(2.00)
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid " + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        set ef = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", GetRectCenterX(m), GetRectCenterY(m))
        set bj_ghoul[100] = CreateUnit(P6, 'H015', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit")
        set bj_ghoul[100] = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'h014', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit")  
        set bj_ghoul[100] = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        set bj_ghoul[100] = CreateUnit(P6, 'hrif', GetRectCenterX(m), GetRectCenterY(m), 90)
        call ExecuteFunc("army_acts_unit") 
        call TriggerSleepAction(12)
        call KillUnit(gate)
        call DestroyEffect(ef)
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        set gate = null
        set ef = null
    endif
    set P1 = null
    set P6 = null
endfunction
//===============================================================
function InitTrig_Army_P1 takes nothing returns nothing  
    local trigger army = CreateTrigger()  
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
    call TriggerAddAction( army, function army_acts )  
    set army = null 
endfunction
 
NOOOOOOOOOO.... dr.SuperGood took 2 rep points away from me =( because he says i double posted on this section ... Not fair ... i needed to do so and when i have time i delete old posts !!!! His action really is a sword into my heart ... I already sent him a message saying i am sorry, asking for reasons and telling him about my opinion ... ... =( Not fair ... BlackDoom gave me those rep points !!! They meant so much to me ... =(



Anyway =( about the spell i will test it now.

EDIT: Well, mmm your scrip didn nothing new ... or wermmm it did, it caused the system not to create 4 units, the m1 units. And ... that's all ...

What was supposed to happen ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
There was no reason to multi post many times. The edit button functions properly and you did it atleast 3 times. We do allow bumping but only after 48 hours from last post so thoughs posts did not validate for it. We also have various tags and stuff that can act as a break thus there is no need to double post to make breaks in your text.
 
Ya, still is not fair to punish for something i did 3 weeks ago, when i DIDN'T know i could use the edit button !!!!!

If you check my recent posts, ask PurplePoot, ask Wolverabid, low_kwaliti and BlackDoom, ask them if i double post now !!!!

Anyway, what can i do now??? i Told you i could delete my posts if you want ... But i am different now and i don't think you are doing a correct action .... If you want to punish me, than you should have punished me 3 weeks ago and not now .... because it means that my efforts to stop double posting were no useful ...

Please considerate the fact that i am having a good behaviour in the last 3 weeks, thus according to the rules, i can have my points back ....

I think i already sent you 2 e-mails explaining the situation ... Is there anything i can do have those points back ??? I am really trying to give my best to the community .... right now i am improving an Archian's tutorial with the help of Wolfrabid .... I am working in a tutorial that is not mine in order to help THW... please what else can i do ????

It is not fair when i am trying to help you guys so hard and still get punished for doing so ...



About the script PurplePoot, i found out the problem .. the rawcode "h014" shoulb be "h00B", if you change that, it will work, sry this one was my fault =S ...the changes you did were they supposed to reduce lag or something ???

that ghoul[100] stuff, creates 100 ghouls !? Because i didn't see any =S

Btw, why is your script better than mine ?? i would like to understand the changes if possible plz, because i want to learn =P
 
Last edited:
Level 13
Joined
Nov 22, 2006
Messages
1,260
NOOOOOOOOOO.... dr.SuperGood took 2 rep points away from me =( because he says i double posted on this section ... Not fair ... i needed to do so and when i have time i delete old posts !!!! His action really is a sword into my heart ... I already sent him a message saying i am sorry, asking for reasons and telling him about my opinion ... ... =( Not fair ... BlackDoom gave me those rep points !!! They meant so much to me ... =(

DSG acts illogically sometimes, but I don't question his acts, he's doing it for our own good. Though I don't understand why didn't he give me a negative rep somewhere, I posted some posts that I'm not proud of (I hope he won't give me a neg rep now saying something like "you asked for it")

How long will this thread go, I wonder......

JASS:
function InitTrig_Army_P1 takes nothing returns nothing
    local trigger army = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)
    call TriggerAddAction( army, function army_acts )
    set army = null
endfunction


Hehe, I like to remove those spacings too... :)

And my I ask why are you using a local trigger instead of a global one Pooty? It just has more limitations.....
 
Guys i have a new problem with my system. Now that SOME of the major difficulties are finally solved i can spice my system a little bit, if you understand what i mean. I have a problem with polarprojection again ... This is the line in cause:

JASS:
 call IssuePointOrder(h1, "attack", GetUnitX(h1)+ 100*Cos(270*3.14159/180.0),GetUnitY(h1)+ 100*Sin(270*3.14159/180.0))

As you can see i order the stupid unit to attack-move to the position but the nit doesnt even move .... yeah i know i did something wrong ... but what ?
 
ARRGGHH it just doesn't work ... or maybe i am doing something wrong...

JASS:
set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1) - (GetUnitDefaultMoveSpeed(h1)*0.5 )))
        call IssuePointOrder(h1, "attack", GetUnitX(h1)+ 100*Cos(270*3.14159/180.0),GetUnitY(h1)+Sin(270*3.14159/180.0)-100)
        call TriggerSleepAction (1.00)

Here is a portion of my script which has become larger now.
here is when i tell the unit to move so the problem is here ...
I just can't find the answer ...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Alright, Flame_Phoenix. Cos and Sin just turn angles into a slope, representing that angle. They're just getting the direction your 100 should point.

However, with those values, instead of saying

X of Unit + 100 * Cos(val), Y of Unit + 100 * Sin(val)

We can precalculate them, and find

X of Unit, Y of Unit + 100

is the same thing.
 
Well it still doesn't work ....

JASS:
 set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrder(h1, "attack", GetUnitX(h1),GetUnitY(h1)+100)
        call TriggerSleepAction (1.00)

kinda ...... if that is not the problem then where the hell is it ??
thx for help ... i may use regions now ...
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
I'm not sure what you exactly want because I just came, but I think you wanted this:

call IssuePointOrder(h1, "attack", GetUnitX(h1) + 100 * Cos(something),GetUnitY(h1)+100 * Sin(something))?

And Pooty, you're a living tutorial for this guy. You're helping him in like 6 pages! :p

EDIT: Whooops, I didn't see this:

Pooty said:
X of Unit, Y of Unit + 100
 
mmm well... what can i say...

First, the movement speed thing is fine, it works properly. All other units of the army have that "call" and they all walk slower (was i want). The commander (the issued unit) would also walk ok, if not by the direction.

The gate also works fine now ... the borns and dies exactly when i want ... I will in future try to reduce it's death animation to 40% of it's original speed, but for now it is ok.

I will post the entire script here, and i will point the section of it where i have questions.

JASS:
globals 
    rect gg_rct_Region_033
    rect gg_rct_Region_034
    rect gg_rct_Region_035
    rect gg_rct_Region_036
    rect gg_rct_Region_037
    rect gg_rct_Region_038
    rect gg_rct_Region_039
    group array udg_UT 
endglobals
//====================================================
function army_acts takes nothing returns nothing  
    local player P1 = Player(0)
    local player P6 = Player(5) 
    local unit gate
    local rect g = gg_rct_Region_033  
    local rect u1 = gg_rct_Region_034
    local rect u2 = gg_rct_Region_035
    local rect u3 = gg_rct_Region_036
    local rect u4 = gg_rct_Region_037
    local rect uh1 = gg_rct_Region_038
    local rect d1 = gg_rct_Region_039
    local unit ef1
    local unit ef2
    local unit ef3
    local unit ef4
    local unit ef5
    local unit ef6
    local unit ef7
    local unit ef8
    local unit ef9
    local unit m1
    local unit m2
    local unit m3
    local unit m4 
    local unit r1
    local unit r2
    local unit r3
    local unit r4 
    local unit h1 
    local unit t = GetTrainedUnit()
    call GroupAddUnit(udg_UT[0], t)
    set t = null  
    if CountUnitsInGroup(udg_UT[0]) == 20 then
        // Here i create the gate
        set gate = CreateUnit( P6, 'hprt', GetRectCenterX(g), GetRectCenterY(g), 270.0)
        call TriggerSleepAction(2.00)
        // I wait 2 secs and start shacking the camera and display the text
        call DisplayTextToForce (bj_FORCE_ALL_PLAYERS, ( "The First Northrend Army arrived to aid |cffff0000" + ( GetPlayerName(P1) + "|r and his alliance !!!!! " ) ) )  
        call CameraSetTargetNoiseEx(10, 500000, true)  
        call CameraSetSourceNoiseEx(10, 500000, true)  
        //============================================ the hero (h1)
        set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrder(h1, "attack", GetUnitX(h1),GetUnitY(h1)+100)
        call TriggerSleepAction (1.00)
        // end of orders for now. 
        // Here i create the hero in a region. the ef1 is a dummy unit
        // the dummy unit is the scroll of town portal effect which lasts 
        // 1-2 seconds. It must be a unit to be bigger than the effect.
        //After that i change the hero's movement speed
        // And after i give the order to the lLocation(problem here)
        //I wait 1 second, for eye candy =)
        //===============================================================
        // Here i create the rest of the army (m[i] = melle units; r[i] ranged units)
        // this section will be totally completed once i found all problems
        set m1 = CreateUnit(P6, 'h00B', GetRectCenterX(u1), GetRectCenterY(u1), 270.00) 
        set ef2 = CreateUnit(P6, 'h01B', GetRectCenterX(u1), GetRectCenterY(u1), 0.00)
        call UnitApplyTimedLife(ef2, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1) - (GetUnitDefaultMoveSpeed(m1)*0.5 )))
        set m2 = CreateUnit(P6, 'h00B', GetRectCenterX(u2), GetRectCenterY(u2), 270.00) 
        set ef3 = CreateUnit(P6, 'h01B', GetRectCenterX(u2), GetRectCenterY(u2), 0.00)
        call UnitApplyTimedLife(ef3, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2) - (GetUnitDefaultMoveSpeed(m2)*0.5 )))
        set m3 = CreateUnit(P6, 'h00B', GetRectCenterX(u3), GetRectCenterY(u3), 270.00) 
        set ef4 = CreateUnit(P6, 'h01B', GetRectCenterX(u3), GetRectCenterY(u3), 0.00)
        call UnitApplyTimedLife(ef4, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) - (GetUnitDefaultMoveSpeed(m3)*0.5 )))
        set m4 = CreateUnit(P6, 'h00B', GetRectCenterX(u4), GetRectCenterY(u4), 270.00) 
        set ef5 = CreateUnit(P6, 'h01B', GetRectCenterX(u4), GetRectCenterY(u4), 0.00)
        call UnitApplyTimedLife(ef5, 'BTLF', 1.00)
        call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) - (GetUnitDefaultMoveSpeed(m4)*0.5 )))
        call IssuePointOrder(m1, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(m2, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(m3, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(m4, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call TriggerSleepAction(1.00)
        set r1 = CreateUnit(P6, 'hrif', GetRectCenterX(u1), GetRectCenterY(u1), 270.00) 
        set ef6 = CreateUnit(P6, 'h01B', GetRectCenterX(u1), GetRectCenterY(u1), 0.00)
        call UnitApplyTimedLife(ef6, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1) - (GetUnitDefaultMoveSpeed(r1)*0.5 )))
        set r2 = CreateUnit(P6, 'hrif', GetRectCenterX(u2), GetRectCenterY(u2), 270.00) 
        set ef7 = CreateUnit(P6, 'h01B', GetRectCenterX(u2), GetRectCenterY(u2), 0.00)
        call UnitApplyTimedLife(ef7, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2) - (GetUnitDefaultMoveSpeed(r2)*0.5 )))
        set r3 = CreateUnit(P6, 'hrif', GetRectCenterX(u3), GetRectCenterY(u3), 270.00) 
        set ef8 = CreateUnit(P6, 'h01B', GetRectCenterX(u3), GetRectCenterY(u3), 0.00)
        call UnitApplyTimedLife(ef8, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3) - (GetUnitDefaultMoveSpeed(r3)*0.5 )))
        set r4 = CreateUnit(P6, 'hrif', GetRectCenterX(u4), GetRectCenterY(u4), 270.00) 
        set ef9 = CreateUnit(P6, 'h01B', GetRectCenterX(u4), GetRectCenterY(u4), 0.00)
        call UnitApplyTimedLife(ef9, 'BTLF', 1.00)
        call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4) - (GetUnitDefaultMoveSpeed(r4)*0.5 )))
        call IssuePointOrder(r1, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(r2, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(r3, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call IssuePointOrder(r4, "attack", GetRectCenterX(d1), GetRectCenterY(d1))
        call TriggerSleepAction(7.00)
        call SetUnitOwner(m1, P1, true) 
        call SetUnitOwner(m2, P1, true)
        call SetUnitOwner(m3, P1, true)
        call SetUnitOwner(m4, P1, true)
        call SetUnitOwner(r1, P1, true)
        call SetUnitOwner(r2, P1, true)
        call SetUnitOwner(r3, P1, true)
        call SetUnitOwner(r4, P1, true)
        call SetUnitOwner(h1, P1, true)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)))
        call SetUnitMoveSpeed( m1, ( GetUnitDefaultMoveSpeed(m1) ))
        call SetUnitMoveSpeed( m2, ( GetUnitDefaultMoveSpeed(m2) ))
        call SetUnitMoveSpeed( m3, ( GetUnitDefaultMoveSpeed(m3) ))
        call SetUnitMoveSpeed( m4, ( GetUnitDefaultMoveSpeed(m4) ))
        call SetUnitMoveSpeed( r1, ( GetUnitDefaultMoveSpeed(r1) ))
        call SetUnitMoveSpeed( r2, ( GetUnitDefaultMoveSpeed(r2) ))
        call SetUnitMoveSpeed( r3, ( GetUnitDefaultMoveSpeed(r3) ))
        call SetUnitMoveSpeed( r4, ( GetUnitDefaultMoveSpeed(r4) ))
        call KillUnit(gate)
        call CameraSetTargetNoiseEx(0, 0, true)  
        call CameraSetSourceNoiseEx(0, 0, true)  
        set gate = null
        set ef1 = null
        set ef2 = null
        set ef3 = null
        set ef4 = null
        set ef5 = null
        set ef6 = null
        set ef7 = null
        set ef8 = null
        set ef9 = null
        set m1 = null
        set m2 = null
        set m3 = null
        set m4 = null
        set r1 = null
        set r2 = null
        set r3 = null
        set r4 = null
        set h1 = null
        set P1 = null
        set P6 = null
    endif
endfunction
//===============================================================
function InitTrig_Army_P1 takes nothing returns nothing  
    local trigger army = CreateTrigger()  
    call TriggerRegisterPlayerUnitEvent(army, Player(0), EVENT_PLAYER_UNIT_TRAIN_FINISH, null)  
    call TriggerAddAction( army, function army_acts )  
    set army = null 
endfunction

I know i can change the unti's movement speed, and i will do so soon, but now my priority is to find where the loc error is.

Thx for the help.
 
About the ef variable i also considered your tip when i made the system. Problem is that if i change the variable before killing the units, the unit will be in game permanently and will leak, thus forcing me to create several variables.

Location !?
Well, let me explain.

[ ] region where the unit is created
| order to the unit
| ""
point in map i want the unit to move to the point

i can take a screenshot to explain better if you want..
The "picture" explain what a want. I unit is created in a region and i want it to move 100 meters forward.
 
YES !! i was correct !!! i knew the problem was with the order., no1 knows my srcipt better then me lol. After an unexpected brain storm i found how to issue the dam unit to go to where i want =).

But i need your help to optimize the script.

here it is:
JASS:
set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrderLocBJ( h1, "attack", PolarProjectionBJ(GetUnitLoc(h1), 1000.00, 270.00) )
        call TriggerSleepAction (1.00)

Now here i have some optimization with errors ... i tried to do:

JASS:
set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrderLoc(h1, "attack", PolarProjectionBJ(GetUnitX(h1), GetUnitY(h1), 1000.00, 270.00)) 
        call TriggerSleepAction (1.00)

As you can see i tried to removethe BJ's. However i was unable to remove the PolarProjectionBJ and when trying to remove GetUnitloc (because it will leak) i also failed because i can't have GetUnitX(Y), and that is the only way i know how to do i.

I also have another version of optimization (i don't knwo which 1 is the best):
JASS:
set h1 = CreateUnit(P6, 'H015', GetRectCenterX(uh1), GetRectCenterY(uh1), 270.00)
        set ef1 = CreateUnit(P6, 'h01B', GetRectCenterX(uh1), GetRectCenterY(uh1), 0.00)
        call UnitApplyTimedLife(ef1, 'BTLF', 1.00)
        call SetUnitMoveSpeed( h1, ( GetUnitDefaultMoveSpeed(h1)/2))
        call IssuePointOrderLoc( h1, "attack", PolarProjectionBJ( GetUnitX(h1),GetUnitY(h1)+1000)) )
        call TriggerSleepAction (1.00)

Again with some errors. I think that PolarProjection will be my eternal JASS problem ... but that doesn't mean i don't try to figure out how that stupid system works lol.

I am trying hard to see which of these 2 corrections are better (but for now, no1 is, because somehow they all have syntax errors). Please give me a hand on this subject.
 
The problem is that instead of "call IssuePointOrderLoc" i had "call IssuePointOrder" (miss the Loc at the end). Ya, that was the problem.
About PolarProjectionBj, i know it takes a locations, but can i change that ??? i mean, if i use a location, the script will leak and most probably lag.... and i am trying to avoid that ... is there a way out ??

Also i discovered that, with PolarProjectionBJ:
offset = distance i want the unit to make
angle real = direction the unit will take when making the order. This direction is according to the sin, cos and tg circle.

It may seem basic to you guys thhat already know this, but to me, it was an importanat step, before this i didn't knew what those values where suppose to mean =)
 
Level 20
Joined
Apr 22, 2007
Messages
1,960
Um... didn't we already explain polar projections to you?

newx = x + dist*Cos(angle)
newy = y + dist*Sin(angle)
anglebetweenpoints = Atan2(y1-y,x1-x)
If you want the angle to be in the opposite direction, just add 3.14159 to it.

EDIT: So use this line instead. You don't even need to use polar projections since you're just adding 1000 to the y value...
JASS:
call IssuePointOrder( h1, "attack", GetUnitX(h1), GetUnitY(h1) + 1000 )
 
Level 11
Joined
Oct 13, 2005
Messages
233
anglebetweenpoints = Atan2(y1-y,x1-x)
If you want the angle to be in the opposite direction, just add 3.14159 to it.

You should note that this angle is in radians, FP. If you wish to convert it to degrees, simply multiply the angle by bj_RADTODEG. set anglebetweenpoints = bj_RADTODEG * Atan2(y2 - y1, x2 - x1)
This would give you the angle from x1,y1 to x2,y2 in degrees.


Now, I've missed the first 6 pages of the thread, but I'd like to warn you that using SetUnitMoveSpeed can be a bit risky to use if any type of speed increasing/decreasing abilities also affect the unit. The solution would either be to not use SetUnitMoveSpeed or not have the unit affected by any other abilities regarding movespeed.
 
Status
Not open for further replies.
Top