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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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