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

Help with Rally Point Trigger

Status
Not open for further replies.
Level 8
Joined
Jun 26, 2019
Messages
318
Hello all. I need help with Rally Point to be controlled by computer on barracks that is owned by Player 2. I want Player 2 computer to control all barracks on rally point to be set on the region by Player 2 only, after computer Player 2 created new barracks, then make computer Player 2 set all barracks on rally point to be set on the region.

Example:
upload_2019-12-10_0-29-22.png
 
Level 8
Joined
Jun 26, 2019
Messages
318
Yes, but how do I make it for Player 2 only? Because the peasant will create barrack, and then automatically set the barrack to have rally point to be on the region. But, how do I make a unit type "Barrack" that is owned by Player 2? If no unit type and ownership, the trigger will set all barracks on all players to be at same region for rally point.
 
Level 39
Joined
Feb 27, 2007
Messages
5,010
You filter them out in conditions:
  • Events
    • Unit - A unit finishes construction
  • Conditions
    • (Unit type of (Triggering Unit)) equal to Barracks
    • (Owner of (Triggering Unit)) equal to Player 2 (Blue)
  • Actions
    • Unit - Set rally point for (Triggering Unit) to RALLY_LOCATION
Set the RALLY_LOCATION variable on map init and reuse it each time so it doesn't create more memory leaks.
 
Level 8
Joined
Jun 26, 2019
Messages
318
Okay, I have problem. It seems that computer kept dragging all units to the start location for until they are being ordered to attack by AI editor. They won't stay at the rally point. They will be dragged automatically by computer to start location like all computers do.
 
Level 12
Joined
Jun 15, 2016
Messages
472
I don't know, I don't do AI stuff. That's why I tagged Nowow.
You da man

Okay, I have problem. It seems that computer kept dragging all units to the start location for until they are being ordered to attack by AI editor. They won't stay at the rally point. They will be dragged automatically by computer to start location like all computers do.
There's no way to micromanage rally points with the AI. What you do set is a position of a captain widget using this function SetCaptainHome (see more about captains here). It won't really be a rally flag, but the units will be ordered to go to the defense captain's location immediately after spawning, and will go to the location of the attack captain when preparing to attack (you can read more about it in this tutorial, but it's kinda complicated and not entirely necessary).

To insert this function with whatever captain locations you want either move to custom scripts, or preferrably find somewhere you can insert custom script in the AI editor and insert the line:

JASS:
call SetCaptainHome(BOTH_CAPTAINS, rally_point_x, rally_point_y)
 
Status
Not open for further replies.
Top