Complex Trigger Help

ProjectVenus

New Member
Reaction score
0
I am working on a map for WCIII: ROC and am having trouble telling the game, "a unit owned by any player is attacked"
I have the rest of the trigger set up, but I need to have the event for the conditions and actions to apply. If I can't find out a way to tell the game the event, then I'll have to copy paste the trigger and make an event for each player, which is going to take up more space than I'd like and take up too much of my time because I need to set up an inverse trigger for this trigger.

Here is exactly what the trigger does:

"a unit owned by any player is attacked"

(( Life of (attacked unit)) Less than or equal to 1200.00) and ((Unit-type of (attacked unit)) Equal to Wheat)

Unit-change ownership of (attacked unit) to (owner of attacking unit)) and change color

If ((owner of (attacking unit)) equal to player 1 (red)) then do (Set incomered = (incomered+10)) then do (set incomered2 = (incomered2+20)) else do nothing.

This last action is repeated for every player.

Then I will have an inverse trigger for each player(not just player 1) that states:

A unit owned by player 1(red) is attacked

(( Life of (attacked unit)) Less than or equal to 1200.00) and ((Unit-type of (attacked unit)) Equal to Wheat)

set incomered = (incomered-10)
set incomered2 = (incomered2-20)

Please help, I need to know how to tell the game, "a unit owned by any player is attacked"
 

ProjectVenus

New Member
Reaction score
0
In addition...

triggerhelp.jpg


here is a picture showing what I currently have.

The map is called, "Colonial Front", it is a a mod for WCIII: ROC where players colonize new land for their home countries and vie for power amongst each other.
 

tommerbob

Minecraft. :D
Reaction score
110
First of all, you can copy+paste your trigger as text, instead of posting it as a pic. :)

In TFT there is an Event called "Unit - A unit is attacked"

Does ROC not have that event?

EDIT: You can also clean up your trigger by putting it into a loop.
 

Curo

Why am I still playing this game...?
Reaction score
109
I would store the owner of attacking unit in a variable (TempPlayer), and have the income variable be an array. That way you could do set income[player number of TempPlayer]. Instead of incomered, you would have income[1], income[2] instead of incomeblue, etc.

Although it may seem a bit more confusing, you could even skip the TempPlayer thing and just do:
set income[player number of (owner of (attacking unit))]
 

ProjectVenus

New Member
Reaction score
0
First of all, you can copy+paste your trigger as text, instead of posting it as a pic. :)

In TFT there is an Event called "Unit - A unit is attacked"

Does ROC not have that event?

EDIT: You can also clean up your trigger by putting it into a loop.

No, ROC does not have that. It is a massive inconvenience.
If you could give me an example of how to put this in a loop, that'd be great. I just recently got back into map making and I am experimenting with new, more efficient means of using triggers, so any help would likely improve my success exponentially.
 

ProjectVenus

New Member
Reaction score
0
I would store the owner of attacking unit in a variable (TempPlayer), and have the income variable be an array. That way you could do set income[player number of TempPlayer]. Instead of incomered, you would have income[1], income[2] instead of incomeblue, etc.

Although it may seem a bit more confusing, you could even skip the TempPlayer thing and just do:
set income[player number of (owner of (attacking unit))]

Could you give me a complete diagram of this, it'd be easier for me to assess and understand what you are communicating if I had the actual trigger as it would be in the world editor to analyze.

Also, this is ROC, so I might not have some of the functions you have.
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
Could you give me a complete diagram of this, it'd be easier for me to assess and understand what you are communicating if I had the actual trigger as it would be in the world editor to analyze.

Also, this is ROC, so I might not have some of the functions you have.

Why use RoC? Why not TFT?
 

ProjectVenus

New Member
Reaction score
0
Why use RoC? Why not TFT?
Um..because I don't have TFT? Duh? Why else would I not use TFT....
I have the cd, but lost the CD key and the process for getting another CD key is so long, it costs 10 bucks, I might as well purchase TFT again, but I haven't gotten around to doing so, so until then, this is all I got.
 

Curo

Why am I still playing this game...?
Reaction score
109
Sorry, I'm not going to accommodate your laziness/cheapness. I am not going to uninstall my wc3 to find out what you can and cannot do in RoC. I'd post the trigger, but you say RoC doesn't have the unit is attacked event, so there would be no point. Good luck!
 

ProjectVenus

New Member
Reaction score
0
Sorry, I'm not going to accommodate your laziness/cheapness. I am not going to uninstall my wc3 to find out what you can and cannot do in RoC. I'd post the trigger, but you say RoC doesn't have the unit is attacked event, so there would be no point. Good luck!
It doesnt have the "any unit is attacked" function, but it does have the "a unit owned by playerx is attacked"
I'm not quite sure how I am lazy for asking for help on something I don't understand, but okay.
 

Curo

Why am I still playing this game...?
Reaction score
109
It doesnt have the "any unit is attacked" function, but it does have the "a unit owned by playerx is attacked"
I'm not quite sure how I am lazy for asking for help on something I don't understand, but okay.

The laziness remark was referring to you not buying TFT :p

If it has the event you just listed, then add an event for a unit being attacked by each player to the trigger.

So let me teach you about arrays here. Let's look at your income variables for now (and not the income2 ones). You have 12 of these, incomered, incomeblue, etc. Now I'm going to give you a handy way to condense these into just one variable, rather than 12, using arrays. In case you don't know, if you check off the array checkbox when creating a variable, it will let you assign multiple numbers to your variable. So for instance, say you have an array size of 12, you would then be able to have 12 different income variables within one variable. They would appear as income[1], income[2], etc. Now the handy thing about players is that each player has a number (red = 1, blue = 2, etc). So, instead of referencing the colours, you can reference the numbers. Now do you see where I'm going? incomered becomes income[1], incomeblue becomes income[2], etc. In using this, you can refer to each player in the trigger. Before you would have to use an if-then statement to point to the correct player, but now all you have to do is refer to the player number. You can convert a player number to an integer, so now we can have a function like this: income[(player number of red)]. We can go a step further and talk about income[(player number of (triggering player))] or even income[(player number of (owner of (attacked unit)))].

So to summarize:
  • Have 12 events, one for each player
  • Replace your 12 income variables with the income[x] array
  • Use the line set income[(player number of (owner of (attacked unit))) = ... in your trigger to eliminate excess code
 

ProjectVenus

New Member
Reaction score
0
The laziness remark was referring to you not buying TFT :p

If it has the event you just listed, then add an event for a unit being attacked by each player to the trigger.

So let me teach you about arrays here. Let's look at your income variables for now (and not the income2 ones). You have 12 of these, incomered, incomeblue, etc. Now I'm going to give you a handy way to condense these into just one variable, rather than 12, using arrays. In case you don't know, if you check off the array checkbox when creating a variable, it will let you assign multiple numbers to your variable. So for instance, say you have an array size of 12, you would then be able to have 12 different income variables within one variable. They would appear as income[1], income[2], etc. Now the handy thing about players is that each player has a number (red = 1, blue = 2, etc). So, instead of referencing the colours, you can reference the numbers. Now do you see where I'm going? incomered becomes income[1], incomeblue becomes income[2], etc. In using this, you can refer to each player in the trigger. Before you would have to use an if-then statement to point to the correct player, but now all you have to do is refer to the player number. You can convert a player number to an integer, so now we can have a function like this: income[(player number of red). We can go a step further and talk about income[(player number of (triggering player)) or even income[(player number of (owner of (attacked unit)))].

So to summarize:
  • Have 12 events, one for each player
  • Replace your 12 income variables with the income[x] array
  • Use the line set income[(player number of (owner of (attacked unit))) = ... in your trigger to eliminate excess code
Thanks :D I'll be sure to use this.
 

Curo

Why am I still playing this game...?
Reaction score
109
Yeah, I was afraid I'd have to do that for each individual player. Arg

That's not a problem. You still only need one trigger. Put all 12 events in the same trigger, and it will effectively trigger when any player's unit is attacked.

And don't double post. Go back and edit your old post before someone -rep's you.
 

ProjectVenus

New Member
Reaction score
0
That's not a problem. You still only need one trigger. Put all 12 events in the same trigger, and it will effectively trigger when any player's unit is attacked.

And don't double post. Go back and edit your old post before someone -rep's you.

I just did this, and it works perfectly. Thanks! I can put everything I need for resource capturing in a single trigger by using array triggers with if/then/else actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top