Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Won't switch who's turn it is.
Won't switch who's turn it is.
Aug 31 2008, 4:35 pm
By: LooKe  

Aug 31 2008, 4:35 pm LooKe Post #1



Ok so I'm working on a turn based map, but it's not quite working right. The way it works, you take your turn moving/building/attacking and then it gives your units to your ally, and gives the next player his ally's units and some gas to move. I was setting up the triggers, so that after the player runs out of moves (gas) it does all this, but instead it glitches out for some reason and doesn't give them their guys. Another thing to note, when I refer to a trigger as a player 4 trigger, player 4 is really player 7. I also can't figure out a way to detect if a player exists or not, except how I did it at the bottom, if there is a better way let me know. Also some of the triggers are a little weird, because I didn't realize that a switch could be set for player 1 but not player 4. etc.


My Triggers




EDIT:

WHy didn't any of my coding work? I've got BBCode checked...

Post has been edited 2 time(s), last time on Sep 2 2008, 9:36 pm by JB4.



None.

Aug 31 2008, 8:14 pm Echo Post #2



Trigger("All players"){
Conditions:
Always();

Actions:
Comment("Setting Triggers");
Set Switch("1moves horse", clear);
Set Switch("2moves horse", clear);
Set Switch("3moves horse", clear);
Set Switch("4moves horse", clear);
Set Switch("Player 1 turn", set);
Set Switch("Player 2 turn", clear);
Set Switch("Player 3 turn", clear);
Set Switch("Player 4 turn", clear);
Set Switch("1moves normal", set);
Set Switch("2moves normal", set);
Set Switch("3moves normal", set);
Set Switch("4moves normal", set);
Set Switch("player 1 stuff", set);
Set Switch("player 1 money", clear);
Set Switch("player 2 money", clear);
Set Switch("player 3 money", clear);
Set Switch("player 4 money", clear);

That condition isn't fit. Don't use always unless you're making a mass map. You have to use specific conditions to make your triggers work.

Also, I suggest you use death counters because they are better than switches.



None.

Aug 31 2008, 8:31 pm LooKe Post #3



Quote from name:
That condition isn't fit. Don't use always unless you're making a mass map. You have to use specific conditions to make your triggers work.

Would you rather I use, "elapsed time is atleast 0 seconds?

also i have no clue what you mean with death counters.



None.

Aug 31 2008, 8:52 pm rockz Post #4

ᴄʜᴇᴇsᴇ ɪᴛ!

Trigger("Player 8"){
Conditions:
Always();

Actions:
Comment("Setting Triggers");
Set Deaths("Player 8", "1moves horse", Set To, 0);
Set Deaths("Player 8", "2moves horse", Set To, 0);
Set Deaths("Player 8", "3moves horse", Set To, 0);
Set Deaths("Player 8", "4moves horse", Set To, 0);
Set Deaths("Player 8", "Player 1 turn", Set To, 1);
Set Deaths("Player 8", "Player 2 turn", Set To, 0);
Set Deaths("Player 8", "Player 3 turn", Set To, 0);
Set Deaths("Player 8", "Player 4 turn", Set To, 0);
Set Deaths("Player 8", "1moves normal", Set To, 1);
Set Deaths("Player 8", "2moves normal", Set To, 1);
Set Deaths("Player 8", "3moves normal", Set To, 1);
Set Deaths("Player 8", "4moves normal", Set To, 1);
Set Deaths("Player 8", "player 1 stuff", Set To, 1);
Set Deaths("Player 8", "player 1 money", Set To, 0);
Set Deaths("Player 8", "player 2 money", Set To, 0);
Set Deaths("Player 8", "player 3 money", Set To, 0);
Set Deaths("Player 8", "player 4 money", Set To, 0);

Those would be death counters. replace the name of the unit with just the regular name and you don't have to waste strings on renaming the unused unit. Check the wiki for more.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Aug 31 2008, 9:25 pm NudeRaider Post #5

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from name:JB4
Ok so I'm working on a turn based map, but it's not quite working right. The way it works, you take your turn moving/building/attacking and then it gives your units to your ally, and gives the next player his ally's units and some gas to move. I was setting up the triggers, so that after the player runs out of moves (gas) it does all this, but instead it glitches out for some reason and doesn't give them their guys. Another thing to note, when I refer to a trigger as a player 4 trigger, player 4 is really player 7. I also can't figure out a way to detect if a player exists or not, except how I did it at the bottom, if there is a better way let me know. Also some of the triggers are a little weird, because I didn't realize that a switch could be set for player 1 but not player 4. etc.


Collapse Box
For long quoted text pls use the collaps box (like I did) to make your topic easier to read

Also it's a bit much of triggers to go through without any explanation what the triggers are doing.
So I will just give you general answers instead of correcting your triggers.

First of all you should read the wiki and learn how to use Death Counters.
They are invaluable for turn based maps (and any other). Until you've read it, consider death counters to be variables that can be subtracted from, added to or be set. Their value cannot fall below 0 and the maximum exceeds everything you'll ever need.

The trigger that gives the gas and units should look like this: ('my turn' is a death counter variable)

Force 1
Conditions:

Force 1 has suffered at most 0 deaths of 'my turn'
Current Player has gathered at most 0 gas
Actions:
Set deaths of 'my turn' to 1 for Current Player
Set Gas for Current Player to x
Give All units of Force 1 at Anywhere to Current Player
<other actions>
Preserve Trigger


Then the trigger that ends the Current Player's turn: (order is important!)

Force 1
Conditions:

Current Player has suffered at least 1 deaths of 'my turn'
Current Player has gathered at most 0 gas
Actions:
Set deaths of 'my turn' to 0 for Current Player
Preserve Trigger

These 2 triggers simply pass on a "token" which is cleared by Current Player when the gas is depleted.
Triggers are checked player by player, so the next player of that force will now "grab the token" and give all units from the other force members to himself.

To detect if a player is there it's best you preplace a unit for him, create a unit for Current Player, or set a death counter for Current Player and check if it has been placed/set. But my triggers don't need a seperate check for present players, they adapt to the number of players automatically. But be aware that when the active player leaves his units are given to P12, thus screwing the whole system. This problem can be avoided, but I suggest you first set up the basics before we move on. Just tell us when you're ready for the next step. ;)

Also, switches are global. When any player sets a switch, then any other player will detect it as set too.
That's why you should use death counters instead, because every player has his own count.




Aug 31 2008, 11:15 pm Brontobyte Post #6



Quote from Echo
Also, I suggest you use death counters because they are better than switches.

Switches are for Global events and obviously for on/off type settings. Death Counters are more for keeping track of values, and or more player specific data.



None.

Sep 2 2008, 3:55 am LooKe Post #7



Alright so I tried to setup some new triggers, but now they just cycle through giving the units to the next player. Alot of the triggers are just duplicates so there really aren't as many as it seems.

New Triggers




None.

Sep 2 2008, 7:42 am NudeRaider Post #8

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

I just skimmed the triggers and again there's no explanation what trigger serves what purpose.
I am not willing to figure it all out if you are not willing to to at least briefly explain what you're doing.

I've seen you took my triggers and modified them, but I really don't know why there was a need for alteration. Can you explain?
It seems that removing the accumulate gas condition in the 2nd trigger causes the constant giving, but as I haven't fully analyzed it I can't be sure.

Btw. [buildings] is included in [any unit] so there's no need for giving buildings. If you want to exclude certain special units like khaydarin crystals, psi emitters, etc. then you can give [buildings] and [men].
[any unit] = everything you can place in the unit layer of your editor
[buildings] = obviously every building, most of them can be built via workers. Exceptions: Xel'Naga Temple, Psi Disruptor, etc.
[men] = every mobile unit you can place (except flying buildings). Usually built in factories + hero counterparts, also includes critters.

Also the elapsed scenario time at least 0 condition works the same as always. For clarification, simplicity and efficiency you should use always instead. But it's no real mistake.




Sep 2 2008, 9:33 pm LooKe Post #9



Post didnt work....

Post has been edited 1 time(s), last time on Sep 5 2008, 3:54 am by JB4.




Sep 2 2008, 10:41 pm NudeRaider Post #10

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from name:JB4
Quote from NudeRaider
I just skimmed the triggers and again there's no explanation what trigger serves what purpose.
I am not willing to figure it all out if you are not willing to to at least briefly explain what you're doing.

The comments tell you exactly what their purpose is. I figured thats all you needed. So I changed what I think you said i forgot, and did it like this:

New Triggers
First of all those comments were "hidden" among the actions, so when I scrolled around I always had to look for the comment. Annoying. Also those comments did not say anything about how the triggers are supposed to interact and they did not explain the function of the death counters.
Here are a few specific questions.

what are all those for?
Set Deaths("All players", "Floor Hatch (UNUSED)", Set To, 0);
Set Deaths("All players", "Floor Missile Trap", Set To, 0);
Set Deaths("All players", "Left Pit Door", Set To, 0);
Set Deaths("All players", "Floor Gun Trap", Set To, 0);
Set Deaths("Player 1", "Left Pit Door", Set To, 1);
Set Deaths("Player 1", "Floor Gun Trap", Set To, 1);

why in 2 seperate triggers?
Comment("Give player their guys");
Comment("Give Player their moves");

why end of turn split up?
Comment("End of Turn 1");

what are those mine triggers for? Some kind of money increase?
Comment("Control 4 mines");

There are more things I wondered about but knowing these would help a lot.

Also I'd appreciate if you add more about what you are really trying to do so I understand your needs.
I still don't know why you can't do everything in 2 triggers as I have shown. If you want help you should answer that.

Oh and a general note about building triggers: You should avoid using specific players like Set death counter for Player 1.
You can do everything with Current Player, altough you have to think a little harder about it, that will make your map so much better, because you have no problem with leavers or open slots.

And pls don't use the quick reply function. It's broken. It doesn't process BBcode anymore.
You can edit your post to reactivate it.

Post has been edited 1 time(s), last time on Sep 3 2008, 12:13 am by NudeRaider.




Sep 2 2008, 10:53 pm KyleIs1337 Post #11



Isn't this idea similar to this topic?

You say don't steal your idea but I already thought of this idea.



None.

Sep 4 2008, 9:34 pm LooKe Post #12



Quote from KyleIs1337
Isn't this idea similar to this topic?

You say don't steal your idea but I already thought of this idea.

This isn't all done from the same computer, it's just a turn based game.

Quote from NudeRaider
First of all those comments were "hidden" among the actions, so when I scrolled around I always had to look for the comment. Annoying. Also those comments did not say anything about how the triggers are supposed to interact and they did not explain the function of the death counters.

Sorry about that, I was a little confused but now I understand what your asking.

Quote from NudeRaider
what are all those for?
Set Deaths("All players", "Floor Hatch (UNUSED)", Set To, 0);
Set Deaths("All players", "Floor Missile Trap", Set To, 0);
Set Deaths("All players", "Left Pit Door", Set To, 0);
Set Deaths("All players", "Floor Gun Trap", Set To, 0);
Set Deaths("Player 1", "Left Pit Door", Set To, 1);
Set Deaths("Player 1", "Floor Gun Trap", Set To, 1);

I guess I only need the 2 for player 1 right? since you start at 0 anyways.

Quote from NudeRaider
why in 2 seperate triggers?
Comment("Give player their guys");
Comment("Give Player their moves");

Umm because in game you can accumulate a horse, so the player gets more moves, which i think requires 2 different triggers. I'm thinking I could just combine the 2 and have 2 triggers one with a horse one without, and that way I have 2 instead of 3 triggers.

Quote from NudeRaider
why end of turn split up?
Comment("End of Turn 1");

I needed to give the selector and turn indicator to the player who's turn it is, and give the buildings to their allied computer. Could that be fixed by giving the selector/turn indicator to them in the give guys trigger, and set it to give all units to allies?

Quote from NudeRaider
what are those mine triggers for? Some kind of money increase?
Comment("Control 4 mines");

In the game you can build mines in certain areas to increase the amount of money you receive each turn.

Quote from NudeRaider
There are more things I wondered about but knowing these would help a lot.

Also I'd appreciate if you add more about what you are really trying to do so I understand your needs.
I still don't know why you can't do everything in 2 triggers as I have shown. If you want help you should answer that.

I'm confused a little on how your 2 triggers would accomplish everything I'm trying to do.

Quote from NudeRaider
Oh and a general note about building triggers: You should avoid using specific players like Set death counter for Player 1.
You can do everything with Current Player, altough you have to think a little harder about it, that will make your map so much better, because you have no problem with leavers or open slots.
Ya, I'm trying to figure out how to prevent that, and I think I've got an idea that I'll post after I try it out.

Quote from NudeRaider
And pls don't use the quick reply function. It's broken. It doesn't process BBcode anymore.
You can edit your post to reactivate it.

Ok, I didn't know that. Thanks.

Heres my slightly updated triggers (I haven't tried most of the things in this post yet)
Triggers


and then here is a summary of my map:
Map Summary




None.

Sep 5 2008, 4:59 am NudeRaider Post #13

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Quote from name:JB4
Heres my slightly updated triggers (I haven't tried most of the things in this post yet)
Triggers


and then here is a summary of my map:
Map Summary
OK, I'm slowly getting an idea of what you really need. Your triggers now seem to resemble that a bit better, but you're still using too many triggers and specific players.

I think you haven't realized that my end of turn trigger and give guy trigger are 1 trigger in my solution. As I said, the next player grabs the necessary units from the former player. You do it the other way round: The Current Player gives to the next player, which makes things complicated and forces you to use specific players.

Also my point about the death counters was that I had no idea what you need them for, not why you set them. But I think I got that now too. But still you are using so many death counters when you just need one (check below).

However, I'll give you again my solution which incorporates mines and horses:

Force 1
Conditions:

*Force 1 has suffered at most 0 deaths of 'my turn'
*Current Player has gathered at most 0 gas
Actions:
Set deaths of 'my turn' to 1 for Current Player
Set Gas for Current Player to x (normal value with no mines or horses)
Give All units of Force 1 at 'Board' to Current Player
**<other actions>
Preserve Trigger

*These 2 conditions are met at game start, so there's no need to make an init trigger or something.
==> gets rid of "Setting Deaths"
** I've noticed actions like give buildings, order civ, or give kerrigan to specific players. I have no idea what their exact function is, so I haven't implemented it. What function do the 4 allied comps have? Just give yourself a start and give me some details.
If you need to give to them, again, don't give to them from Current Player, but rather let them grab what they need. You should be able to reference to Force 1 there but if there's no other way you could use specific players for those comps as they are always present. So when their allied player is gone he has no units to give / death counts set. Also it might be a good idea if the comps are P1-4 and Players are P5-8 so the Comps can reference to gas/death counters before the player's triggers set them to 0.
Maybe it's a good idea to post the next incarnation of your map because then I could just go to the map and check for those things myself.


OK, on to the next triggers, the gas modifiers: (order is important!)

Force 1
Conditions:

Current Player has suffered exactly 1 deaths of 'my turn'
Current Player commands at least 1 mine/horse *
Actions:
Add x Gas for Current Player
Preserve Trigger

* Make copies of this, for each possible item and each possible mine
For more mines alter the condition to "Current Player commands at least 2/3/4/etc. mines"
Nothing else needs changing


And don't forget a trigger that stops the modifiers from running over and over again: (order is important!)

Force 1
Conditions:

Current Player has suffered exactly 1 deaths of 'my turn'
Actions:
Set deaths of 'my turn' to 2 for Current Player
Preserve Trigger


Then the trigger that ends the Current Player's turn: (order is important!)

Force 1
Conditions:

Current Player has suffered at least 2 deaths of 'my turn'
Current Player has gathered at most 0 gas
Actions:
Set deaths of 'my turn' to 0 for Current Player
<other actions>
Preserve Trigger

Also, if you have an enemy team (Force 2) that has to wait for your team's turns to finish then add this condition to every trigger:
Foes has suffered at most 0 deaths of 'my turn'

Post has been edited 1 time(s), last time on Sep 5 2008, 5:15 am by NudeRaider.




Sep 5 2008, 2:25 pm LooKe Post #14



I think your still slightly misunderstanding me, so heres the map, It's not worth it to try and just explain it.

The main thing i don't think you understand is that here is how the forces are setup

Force 1
Human (Player)
Computer (for when its not the humans turn)
Force 2
Human (Player)
Computer (for when its not the humans turn)
Force 3
Human (Player)
Computer (for when its not the humans turn)
Force 4
Human (Player)
Computer (for when its not the humans turn)

and I had updated my triggers from last night to this morning, but I haven't tested it yet and I added that map too.

New Triggers


Attachments:
City builders (alpha.02).scm
Hits: 0 Size: 58.42kb
Testing2.scm
Hits: 0 Size: 58.13kb



None.

Sep 5 2008, 2:44 pm NudeRaider Post #15

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Oh... that Force setup completely screws my method.
Why don't you put all the players in 1 Force, and the Comps in another, then set the alliances?
It would save you a lot of trouble.




Sep 5 2008, 2:53 pm LooKe Post #16



Quote from NudeRaider
Oh... that Force setup completely screws my method.
Why don't you put all the players in 1 Force, and the Comps in another, then set the alliances?
It would save you a lot of trouble.

Sure, that's fine. I'm going to school in a second but I will try that when I get home.

also heres a concept that I thought might work for keeping track of turn maybe? It would also compensate for missing players.

Attachments:
Turn tracker.scm
Hits: 0 Size: 35.87kb

Post has been edited 4 time(s), last time on Sep 5 2008, 8:47 pm by JB4.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:39 am]
Ultraviolet -- no u elky skeleton guy, I'll use em better
[10:50 pm]
Vrael -- Ultraviolet
Ultraviolet shouted: How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
hey cut it out I'm getting all the minerals
[10:11 pm]
Ultraviolet -- :P
[10:11 pm]
Ultraviolet -- How about you all send me your minerals instead of washing them into the gambling void? I'm saving up for a new name color and/or glow
[2024-4-17. : 11:50 pm]
O)FaRTy1billion[MM] -- nice, now i have more than enough
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- if i don't gamble them away first
[2024-4-17. : 11:49 pm]
O)FaRTy1billion[MM] -- o, due to a donation i now have enough minerals to send you minerals
[2024-4-17. : 3:26 am]
O)FaRTy1billion[MM] -- i have to ask for minerals first tho cuz i don't have enough to send
[2024-4-17. : 1:53 am]
Vrael -- bet u'll ask for my minerals first and then just send me some lousy vespene gas instead
[2024-4-17. : 1:52 am]
Vrael -- hah do you think I was born yesterday?
Please log in to shout.


Members Online: Ultraviolet, jun3hong, Zergy