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

Strike Team... Not Works

Status
Not open for further replies.
Level 4
Joined
Feb 25, 2010
Messages
73
Hello people, I'm trying (of many ways, but none works ._.) to do a Player Computer-Controlled form a Strike Team of units and so send them to attack a certain point.

However, the only thing i could to do is send all Units in a Region (or variable, or whatever) move attack to that direction. I don't want it however, because the faster units will ignore the rest of the group formed (finishing in each unit arriving in the target wanted, one by one). What i want to do is a compact group of units that accompanies the most slower (like when you select multiples units (up to 12) in melee games) and then all get together at the target point.

This is the last trigger i've do only for test:

  • TEST
    • Events
      • Player - Player 1 (Red) types a chat message containing @strike as An exact match
    • Conditions
    • Actions
      • Unit - Create 5 Archer for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Unit - Create 4 Huntress for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Unit - Create 1 Glaive Thrower (Big) for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Selection - Select (Units in StrikeTeamUnison <gen>) for Player 2 (Blue)
      • Unit Group - Order (Units currently selected by Player 2 (Blue)) to Attack-Move To (Center of TwarokkLeadConstruction <gen>)

... The units are created, however, don't move when i type '@strike' =(
Somebody have an idea? :confused:

EDIT: plz tell me if i wasn't clear enough. I tried to be the most clear possible in my question..
 
Level 10
Joined
Mar 31, 2009
Messages
732
/headache

Please repost your question after you learn english.

Try:
  • TEST
    • Events
      • Player - Player 1 (Red) types a chat message containing @strike as An exact match
    • Conditions
    • Actions
      • Unit - Create 5 Archer for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Unit - Create 4 Huntress for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Unit - Create 1 Glaive Thrower (Big) for Player 2 (Blue) at (Center of StrikeTeamUnison <gen>) facing Default building facing degrees
      • Trigger - Wait 1 second
      • Selection - Select (Units in StrikeTeamUnison <gen>) for Player 2 (Blue)
      • Unit Group - Order (Units currently selected by Player 2 (Blue)) to Attack-Move To (Center of TwarokkLeadConstruction <gen>)
 
Level 4
Joined
Feb 25, 2010
Messages
73
Sorry about anything. How you can see, english is not my mother language.
But thanks anyway, i will test now.


EDIT: nope, it didn't worked... the units yet don't move...
 
I don't get it why you order the currently selected units, when those units are already referred via the Units in StrikeTeamUnison <gen> part.

Here is what you should instead do:
  • Melee Initialization
    • Events
      • Player - Player 1 (Red) types a chat message containing @strike as An exact match
    • Conditions
    • Actions
      • Selection - Clear selection for (Triggering player)
      • Set Point = (Center of Region 001 <gen>)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Actions)
        • Loop - Actions
          • Selection - Add (Picked unit) to selection for (Triggering player)
          • Unit - Order (Picked unit) to Attack-Move To Point
      • Custom script: call RemoveLocation (udg_Point)
In case you wonder for stuff, here is a test-map.
View attachment MoveTo.w3x
 
Level 4
Joined
Feb 25, 2010
Messages
73
I did the part of selection because what i want is a compact group os attack (different units). In my logic this only could be done with the players selecting the units (but of course i was only assuming it ^^').

Like i said before in a example: lets say there is a footman, a peon and a gyrocopter in the initial region. If I do what you did above the Gyrocopter will run and arrive in the final region much before the other units, because it is the faster of the three.

I want the units move until the target region following the slower unit, like when you select 12 different units and send then to a place (if there is a siege weapon together, for example, the movement of ALL group will be slower). Oh, and i want that a Computer Player do it, not me...

I don't know if i was clear... One more time, sorry for my poor english.


EDIT: Anyway, i thanks for try to help. Possibly i will use your trigger and do a second region to regroup all units before they attack. :)
 
Last edited:
Just post that trigger in JASS
He doesn't know how to do that. For someone who doesn't even know what that word means he doesn't have any idea what you're talking about.

For his information, to get the jass code you right-click on the trigger and click "convert to custom script" and click "yes". Copy ALL of the script you see there and paste it here on the forum in
JASS:
 tags.
 
Level 4
Joined
Feb 25, 2010
Messages
73
I do not want to sound stupid but there is no "convert to custom script" option when i right-click on the trigger... Lol... (yeah, there is no option, really.)


Anyway, i'm posting the map... The trigger is 'DEBUG', 'TEST', 'TEST2', these three... Lol
 

Attachments

  • Promised2.w3x
    344.8 KB · Views: 46
In the left window - the libarary of the triggers where you see the triggers like DEBUG, TEST, TEST2, etc. you right-click one of those triggers (the trigger you want) and it will give you a list of options and if there's not an option that says "convert to custom script" then your WC3 is corrupted and you need to uninstall/reinstall the game.
 
Level 4
Joined
Feb 25, 2010
Messages
73
JASS:
function Trig_TEST_Func009A takes nothing returns nothing
    call SelectUnitAddForPlayer( GetEnumUnit(), Player(1) )
    call IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_Regroup1 )
endfunction

function Trig_TEST_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 5, 'earc', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 4, 'esen', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING )
    call CreateNUnitsAtLoc( 1, 'e004', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING )
    call SetUnitPositionLoc( udg_NightShadow, GetRectCenter(gg_rct_StrikeTeamUnison) )
    call TriggerSleepAction( 1.00 )
    call ClearSelectionForPlayer( Player(1) )
    set udg_Regroup1 = GetRectCenter(gg_rct_StrikeTeamRegroup1)
    set bj_wantDestroyGroup = true
    call ForGroupBJ( GetUnitsInRectOfPlayer(gg_rct_StrikeTeamUnison, Player(1)), function Trig_TEST_Func009A )
    call RemoveLocation (udg_Regroup1)
endfunction

//===========================================================================
function InitTrig_TEST takes nothing returns nothing
    set gg_trg_TEST = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_TEST, Player(0), "@strike", true )
    call TriggerAddAction( gg_trg_TEST, function Trig_TEST_Actions )
endfunction


Well, here is it. The options was in the Edit top tab ^^
This trigger is from the TEST trigger. basically i tried to do what Pharaoh did... But with more regions (TEST2, TEST3...).

Yet it didn't work like i want, in the map-example that Pharaoh send me it works normally (units move and stay together in the region).
Strangely, when i addapted to my map, the units go to the region but dont stay: they simply go back to the initial region o_O
 
Level 10
Joined
Mar 31, 2009
Messages
732
Try this:

JASS:
function Trig_TEST_Func009A takes nothing returns nothing
    call SelectUnitAddForPlayer( GetEnumUnit(), Player(1) )
    call IssuePointOrderLocBJ( GetEnumUnit(), "attack", udg_Regroup1 )
endfunction

function Trig_TEST_Actions takes nothing returns nothing
    local group g = CreateNUnitsAtLoc( 5, 'earc', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING )
    set g = GroupAddGroup(CreateNUnitsAtLoc( 4, 'esen', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING ))
    set g = GroupAddGroup(CreateNUnitsAtLoc( 1, 'e004', Player(1), GetRectCenter(gg_rct_StrikeTeamUnison), bj_UNIT_FACING ))
    call TriggerSleepAction( 1.00 )
    set bj_wantDestroyGroup = true
    call ForGroupBJ( g, function Trig_TEST_Func009A )
endfunction

//===========================================================================
function InitTrig_TEST takes nothing returns nothing
    set gg_trg_TEST = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_TEST, Player(0), "@strike", true )
    call TriggerAddAction( gg_trg_TEST, function Trig_TEST_Actions )
endfunction
Its leaky as hell, but if it works I'll clean it up.
 
What Pharaoh_ said is that he didn't understand why the guy wanted these units selected. The guy said he simply "thought" the units needed to be selected, and so he really doesn't care if they are selected or not as long as they move.

Selecting multiple units like that which the player does not own causes weird behavior in the game. I imagine it has to do with why it's not working for him...

So charm this guy up and replace that "add to selection" bit with a UnitAddIndicator for a cool effect.

There is no need for the TriggerSleepAction.
 
Level 10
Joined
Mar 31, 2009
Messages
732
unit - create unit
add last created unit to TempUnitGroup
Unit - create unit
add last created unit to TempUnitGroup
Unit - create unit
add last created unit to TempUnitGroup
pick every unit in TempUnitGroup
order picked unit to attack location (can be X,Y or a point)
Call DestroyGroup(ugd_TempUnitGroup)

Leakless , Jassless.

Essentially what I wrote but in GUI.
 
Level 4
Joined
Feb 25, 2010
Messages
73
@teelo: I tried to use your JASS code, but the WE points 2 errors (Line 311: Invalid arguments, Line 312: Invalid Arguments)...

@best_player_88: We already tried this, but not works like i explained some posts ago...
 
Apparently any non-user player (that includes empty user slots aswell) cannot select units.
You can test it by simply select an unit and then output name of units selected by player.
As I haven't found a solution to the Formation move myself via normal unit groups and orders, I tested a bit around with the AI and atleast that seems to work.

I made it via the AI Manager, exported as script, imported and then run it with triggers. It creates 3 Barracks and from there 2 Footmen, 1 Rifleman and 1 Knight. If complete it will attack enemy. I've set the Riflemans speed to 100 and the other units move as slow as the rifleman.
So my guess would be that you try out the AI manager and get the result you wanted. I can't help you with the AI Manager any further because I never worked with it before.
Anyway see attachment for result.
 

Attachments

  • AIAttackGroup.w3m
    19.9 KB · Views: 20
Level 4
Joined
Feb 25, 2010
Messages
73
Yes! It works exactly as I want! Horray! Really Really Reeeeealy thanks!

But now, only for the purpose of knowledge: i really don't see what did you do differently what i have tried before. Yes, i had tried without the use of "Selection Units for player 2", but yet don't works.


However i can see you add this:

  • AI - Ignore the guard positions of all Player 2 (blue) units
was it so that did not work really?
 
Level 10
Joined
Mar 31, 2009
Messages
732
Player 2 is controlled by a computer. Without that line, it thinks the units are Creeps, and that they're supposed to stay within blah range of where they spawned.
Without that line, it still works, but they turn around and walk back to where they spawned.

On the map as you posted it, the only reason it wasn't working was because you didn't set a location to the point variable Region1. So it was trying to move the units to a "null" location.
 
Level 4
Joined
Feb 25, 2010
Messages
73
Hummm i understand. And the Formation movement don't works before because of it too, right? Anyway, i thanks you one more time and already add rep to all that help in this post :thumbs_up:
 
Status
Not open for further replies.
Top