Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Can u make automatic unally [diplo map]
Can u make automatic unally [diplo map]
Jun 6 2010, 5:58 am
By: Ashura  

Jun 6 2010, 5:58 am Ashura Post #1



Ok so I want to add aumatic unally system on my diplo map
everyone is ally and vis together at the begining but if some1 unally you
i want me to unally that guy automatically

s othat guy cant bs me
is there anyway to do this ?
i have tried
Set Foes to Enemy
Set Non Allied Victory to Enemy
but its not working plz help



None.

Jun 6 2010, 6:30 am DavidJCobb Post #2



So in other words, you want to automatically unally someone when they unally you?

Let's pretend that Player 2 unallies Player 1. To have Player 1 automatically unally, you could try this.
  • Give every player a unique, invincible unit in an isolated area. This is so we can tell who's who. Let's pretend that you gave Player 1 an Independent Starport.
  • Write a trigger for Player 2 that sets a Switch if Foes brings at least 1 Independent Starport to Anywhere.
  • Write a trigger for Player 1 that unallies Player 2 if that Switch is set.

When P2 unallies P1, P1 becomes part of Foes. P1 is the only person that has an Independent Starport, so if Foes has an Independent Starport, than P1 is part of Foes. If P1 is part of Foes, we set a switch. If that switch is set, P1 unallies P2.

Get it?



None.

Jun 6 2010, 7:43 am Ashura Post #3



what do u mean by "Independent" Starport



None.

Jun 6 2010, 7:45 am NudeRaider Post #4

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

There's a non-physical solution to this too. You have to look at it from the other side: Whom did Current Player unally? instead of who has declared war with Current Player.
Basically this:

Detection Phase P1
Player 1
Conditions:

Foes brings at least 1 any unit to Anywhere
Actions:
Set death counter "Foe of P1" to 1 for Foes

Detection Phase P2
Player 2
Conditions:

Foes brings at least 1 any unit to Anywhere
Actions:
Set death counter "Foe of P2" to 1 for Foes

... etc. for all players.

Unally Phase P1
All Players
Conditions:

Current Player has suffered exactly 1 death of "Foe of P1"
Actions:
Unally Player 1

Unally Phase P2
All Players
Conditions:

Current Player has suffered exactly 1 death of "Foe of P2"
Actions:
Unally Player 2

... etc. for all players
So you need 1 dc and 2 triggers for every player.
The problem is that it doesn't automatically detect when the war between the 2 of you is over and you want to be allies again because the death counter isn't reset. So you have to add a trigger resetting the death counter every 2 or more trigger loops.

Post has been edited 1 time(s), last time on Jun 6 2010, 11:08 am by NudeRaider.




Jun 6 2010, 8:17 am Azrael Post #5



Three main ways to get this to work.

1) As explained in the first reply, having a unit unique to each player, have it test for that unit being in Foes.

Benefit here is it can be done with no locations, downside is it requires the use of a different unit for every player.

2) Have a unit that cannot move and always exists as long as a player is alive, and put a location on each one, then test that unit for being in Foes.

Benefit here is it can be done with units that aren't unique, downside is it requires the use of a different location for every player.

3) You can also do this with death counts, as explained above. You can also use switches but it's not recommended for obvious reasons.

If you're still having issues with this, your best bet is to post the map.

Edit: Looking at the death count explanation, I'm guessing you use 8 separate death counts for the sake of simplicity. You really only need 1.

Post has been edited 3 time(s), last time on Oct 12 2010, 12:23 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 9:06 am Ashura Post #6



Here's the map its World Diplo 1939 and at the bottom of the map is to turn the automatic unally ON or OFF
I really think Diplomacy maps should have this ability so troll can't bs you by just unally

Attachments:
World Diplo 1939-Evo3.8.scx
Hits: 2 Size: 201.75kb



None.

Jun 6 2010, 9:40 am Azrael Post #7



I'm wondering if there's any reason you don't have hyper triggers running. I figured I would ask, 1 death count won't work so well with a 2 second gap between cycles. I can put in the 8 death count system described before, but generally speaking, hyper triggers always make for a better playing experience. If they conflict with something already in the map, let me know.

Are any of the triggers you've tried in regards to the auto-unally system already in the map? I see nothing referencing alliance status or the location at the bottom. If there is something already there somewhere, let me know what player it's under.

Post has been edited 2 time(s), last time on Oct 12 2010, 12:22 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 9:47 am Ashura Post #8



Quote from name:Azrael.Wrath
I'm wondering if there's any reason you don't have hyper triggers running. I figured I would ask, 1 death count won't work so well with a 2 second gap between cycles. I can put in the 8 death count system described before, but generally speaking, hyper triggers always make for a better playing experience. If they conflict with something already in the map, let me know.

Are any of the triggers you've tried in regards to the auto-unally system already in the map? I see nothing referencing alliance status or the location at the bottom. If there is something already there somewhere, let me know what player it's under.
No I have not done anything about the autounally system yet since its not working and I'm seeing which way should I do



None.

Jun 6 2010, 10:34 am Azrael Post #9



Alright, I will quickly implement a prototype system into the map, you can use it if you want (assuming it works properly haha, I won't be testing it). Since you didn't use any comments, and you have intuitive names for your locations, it shouldn't be too difficult or take much time at all. I'll post back with the finished version and you can take a look at the triggers.

Post has been edited 2 time(s), last time on Oct 12 2010, 12:26 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 11:27 am Azrael Post #10



Here it is. Things to note:

1) I added no units or locations anywhere. The system runs on 1 unit's death count.

2) I completely removed the locations, units, and terrain at the bottom for turning the auto-unally on and off.

You turn the system on and off with Allied Victory (Allied Victory on = Auto-unally on).

3) You will not only automatically unally anyone who unallies you, but you will also receive a message informing you which country unallied you, along with their player color.

4) I removed the color tags in the Force names since they don't work, and added double-slashes as separators instead.

5) I added hyper triggers.

6) I changed the trigger order so that the players allying one another is the first thing that happens.

7) I changed it so players have Allied Victory on by default.

As I said earlier I really have no fast way to test this so you'll have to let me know how it works. If anything's wrong, let me know what happens (or doesn't happen) and I'll see what the issue is. Hopefully it runs smoothly.

I did play it for a second to make sure I didn't completely break the map by adding hyper triggers, it seemed to run alright. I don't know if they were there before or not, but there's a nasty dose of misplace errors when the map starts. I would seriously suggest fixing that (just remove or reduce the creation triggers until it stops). I was playing as purple, if that helps.

Let me know how it works.

Attachments:
World Diplo 1939-Evo3.8.scx
Hits: 1 Size: 204.5kb

Post has been edited 2 time(s), last time on Oct 12 2010, 12:26 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 11:35 am NudeRaider Post #11

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:Azrael.Wrath
3) You can also do this with death counts, as explained above. You can also use switches but it's not recommended for obvious reasons.
How would you do it with switches at all? You can't set switches for Foes.

Quote from name:Azrael.Wrath
Edit: Looking at the death count explanation, I'm guessing you use 8 separate death counts for the sake of simplicity. You really only need 1.
Correct.
However since it's been mentioned I'll show you this alternative which you can use if you are comfortable with binary count-offs. If not, feel free to use 8 separate dcs as you probably never will run out of dcs.
Here's how it works with 1 dc: You code the player numbers as binary values to the same dc "Foes coded". (e.g. add 1 for P1, add 2 for P2, add 4 for P3, etc.)
So unallying P6, P3 and P1 would result in 32+4+1 = 37. Then you'd need 8 triggers, each checking for at least 128, 64, 32, 16, 8, 4, 2 and 1 respectively and each time unallying the associated player if it returns true and subtracting the value you just surpassed.
For this example:
At least 128 and 64 would be ignored.
At least 32 would return true, so unally associated player (P6) and subtract 32 from the dc. Resulting in 5 dc counts left over.
At least 16 and 8 would be ignored again.
At least 4 returns true, so unally associated player (P3) and subtract 4 from the dc. Resulting in 1 dc counts left over.
At least 2 would be ignored again.
The last trigger of this sequence, "at least 1" returns true again, so unally associated player (P1) and subtract 1 from the dc. Resulting in 0 dc counts left over.
Oh and yes, it has to be from the largest to the smallest number or it won't work. Read up on binary count-offs for more information.

Problem here is trigger order *. You need another dc that ensures that while P1-8 are setting the dc the resolution triggers that check for the binary values and unally the associated player(s) aren't subtracting prematurely. Basically like a switch, but each player has its own count. Let it run for 2 trigger loops in add mode, then 2 trigger loops in subtract mode.

*Actually I'm not entirely sure if it would glitch if you didn't implement this precaution since I have a hard time figuring what happens with various cross-player combinations of unallying. I guess you could try without this switching dc and if it glitches add it, if you really have to save on this one dc or if you are a perfectionist. ;)




Jun 6 2010, 11:43 am Azrael Post #12



Quote from NudeRaider
How would you do it with switches at all? You can't set switches for Foes.
Same way I did it in the map provided above, I never set death counts for "Foes", only individual players. Part of the triggers could have been switched over to Foes but another part needed to be separate anyways (in order to know when to ally the player back) so I just kept it all separate. Pretty easy to replicate with switches, except for the fact you have to use 126 of them. The main issue with using that system is it will keep triggering over and over again.

Actually, if you had it add 1 to Foes, instead of set 1, you could have an action at exactly 1 and not have it repeat. That might be something to consider in such a system.
Quote from name:Azrael.Wrath
However since it's been mentioned I'll show you this alternative which you can use if you are comfortable with binary count-offs. If not, feel free to use 8 separate dcs as you probably never will run out of dcs.
Here's how it works with 1 dc: You code the player numbers as binary values to the same dc "Foes coded". (e.g. add 1 for P1, add 2 for P2, add 4 for P3, etc.)
So unallying P6, P3 and P1 would result in 32 4 1 = 37. Then you'd need 8 triggers, each checking for at least 128, 64, 32, 16, 8, 4, 2 and 1 respectively and each time unallying the associated player if it returns true and subtracting the value you just surpassed.
For this example:
At least 128 and 64 would be ignored.
At least 32 would return true, so unally associated player (P6) and subtract 32 from the dc. Resulting in 5 dc counts left over.
At least 16 and 8 would be ignored again.
At least 4 returns true, so unally associated player (P3) and subtract 4 from the dc. Resulting in 1 dc counts left over.
At least 2 would be ignored again.
The last trigger of this sequence, "at least 1" returns true again, so unally associated player (P1) and subtract 1 from the dc. Resulting in 0 dc counts left over.
Oh and yes, it has to be from the largest to the smallest number or it won't work. Read up on binary count-offs for more information.
Pretty sure this would work if you ordered the triggers properly. Still, it's not necessary to use such an overly complicated system. I used 1 death count, as seen above, and the death count is never set higher than 8.

Post has been edited 3 time(s), last time on Oct 12 2010, 12:24 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 11:48 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:Azrael.Wrath
Pretty sure this would work if you ordered the triggers properly. Still, it's not necessary to use such an overly complicated system. I used 1 death count, as seen above, and the death count is never set higher than 8.
Would you mind giving a quick rundown of your system? I don't like figuring out what triggers do in a map full of triggers...




Jun 6 2010, 12:01 pm Azrael Post #14



There's 1 computer player and 7 human players. He has a location that's always on a beacon owned by each player. At this point you might be thinking that I cheated on having no physical aspects within the map, although it does check the beacons for alliance status, I did it merely for convenience and ease of customizing in case Ashura wants to add player-specific actions later. In actuality, you can replace all the player-specific triggers with a single "Set deaths of Foes" trigger.

Basically, the computer constantly cycles its own death count from 1 to 8. When it's 1, P1 checks if he has P2 unallied at the beacon location, and if he does, sets P2's death count to 1. He does the same thing for all the other players.

When the computer has a death count of 2, P2 checks who he has unallied in the same way, and then sets their death count to 2. P3 checks the same way, sets their death count to 3. P4 to 4, etc. This could have been done via "Foes," but the next part needed to be player-specific, so I kept everything separated to make it easier if he wants to customize it in some way.

Then each player has a trigger, that if they have suffered exactly 1 death count, and they have allied victory turned on for P1, they will unally P1 and receive the message about P1 unallying them. If their death count is exactly 2, it does the same thing except for P2.

As for implementing this with a single death count and absolutely no physical properties, without using binary, I would do the exact same thing, since the system I used doesn't need the units at all for the actual detection and unallying of foes. You can replace the beacon system with "set deaths of Foes" and it would work just as well. I used the beacons to make it easier to stop the unallying process, so it will only happen once. You could use a physical system to toggle auto-unally off, which would make it pretty easy to get around this issue.

Post has been edited 4 time(s), last time on Oct 12 2010, 12:25 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 2:06 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

Ah so there is a computer player. That certainly simplifies things and probably makes your solution the most efficient although you need 6 triggers per player.
Do you need 7 trigger loops to check all player's foes? Because I think it'd be possible to increment the computer's dc each time a player is done with its triggers.




Jun 6 2010, 2:37 pm Azrael Post #16



Quote from NudeRaider
Ah so there is a computer player. That certainly simplifies things and probably makes your solution the most efficient although you need 6 triggers per player.
I'm thinking that switches could also be used if there wasn't a computer, setting switch 1 being like setting the computer's death count to 1, setting switch 2 being death count = 2, etc. Without having a computer player or any specific player required though, it'd become needlessly complex, and I'm pretty sure your system would be better to implement anyways.
Quote from NudeRaider
Do you need 7 trigger loops to check all player's foes? Because I think it'd be possible to increment the computer's dc each time a player is done with its triggers.
Well, I thought I could get away with 7, that's what I started with at first, but I actually ended up using 8. At 3 for example, P3 sets all enemies DC to 3, then all the players after that set it back to 0 and unally P3 if their DC was 3. Then it gets to the computer, and the computer sets its DC to 4. However, P1 and P2 haven't had their check yet at this point. It gets to them, and they also unally P3 if their DC is 3. Then it passes P3 to P4, who sets their foes to 4 DC.

The reason I need 8 cycles for this is because when the computer sets the DC to 7, it cycles through every player without doing anything, until it gets back to P7. The problem with that is the next player to set the DC is P1, who is passed by in the process. If I use 7 cycles then P1 will try to alter the DC for their foes when the computer's DC is set from 7 to 1, while it's still checking for P7.

But since I'm tired and I feel like I'm rambling somewhat, I'll just clarify that it uses 8 cycles total. If someone unallies you, you will automatically unally them in 0.672 seconds or less.

Edit: If you figure out a way I could reduce that number with this kind of system then let me know, I love using computer DC cycles to regulate triggers and being able to optimize it further would be awesome ^^ There might be a way to do it in this instance I'm not picking up on, it's entirely possible considering my complete lack of sleep :><:

Post has been edited 4 time(s), last time on Oct 12 2010, 12:22 pm by DevliN. Reason: Mineral abuse.




Jun 6 2010, 2:59 pm NudeRaider Post #17

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

Actually no. I just realized that you compensated the loss of information by only using numbers from 0-7 (instead of 255-0) in the dc by having it take 7 (or 8) trigger loops. You could detect one foe in 1 loop, but not multiple.

The only way I see is since usually players won't unally you simultaneously you could settle for only detecting one player per loop (incrementing the computer dc after each player's triggers, as said above) and add a condition that only sets the dc of players that are not enemy to you. Haven't thought this to the end though because I think it doesn't matter at this point. If you want to do it for the sake of it, feel free. ;)




Jun 6 2010, 3:43 pm Azrael Post #18



Lol maybe after a good nights sleep xD

Post has been edited 2 time(s), last time on Oct 12 2010, 12:18 pm by DevliN. Reason: Mineral abuse.




Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:18 am]
Sylph-Of-Space -- No complaints here, i'm just curious!
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[2024-5-18. : 3:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
Please log in to shout.


Members Online: braxtonlsweeney