strange problem
Aug 2 2009, 9:42 pm
By: Exigence  

Aug 2 2009, 9:42 pm Exigence Post #1



im sorry i keep bothering you guys, but im reaching the end of making this map and all sorts of problems keep coming up unexpected :P

i have a 'saving a player' system in my game. basically if Player 1 doesn't have an SCV (the main unit in the game) and Force 1 goes to location 'middle' with atleast 1 SCV, Player 1 will have an SCV created at 'middle' with a Text message that comes up notifying everyone that Player 1 has been saved along with a .WAV file. (it is under All Players)

The problem:
The triggers work happily if the Player going to save "walks" onto the location. The SCV is created, and the message comes up with the .WAV. The problem is if a Force 1 SCV 'camps' the location, the SCV is created but the display message does NOT appear and no .WAV file plays. I've disabled the Create SCV part of the trigger to test it, and the message and .WAV DOES come up. This is my example for Player 1 being saved by Force 1:

CONDITIONS:
Player 1 brings exactly 0 SCV to 'Anywhere'
Force 1 brings atleast 1 SCV to 'middle'
'spwn rdy' is set. (this is a switch that is set up to a death counter to delay the time between saving)

ACTIONS:
Preserve Trigger
Display for current player: Player 1 has been saved.
Play Wav: 'noise'
Clear 'spwn rdy'.
Create 1 SCV at 'middle' for Player 1.


any suggestions are greatly appreciated :)



None.

Aug 2 2009, 10:07 pm Ahli Post #2

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

1. the trigger order:
First P1 runs all of his triggers, then P2, then P3, then P4, ... and then P8.

Problem of your current notification system:
The first player who runs his trigger will cause the SCV to be recreated. This means that all other players will not run this trigger and get no notification because the Conditions aren't longer met.

Solution:
You should set a deathcounter that holds the player# of the revived player to activate the notification.

Code
OWNER:
Force 1

CONDITIONS:
Player # brings exactly 0 SCV to 'Anywhere'
Force 1 brings atleast 1 SCV to 'middle'
'spwn rdy' is set

ACTIONS:
Preserve Trigger
Clear 'spwn rdy'.
Create 1 SCV at 'middle' for Player #.
Modify Death counts for Force 1: Set to "REVIVED PLAYER #" for "UNIT THAT DOESNT DIE INGAME"

______________________________________________________
OWNER:
Force 1

CONDITIONS:
Current Player has suffered exactly "REVIVED PLAYER #" of "UNIT THAT DOESNT DIE INGAME"

ACTIONS:
Preserve Trigger
Modify Death counts for CURRENT PLAYER: Set to 0 for "UNIT THAT DOESNT DIE INGAME"
Display for current player: Player # has been saved.
Play Wav: 'noise'


(# stands for the human player number who will have messages displayed.)
You need a unit" that won't/can't die in your map (e.g. ressources/powerups/unused units/beacons).

edit: fixed my mistake in the 2nd trigger actions resetting all death counts

Post has been edited 1 time(s), last time on Aug 2 2009, 10:13 pm by Ahli. Reason: copy pasting without reading ;P




Aug 2 2009, 10:21 pm Demented Shaman Post #3



Here's another variation to what Ahli posted, although in general Ahli's method is preferable. However, understanding how this works will improve your understanding of trigger order.

Also, in Ahli's method if two players run the spawn trigger in the same trigger cycle then the first player's display message will be overwritten because the conditions of the death count will change before other players get a chance to run their display trigger.

A detailed scenario would be as follows:
Suppose that Players 1 to 8 are in Force 1 and Player 1 and Player 2 are saved at the same time.

Player 1's triggers run first. His SCV is spawned and the death count for everyone in Force 1 is set to 1. Player 1's display trigger saying "Player 1 saved" is then run, because the death count is equal to 1.

Now Player 2's triggers run. His SCV is spawned and the death count for everyone in Force 1 is set to 2. Player 2's display trigger is run. However, because the death count is equal to 2 the display trigger that runs is "Player 2 saved." What has happened is the trigger that spawns an SCV for Player 2 has set Force 1's death count from 1 to 2, before the display trigger that says "Player 1 saved" based on the death count being 1.

Now the remaining triggers for Force 1 will be run in order (all of P3, then all of p4... up to P8) and they will only display "Player 2 saved" because the death count has been set to 2.

When all the triggers for each player has been cycled through, it will go back to Player 1 and run his triggers again. Since his death count is also 2, he will then see "Player 2 saved."

As a result, everyone except for Player 1 will see only the "Player 2 saved" message. Player 1 will be the only one that sees "Player 1 saved" and "Player 2 saved".

Code
OWNER:
Force 1

CONDITIONS:
Current Player has suffered at least 1 of "UNIT THAT DOESNT DIE INGAME"

ACTIONS:
Preserve Trigger
Modify Death counts for Current Player: Set to 0 for "UNIT THAT DOESNT DIE INGAME"

______________________________________________________
OWNER:
Force 1

CONDITIONS:
Current Player brings exactly 0 SCV to 'Anywhere'
Force 1 brings atleast 1 SCV to 'middle'
'spwn rdy' is set

ACTIONS:
Preserve Trigger
Clear 'spwn rdy'.
Create 1 SCV at 'middle' for Player #.
Modify Death counts for Current Player: Set to 1 for "UNIT THAT DOESNT DIE INGAME"

______________________________________________________
OWNER:
Force 1

CONDITIONS:
Player # has suffered exactly 1 of "UNIT THAT DOESNT DIE INGAME"

ACTIONS:
Preserve Trigger
Display for current player: Player # has been saved.
Play Wav: 'noise'

The triggers above do not suffer from the problem I outlined earlier.

Post has been edited 2 time(s), last time on Aug 2 2009, 10:35 pm by Pariah.



None.

Aug 2 2009, 11:11 pm Exigence Post #4



sounds perfect. except for one part. i want the message and sound file to appear for force 2 as well. can i set the last trigger for All Players? or is there interference when using All Players and Display Message/sound files? (i dont have enough time right now to try it, thats why im asking :) )



None.

Aug 2 2009, 11:11 pm Demented Shaman Post #5



Setting the owners to all players is fine.



None.

Aug 2 2009, 11:19 pm Exigence Post #6



thank you guys =]



None.

Aug 3 2009, 6:17 am Exigence Post #7



one thing i dont understand is when you set the Player to Current Player, to who does that trigger respond to? the owner of the trigger or the player set in the conditions of the trigger?



None.

Aug 3 2009, 7:06 am Falkoner Post #8



SCM Draft has some "Players" in that player section that don't really exist, if you put it under Current Player the trigger just won't run, only Players 1-8, Forces 1-4, and All Players are valid Players for triggers to go under.

EDIT: Ah, answered kinda wrong, Evil Desk(Pariah) has a better answer.

Post has been edited 1 time(s), last time on Aug 3 2009, 7:26 am by Falkoner.



None.

Aug 3 2009, 7:25 am Demented Shaman Post #9



Quote from Exigence
one thing i dont understand is when you set the Player to Current Player, to who does that trigger respond to? the owner of the trigger or the player set in the conditions of the trigger?
Current player always refers to the player that is running the trigger. If Player 1 owns the trigger then the trigger only runs for player 1 and thus current player is player 1. If Force 1 owns the trigger then current player is whoever in Force 1 is running the trigger. Each person in Force 1 will run a copy of the trigger at some point.

This is why understanding trigger order is helpful. All of player 1's triggers run first and then all of player 2 and then player 3 and so on until player 8. Then it goes back to player 1. This is regardless of when the triggers were created in the editor. It doesn't matter if a trigger for player 2 was created before a trigger for player 1. The only time it matters is when the triggers you're talking about are for the same player, but even still it depends on if you have moved the triggers as well.

When a trigger is owned by All players or a Force it is the same as if you had the trigger owned by each player in the force.

For example, let's say at the beginning of the game I want to create a unit for all players.

I could make 8 separate triggers owned by 8 different players and it would look something like this:

Quote
Owner: Player 1
Condition: Always
Action: Create marine at anywhere for player 1

Owner: Player 2
Condition: Always
Action: Create marine at anywhere for player 2

Owner: Player 3
Condition: Always
Action: Create marine at anywhere for player 3

And so on for players 4 through 8. That's a total of 8 triggers with only the player #'s changing.

However, I could accomplish the same task in just one trigger.

Quote
Owner: All Players
Condition: Always
Action: Create marine at anywhere for current player

That is the equivalent of the 8 triggers above.

And this is also equivalent to the other two examples:
Quote
Owner: Player 1, Player 2, Player 3 .... Player 8
Condition: Always
Action: Create marine at anywhere for current player


Post has been edited 1 time(s), last time on Aug 3 2009, 7:32 am by Pariah.



None.

Aug 3 2009, 9:22 am Ahli Post #10

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

Quote from name:Pariah
Also, in Ahli's method if two players run the spawn trigger in the same trigger cycle then the first player's display message will be overwritten because the conditions of the death count will change before other players get a chance to run their display trigger.
There is this switch related to a DC that creates a cooldown of saving someone. I thought then only 1 can be saved every x > 1 trigger cycles.
But your triggers will work fine.




Aug 3 2009, 5:08 pm Exigence Post #11



i wish i had this understanding before i started mapping :crazy:
im reaching switch limits, location limits and every other limit under the sun lol.
im hoping there isnt a trigger limit?



None.

Aug 3 2009, 5:41 pm Kaias Post #12



Quote from Exigence
im hoping there isnt a trigger limit?
Not one that you could ever be in danger of hitting.



None.

Aug 3 2009, 6:05 pm Ahli Post #13

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

Quote from Kaias
Quote from Exigence
im hoping there isnt a trigger limit?
Not one that you could ever be in danger of hitting.
Only I could hit it atm... but first I would hit scmdraft's limits again (I can't save 120.000 triggers, woot?) :>




Aug 3 2009, 7:30 pm Exigence Post #14



lmao. what are you working on O_O



None.

Aug 3 2009, 7:44 pm Pyro682 Post #15



Yea, Ahli is the biggest trigger whore for SEN. You don't have to worry about it. He's working on a Diablo map, (RPG for the contest)
I'm starting to think that SC itself doesn't have a trigger limit.



None.

Aug 3 2009, 7:50 pm Exigence Post #16



haha jeez. goodluck with that. whats the best way to add a delay to the 'saving player' system?

im thinking either a DC that constantly counts down from like two seconds (although the loophole is that sometimes the save would be INSTANT or a full 2 seconds or anywhere in between)

-OR-

A DC that adds '24' (2 seconds) everytime a unit on the force dies. only when it reaches '0' the unit can be saved. the problem with that is according to order, the spawning triggers aren't affected.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[01:19 pm]
Vrael -- IM GONNA MANUFACTURE SOME SPORTBALL EQUIPMENT WHERE THE SUN DONT SHINE BOY
[01:35 am]
Ultraviolet -- Vrael
Vrael shouted: NEED SOME SPORTBALL> WE GOT YOUR SPORTBALL EQUIPMENT MANUFACTURING
Gonna put deez sportballs in your mouth
[2024-5-01. : 1: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.
Please log in to shout.


Members Online: NudeRaider