| 05-29-2003, 07:07 PM | #1 |
EXAMPLE (of what I want to happen): 10 peons enter a region. I want to kill those peons and replace it with a footmen. This is what I have for my trigger: Code:
Events: Unit - A unit enters Orc Upgrade 1 <gen> Conditions: (Number of units in(Orc Upgrade 1 <gen>)) Equal to 10 (Unit type of (Entering Unit)) Equal to Peon Actions: Unit - Kill (Triggering unit) Unit - Create 1 Footman for Player 1 (Red) at (Center of Orc Upgrade 1 <gen>) facing (Y of (Center of Orc Upgrade 1 <gen> )) Degrees Before I did not have the condition that the number of units equaled to 10 and it worked. I played around with a lot of things and nothing seemed to work. Telling me why it wont work would be apreciated. |
| 05-29-2003, 07:33 PM | #2 |
It doesn't work, because you only check the type of the entering unit. This means that if there are 9 other units and 1 peon it would also work. If that is not the problem (it might be a problem after you have fixed the other), try to change the "Equal to" to "Greater than or equal to". Your trigger only fires if there are exactly 10 units within this region. I think you intented it to fire also if there are more than 10 units in the location. |
| 05-29-2003, 07:52 PM | #3 |
I'm losing my mind looking at all these triggers.... which do you think I should change, and to what..... P.S. Sorry for n00bish question. |
| 05-29-2003, 07:58 PM | #4 |
What I said the "Equal to" to "Greater than or equal to" (I suppose you make an Integer comparison). The other thing will also be necessary, but it would involve a bit more work (I can't state now what exactly). |
| 05-29-2003, 08:09 PM | #5 |
I changed the "equal to" to "greater than or equal to" when I read your first post... I need helpfinding the trigger that will make the game recognize the 10 peons that enter the region, and then to kill them. |
| 05-29-2003, 08:20 PM | #6 |
Damnit I know theres a way for the game to recognize the triggering unit, as not 1, but 10 units. I'm looking but I cnat seem to find a way to make this. Any help would be appreciated. |
| 05-29-2003, 08:50 PM | #7 |
I think I made a trigger like this a few weeks ago for some one on another web board. I will post it in a few minutes. |
| 05-29-2003, 09:05 PM | #8 |
We need a unit group called PeonToFootman, a region I will call Transform and a Interger Varible called PeonsToFootman. Code:
Trigger 1 Event: Unit - Unit Enters Region; A unit enters Transform Condiction; Unit-Type Comparisen; (Unit-Type of (Entering unit) Equal to Peon Action: Unit Group - Add Unit; Add (Entering Unit) to PeonToFootman Set Varible; Set PeonsToFootman = (PeonsToFootman + 1) Trigger 2 Event: Unit - Unit Leaves Region; A unit leaves Transform Condiction: Unit-Type Comparisen; (Unit-Type of (Leaving Unit) Equal to Peon Action: Unit Group - Remove Unit; Remove (Leaving Unit) from PeonToFootman Set PeonsToFootman = (PeonsToFootman - 1) Trigger3 Event: Unit - Unit Enters Region; A unit enters Transform Condiction: Interger Comparisen; PeonsToFootman Greater than or Equal to 10 Action: Unit - Remove; Remove (Random unit from PeonToFootman) from the game NOTE: Do that trigger a total of 10 times Set Varible; Set PeonsToFootman = (PeonsToFooman - 10) Unit - Create Units Facing Angle; Create 1 Footman for Player 1 at (Center of (Transform) facing default building degrees I belive that would work, I can't find the old trigger. |
| 05-29-2003, 10:07 PM | #9 |
When I'm setting the variable, what variable type do I set it too? Edited because: My bad didnt read throuhgly . |
| 05-29-2003, 10:29 PM | #10 |
Code:
Set Varible; Set PeonsToFootman = (PeonsToFootman + 1) I dont know how to get the "+1" after the PeonstoFootman in the parenthesis. Please explain. |
| 05-29-2003, 10:50 PM | #11 | ||
Quote:
Quote:
I don't know what you don't get. If your asking why do I do PeonsToFootman + 1? That means take what ever PeonsToFootman's value + 1 more. Or are you asking why did I do parenthesis? It shows up like that in the editor. |
| 05-30-2003, 01:02 AM | #12 |
Guest | Just do... Event: Unit enters region PeonsToFootmen Conditions: Number of units in region (PeonsToFootmen) matching condition (Unit-type of (Matching unit) is equal to Peon) is greater that or equal to 10. So that one is under integer comparison -> Number of units in unit group. For the unit group, choose units in region matching condition. Be sure to select matching unit when appropriate. Actions: Unit group - Pick all units in region (PeonsToFootmen) matching condition (Unit-type of (Matching unit) is equal to Peon) and do Kill (Picked unit) Unit - Create 1 Footman at center of PeonsToFootmen |
| 05-30-2003, 06:28 AM | #13 |
Beyond, when you set a varible, you will notice a text that says Value in red, which you can click, click it and select your variable. Now click the + and change it between + - x / + - Add (Ough, I'm not english speaking) - - Subtract x - Multiply / - Divide Then click on how much you'd like to do it with behind. Set Variable: Set Your Variable = 'this is what is listed above' Regards Dead-Inside |
| 05-30-2003, 12:27 PM | #14 |
Guest | I don't see why you're using a variable unit group and variable integer when you can just use the (units in PeonsToFootmen matching (Unit-type is equal to Peon)) group and the number of units in that group. emote_confused |
| 05-30-2003, 01:40 PM | #15 |
:bgrun: Um...why don't you guys just use an "If / Then / Else" action? It is a lot less complicated then unit groups and variables. I'm sure it would look something like this: Event: Unit Enters Region Condition: Entering unit unit-type equal to peon Action: If number of units in region of type peon greater than or equal to 10 then pick every unit matching matching unit is a peon equal to true and kill picked unit else skip remaining actions Create one footman at center of region ____________________________________________________ I'm not sure how to make it pick only 10 peons to kill, but I'm sure you all get the idea. If there aren't at least 10 it'll skip the create a footman action. If there are it kills them and goes ahead with creating the footan. It looks a lot smaller than that whole variable set up. All you have to do now would be to find out how to make it only pick 10 to kill. |
