Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Turn-Based Combat Problems
Turn-Based Combat Problems
Jan 1 2011, 7:17 pm
By: Dem0n  

Jan 1 2011, 7:17 pm Dem0n Post #1

ᕕ( ᐛ )ᕗ

For my RPG, I'm using turn-based combat. What's supposed to happen is that after all of the players choose their attack, player 1's unit is supposed to go to the enemy, attack the burrowed unit (I'm using vHP), go back to its original spot, and then turn around to face the enemy. After that, player 2 attacks, and so on. When I made the triggers for only player 1, it worked perfectly, but when I added a second player, everything got messed up. Instead of doing what its supposed to do, player 1's unit attacks, comes back to its original spot, but does not turn around. Also, player 2's unit never attacks since player 1's unit didn't turn around. I think there's something wrong with the conditions for the trigger that turns the unit around and tells player 2 to attack, but I can't figure out the error. The units are kept facing forward as long as the player has 0 deaths of Mining Platform and Mineral Field (Type 3). After each player selects "attack", they each get 1 death of Jump Gate, Cantina, Mining Platform,and Mineral Field (type 3). Here are the triggers that I have.

Triggers


Notice that I'm using p7 to attack for all players since it's turn-based. Also, the deaths for the Queen's Nest represent when the player has attacked. One death is added after each attack by the player. I only included the triggers leading up to when when player 2's unit should attack because I think that the problem lies within one of these triggers. The last trigger that I put is the one that should make player 1's unit face forward and tell player 2's unit to attack, but it doesn't work.

This is what it looked like when I only had triggers for one player. This is what it should look like:


However, when I put in the triggers for player 2, this is what happens:


Also, one more question. Notice how in the pictures, the burrowed units underneath the hydralisk aren't actually underneath it? I put them directly beneath the yellow hydralisk, yet they are off to the side. Why is that? The burrowed units underneath the zealots are right below them. :|




Jan 1 2011, 7:21 pm TiKels Post #2



This is just a supposition, but im gonna go ahead and say you aren't constantly moving the burrowed units under the hydra to the hydra. When you create a burrowed unit, it will never stack, they displace as if they were not burrowed. You need to move them to get them under.



"If a topic that clearly interest noone needs to be closed to underline the "we don't want this here" message, is up to debate."

-NudeRaider

Jan 1 2011, 7:32 pm Ahli Post #3

I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

wait block maybe?
add a text message before the wait and check when the trigger is running.




Jan 1 2011, 8:15 pm 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

Yeah, you have to refine the information a little for us. There's so much deaths being set it's hard to understand what's going on.
Do what Ahli suggested and add display text or create unit over unwalkable terrain (for non human players, the error message will work like a display text for you) and analyze which part of the trigger stop. Wait block is a good guess btw.
If you use hyper triggers make sure they are owned by a single computer without waits (preferred) - OR - are owned by All Players and are at the bottom of the trigger list.

Btw. you should use only 1 dc to store the state of the current turn. E.g. Cantina = 1 - do stuff, set Cantina = 2, etc. It makes things much easier and thus helps find errors.

This is how I would make the battle triggers:
In my example the begin of the battle is marked by any player in force 1 having a death of cantina.
The triggers during the fight are all owned by a computer (P6) to make sure they don't run multiple times by accident. Additionally I give the unit to P6 so the player can't interfere, so it makes sense to have them owned by P6.
'Attackers' is a large vertical location that is (temporarily) fixed over the starting position of the human attackers.
'Defender' is a large (temporarily) fixed location over the P7 defenders.

Trigger
Players
  • Force 1
  • Conditions
  • Current Player has suffered at least 1 death of cantina
  • P6 has suffered at most 0 deaths of cantina
  • Actions
  • Give 1 unit owned by Current Player at 'Attackers' to P6
  • Set deaths of cantina to 1 for P6


  • Trigger
    Players
  • Player 6
  • Conditions
  • Current Player has suffered exactly 1 death of cantina
  • Actions
  • Center location 'Starting point' on [men] owned by Current Player at 'Attackers'
  • Center location 'Target' on [men] owned by P7 at 'Defenders'
  • Order to attack 1 unit of Current Player at 'Starting point' to attack to 'Target'
  • Set deaths of cantina to 2 for Current Player
  • Note:[/color] If the battles always take place at the same fixed location you don't need to center 'Starting point and 'Target'.

    Trigger
    Players
  • Player 6
  • Conditions
  • Current Player has suffered exactly 2 deaths of cantina
  • Current Player has at least 1 kills score
  • Actions
  • Create 3 scourges at 'Starting point' for P7
  • Create 1 scourge at 'Starting point' for Current Player
  • Center 'FacingFix' on scourge owned by Current Player
  • Remove all scourges at 'Attackers' for All Players
  • Set kills score to 0 for Current Player
  • Order all [men] owned by Current Player at 'Defenders' move to 'FacingFix'
  • Set deaths of Cantina to 3 for Current Player
  • Note: If the battles always take place at the same fixed location you don't need the mobile grid to position 'FacingFix'.

    Trigger
    Players
  • Player 6
  • Conditions
  • Current Player has suffered exactly 3 deaths of cantina
  • Current Player brings at least 1 [men] to 'FacingFix'
  • Actions
  • Order all [men] owned by Current Player at 'FacingFix' move to 'Starting point'
  • Set deaths of cantina to 4 for Current Player


  • Trigger
    Players
  • Force 1
  • Conditions
  • P6 has suffered exactly 4 deaths of cantina
  • Current Player has suffered at least 1 deaths of cantina
  • P6 brings at least 1 [men] to 'Starting point'
  • Actions
  • Give all [men] owned by P6 at 'Starting point' to Current Player
  • Set deaths of cantina to 0 for Current Player
  • Set deaths of cantina to 0 for P6
  • Note: This is potentially buggy when a player starts his attack turn and during the attack another player starts an attack turn AND has a lower player number than the first player. You'll have to take care of that. For example by setting the cantina(s) only when all players have chosen their action.

    The condition for any follow up trigger would be All Players suffered at most 0 deaths of cantina. Or you set deaths of cantina to 5. Whatever suits you.

    Alright, I hope seeing these triggers you can figure out how to simplify your turn system and fix the bug along the way because as you can see the turn is divided in neat subturns through the dc and thus errors are easy to track. And I don't need a wait. You should avoid these anyway.

    Post has been edited 5 time(s), last time on Jan 2 2011, 9:20 pm by NudeRaider.




    Jan 1 2011, 9:07 pm Dem0n Post #5

    ᕕ( ᐛ )ᕗ

    Tried what you said, nothing happened. Something's wrong with the conditions. I'll explain the deaths so that you can understand what's going on.

    There are 3 options that a player can choose when attacking. They can either attack, use a spell, or use a potion. Each time they unload the unit representing that specific action, they're given a DC. Also, they're given another DC just as a general count to show that they've chosen an attack. The jump gate is the DC that is given when a player chooses attack, and Cantina is the DC that is given when the player chooses one of the actions to perform.

    I want the units to keep looking forward (instead of looking to the side or something), so I made a trigger that made the units look forward as long as the player had 0 deaths of Mining Platform and Mineral Field. The players are given 1 death of each of these before they attack so that they can move to the enemy.

    The Queen's Nest shows that the player has attacked. After he attacks, player 6 (the player that the burrowed units underneath the hydralisk are owned by) gets 1 death of Queen's Nest to show that the hydralisk has been attacked one time. If there are 0 deaths of the Queen's Nest, player 1's unit will attack the enemy. When there's 1 death of Queen's Nest, player 2's unit will then attack.

    In the third trigger, all of player 1's attack deaths are cleared and one of the facing forward deaths are also cleared. The second death is cleared after player 1 gets back to its original location. If both were cleared before, the unit would just walk back to the small location that has it face forward (making it face the opposite direction). After that second death is cleared, player 1's unit moves forward a tiny bit (like one pixel) so that it's facing the enemy.

    All of my conditions for the third trigger are being met, right? Player 1's unit is moved back to its original spot, his attack deaths are cleared, and The Queen's Nest has been given a death of 1 from the previous trigger. I think I am encountering some wait blocks because some other things also seem slow, but I don't know why. The hypers are given to a computer that has no other triggers.




    Jan 1 2011, 9:48 pm NudeRaider Post #6

    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

    Check my post above, got my example turn system ready.

    How do you make sure the unit's facing stays the same? As far as I know there's no way to prevent them from turning when they're idling. Are you just ordering them to their starting position? Does it work?




    Jan 1 2011, 10:02 pm Dem0n Post #7

    ᕕ( ᐛ )ᕗ

    Hm, I thought they stayed at the same position if they were being moved to the same location over and over again. Apparently not. O_o




    Jan 2 2011, 4:37 am Vrael Post #8



    I don't see any action that forces the zealot to turn around at all. How are you doing it in the first place? What I mean is, where is the Order action that makes the zealot face left after he gets back?



    None.

    Jan 2 2011, 4:35 pm NudeRaider Post #9

    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 I forgot to note the most important advantage of my system: It uses Force 1 and Current Player and thus automatically works for any number of players in Force 1.

    Also keep me posted about your progress of simplifying your triggers (or just copying my triggers) so I can answer questions you might have or explain things you didn't fully understand. (There's some knowledge about trigger firing order involved that might not be obvious, or I might even have overlooked something since I didn't test the trigger system.)

    Btw. I just added a condition to my last trigger that is necessary to prevent the trigger from firing at battle turn start.




    Jan 2 2011, 4:42 pm Dem0n Post #10

    ᕕ( ᐛ )ᕗ

    Quote from Vrael
    I don't see any action that forces the zealot to turn around at all. How are you doing it in the first place? What I mean is, where is the Order action that makes the zealot face left after he gets back?
    There's another trigger that I didn't post that tells the zealot to move to a small location in front of him whenever the player suffers 0 deaths of Mining Platform and Mineral Field.

    @Nude: I've already begun simplifying my triggers. I'll take a look at your triggers; hopefully they'll help me. :)

    EDIT: Well I'm not really following nude's triggers, but I did simplify them so that there's only like 3 or 4 deaths being used. BUT, this one trigger is being retarded and I have absolutely no clue why.

    Trigger
    Players
  • Player 7
  • Conditions
  • Deaths("Player 1", "Mining Platform", Exactly, 1);
  • Deaths("Player 1", "Cantina", Exactly, 1);
  • Deaths("Player 6", "Men", At least, 1);
  • Actions
  • Set Deaths("Player 1", "Jump Gate", Set To, 0);
  • Set Deaths("Player 1", "Mining Platform", Set To, 0);
  • Set Alliance Status("Player 6", Ally);
  • Create Unit("Current Player", "Kakaru (Twilight)", 1, "Enemy1BattleFace");
  • Kill Unit At Location("Current Player", "Kakaru (Twilight)", All, "Enemy1BattleFace");
  • Order("Current Player", "Men", "Fighting Lane", "Player1Battle", move);
  • Preserve Trigger();


  • After the player kills one of player 6's burrowed units, the stupid kakuru death effect keeps showing over and over again. The two deaths for player 1 are cleared, so it makes no sense why it keeps happening. The only time player 1 gets a death of cantina is when he chooses an attack option. He does this by unloading a unit from a dropship, but the unit is loaded right afterward, so there's no way that death can be constantly set to one. And yes, I made sure the location is only checked for ground. The mining platform death is given to player 1 when he suffers a death of cantina, but if he doesn't suffer a death of cantina, then how can he keep getting a death of mining platform?? X(

    I hate starcraft.

    Post has been edited 1 time(s), last time on Jan 2 2011, 6:14 pm by Dem0nS1ayer.




    Jan 2 2011, 7:50 pm Ahli Post #11

    I do stuff and thingies... Try widening and reducing the number of small nooks and crannies to correct the problem.

    Post all triggers using these deaths pls... or the map.




    Jan 2 2011, 9:40 pm NudeRaider Post #12

    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

    ... damn I deleted most of my post...

    We can't help you Dem0n, when we don't have all triggers involved. Apparently something is interfering with your system and it's maybe not even part of the battle system.

    Still I encourage you to understand my triggers. I'm using standard techniques that can be used in any number of trigger systems and understanding the basic principle will make you a better and faster mapper. Trust me, your system is far too complicated which is the reason you're not finding the problem. You can do anything with a single dc and if you're having more than 1 human player you should always use Current Player and Forces.

    All right, I'll give you a quick overview of what's happening in my triggers and if you're still having trouble with something you'll have to ask me specific questions like "what's condition x for?" or "why is action y working?".

    1. The first trigger fires as soon as any player in force 1 has at least 1 death of cantina. (Set by your dropship triggers). It gives the unit of that player to P6 (to better control the fight) and sets the cantina for P6 to 1 which starts P6's trigger set:

    2. First I center the start and target locations so I know where to order the unit to. (This isn't necessary if all battles are at the same place) Then I order the unit to attack and increase the cantina for P6 to 2 to start the next trigger:

    3. When the unit was killed I use a mobile grid to center a location 1 terrain block right of the starting location (again, this isn't necessary if all battles are at the same place) so the facing is correct once the unit arrives at its starting point. To invalidate the condition I reset the kills score and order the unit back. Cantina = 3 ==> next trigger:

    4. When the unit has walked back to 'FacingFix' it's ordered to its original location and the cantina is incremented. ==> next trigger:

    5. Here I use a neat trick to remember who was the original owner of the unit: (keep in mind I haven't cleared Force 1's or P1's cantina yet)
    Instead of having the trigger owned by P6 and give the unit to a human player I have the trigger owned by Force 1 and let the human player "grab" his unit:
    The trigger runs for Force 1, so the same player that first gave his unit to P6 will take this unit back from P6 as soon as it arrives at its starting location. Then I clear the dcs and the next player from Force 1 can start over.




    Jan 2 2011, 11:07 pm Dem0n Post #13

    ᕕ( ᐛ )ᕗ

    Okay well I don't know what's wrong. I used Nude's triggers (with some variations), but the zealot won't attack. It goes to the location and then just stands there. I made sure that player 6 (the one with the burrowed units) was an enemy to player 7 (the one who controls the zealot), but still nothing. :( Here's the map; maybe you guys can figure something out.

    Beware: Inefficient triggers are bound to be present.

    http://www.4shared.com/file/VFwlGttX/battle_system_2-p1.html




    Jan 2 2011, 11:24 pm NudeRaider Post #14

    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

    maybe no vision to the burrowed units?

    EDIT:
    Confirmed. No share vision trigger for P7. (P7 needs to 'grab' vision from P6, not the other way around)

    Post has been edited 1 time(s), last time on Jan 2 2011, 11:30 pm by NudeRaider.




    Jan 2 2011, 11:29 pm Dem0n Post #15

    ᕕ( ᐛ )ᕗ

    omg nude -.-

    When I add the vision, the zealot goes and attacks (:awesome:), but then he doesn't move back. He keeps attacking over and over. :-_-:

    Post has been edited 1 time(s), last time on Jan 2 2011, 11:36 pm by Dem0nS1ayer.




    Jan 2 2011, 11:41 pm NudeRaider Post #16

    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

    It works for me. But only once...
    Then the cycle starts over but the zealot never walks back again.

    Probably something a dc that wasnt reset or a location that moved. Lemme check.

    EDIT:
    It's really hard to go through your triggers since you have empty comments for all the triggers. But there are triggers for P1-3 that change some dcs... maybe them?
    Can you send me a verion where the triggers that are firing after a battle are uncommented (like the new ones)? Since that's probably where the mistake is.

    EDIT2:
    Confirmed that something changes P7's jump gate dc from 2 to something else, so the order back trigger never fires.

    god... demon... I don't know if I should hate you for forgetting it or hate me for not noticing it for so long... The triggers need to be preserved!!!!

    Post has been edited 3 time(s), last time on Jan 3 2011, 12:10 am by NudeRaider.




    Jan 3 2011, 12:15 am Dem0n Post #17

    ᕕ( ᐛ )ᕗ

    Hate me please. I'm stoopid.

    EDIT: COOL I PUT IN THE PRESERVE TRIGGERS NOW THE ZEALOT ATTACKS, GOES BACK, THEN ATTACKS AGAIN FOREVER AND EVER

    Post has been edited 1 time(s), last time on Jan 3 2011, 12:22 am by Dem0nS1ayer.




    Jan 3 2011, 12:30 am NudeRaider Post #18

    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

    And I noticed that only after I was tracing the jump gate in all triggers via text triggers and made sure P7 has kills score...

    Btw. I noticed another "bad habit" trigger. The trigger of P7 between +BATTLE+ and +ATTACK+. You let a comp create units for P1 and P2. That's a no-no. Albeit otherwise lazy to trigger you must not ever create units for individual human players because it creates the units anyway (for a so called ghost player) if that player is missing.
    You have to create the units for Force 1 all in the same location and then let P7 move them to their respective locations. Only members of Force 1 will have a unit created; absent players are not members of Force 1.
    - OR - You have to have a trigger for each player that creates the units for Current Player. If the player isn't there the trigger won't be run and no unit created.

    EDIT:
    and for the loop, I'm pretty sure this is because of one of the P1-3 triggers that sets the jump gate to 1 when the countdown timer is 0. I never see you resetting it, but I remember seeing an "autochoose" trigger that sets you for attack if you havent chosen after the cd is over.

    Post has been edited 1 time(s), last time on Jan 3 2011, 12:36 am by NudeRaider.




    Jan 3 2011, 12:48 am Vrael Post #19



    Why bother even using the burrowed units? As far as I can see, since the system is turn-based anyway, you should use them purely for "attack animation" purposes, and not in the conditions of your trigger system, its just one less variable to be accounted for, one less glitch to watch out for. Instead, maybe time the length of time it takes for the zealot to walk over, attack, and return, and use DC's to time it.



    None.

    Jan 3 2011, 1:07 am Dem0n Post #20

    ᕕ( ᐛ )ᕗ

    I'm using vHP because the players will be able to get better weapons/equipment that'll change the amount of damage that they can do. Like they can find different types of knives that will all be shown as the same unit (zealot), but they'll all do different damage. A weak knife may kill only 1 burrowed unit, whereas a strong knife can kill 2 or 3 burrowed units.




    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [01:35 am]
    Ultraviolet -- Vrael
    Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    Gonna put deez sportballs in your mouth
    [01:24 pm]
    Vrael -- NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
    [2024-4-30. : 5:08 pm]
    Oh_Man -- https://youtu.be/lGxUOgfmUCQ
    [2024-4-30. : 7:43 am]
    NudeRaider -- Vrael
    Vrael shouted: if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    Yeah I'm not a big fan of Westernhagen either, Fanta vier much better! But they didn't drop the lyrics that fit the situation. Farty: Ich bin wieder hier; nobody: in meinem Revier; Me: war nie wirklich weg
    [2024-4-29. : 6:36 pm]
    RIVE -- Nah, I'm still on Orange Box.
    [2024-4-29. : 4:36 pm]
    Oh_Man -- anyone play Outside the Box yet? it was a fun time
    [2024-4-29. : 12:52 pm]
    Vrael -- if you're gonna link that shit at least link some quality shit: https://www.youtube.com/watch?v=uUV3KvnvT-w
    [2024-4-29. : 11:17 am]
    Zycorax -- :wob:
    [2024-4-27. : 9:38 pm]
    NudeRaider -- Ultraviolet
    Ultraviolet shouted: NudeRaider sing it brother
    trust me, you don't wanna hear that. I defer that to the pros.
    [2024-4-27. : 7:56 pm]
    Ultraviolet -- NudeRaider
    NudeRaider shouted: "War nie wirklich weg" 🎵
    sing it brother
    Please log in to shout.


    Members Online: jun3hong