HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Newb questions about unit groups

02-07-2003, 07:45 PM#1
Guest
A few questions about properly handling units groups:

1) I have made it so when a player controlled unit enters Region X then neutral Unit Group A (Sentry Allies) and hostile unit group B (Satyr Enemies) charge and attack one another. When the Satyrs are defeated I want the remaining Units in Group A to become your allies. Now here is my problem, how do I go about it correctly without making a ton of triggers for each unit remaining in Unit Group A to become your Ally? (note: I have done it by the Event: Unit dies - but it will only allow me to target a specific unit and not a Unit Group. I want to have it so you have to kill all the Units in Group B first before the remaining units in Group A become your allies. Did I lose ya there? =) What command do I need to do to allow such an event to happen?

2) Now, I want to have Unit Group A do nothing if Unit Group B is eradicated before coming to Region X. I added an 'IF Event' to the Map Initialization so that if Unit Group B is dead then Unit Group A does nothing, but it doesn't work and Unit Group A still charges off to fight. What am I doing wrong here?

3) ***Warning: Ultra newb question*** How on Earth do I change the name of a hero unit? Example: I want to use Shandris but I want her name to be something else.. what do I do to change it?

Thanks for your time !

-Sliver
02-07-2003, 08:28 PM#2
Guest
Dear Sliver,

Here are some things that you might try to get your map working properly.

1) I suggest you create a new "Unit-Group" variable for all the units in "Group A" (Sentry Allies). That way, if you ever need to issue orders to that unit group you can simply run a "Pick Every Unit in Unit Group and Do Action" and simply select the variable that you created for that unit group. It will automatically select the group you input as the variable.

2) Now it gets a little complicated. First, count the number of Satyrs that are in this Neutral Hostile Group. Then, create a new trigger and make a new "interger" variable that represents the number of Satyrs.

Next, make a new trigger. The Event for this one should be "Player-Owned Unit Event" and it should look something like "Unit owned by (Neutral Hostile) Dies." This means that whenever ANY Neutral Hostile unit dies this trigger's conditions will be checked.

Next you put a Condition under it saying "Unit-Type of (Dying Unit) equal to Satyr." This means that the Actions in the trigger will only take place when the unit that has been killed is a Satyr. I would also suggest creating a "boolean" variable, something like, "IsGroupAAttackingGroupB" and set it to false initially. This is a variable that will indicate when this particular event is happening. Then set the boolean to true while this event is going on, and turn it back to false when the event is over. So you will have a second condition "Boolean comparison" and check to see if "isIsGroupAAttackingGroupB" is "true".

Now, make your Action to set the "interger" (that you created for the number of units in the group) equal to itself minus one. This is a basic counter and basically counts down everytime a Satyr is killed. However, this trigger only fires when a Satyr, specifically, is killed. It will not count other types of units like Satyr Tricksters or Satyr Shadowdancers.

Now, you want to make a second trigger. This will also use the "Unit owned by (neutral hostile) dies", but the condition will be an "Interger Comparison". You want to check if your interger variable is equal to zero. When the interger is equal to zero, all the Satyrs will have been killed. If it is zero, than order your Unit Group A to do an Action "Unit - Issue order with no target" and tell group a to "Stop", if they are already in action. This trigger can also what turns your event boolean off. So, you'll also want to set your "isIsGroupAAttackingGroupB" to false by using a "Set Variable" command.

3) Open up the Unit Editor under Modules and select "Unit Editor". Find the unit whose name you wish to alter in the directory. Double click on the "Name" field. Enter the new name.

I hope this helps. I don't know what the specifics are of your situation, but based on the circumstances stated in your questions this is how I would deal with the problem. This is, of course, not the only way, so don't feel compelled by any of it.
02-07-2003, 08:43 PM#3
Guest
3) Actually for a hero, you change the proper name. So if you set the proper name to Shandris and the regular name to archer, it will say Shandris (level 1 archer). But Shandris is not a hero so you need to make the base unit a hero and change the stats the way you want them.
02-08-2003, 12:16 AM#4
Guest
...but I finally got it to work after rereading your post a hundred times =p

I found a much simpler way to get it to work, All I had to do was add the condition '(All units of SatyrGroup are dead) to False' to stop the SentryGroup from running off to attack the Satyrs everytime I entered Region X. Added the same Condition for gaining the Sentry units after killing all Satyrs, just changed the value to True.

Thanks for the detailed info anyway because I now understand how to handle integers and variables better after reading your reply!

Thanks for the help!

And thanks to Kodo for the tip on the Hero renaming!

-Sliver