Just getting into Sc2 map editor, lots of exciting stuff.. Used to mess around all day with Sc1 edit back in the day and a got into WC3 for a while, but I never learned player groups and such and now I want to write these triggers properly and am running into problems.
I have the function of the trigger working perfectly, for one person. Its a periodic event, that fires currently every .05 seconds of game time.
The problem is I want this trigger to run for each user controlled player in the game seperatley every time it fires. Obviously I don't want 4 plus copies of the same trigger, I'd rather do it all in one, but I'm not sure the best way to do this..
I have it set up right now in a player group -> pick every player in active players and do actions. I have arrays to hold the unit and other player specific values I need and am indexing them with picked player... But I'm not sure if this is going to run the trigger once with all the players selected somehow or run multiple copies of the actions at the same time, each dedicated to a player, which is what I want.
I'm not sure if I should be using the "For each player in player group" or the "Pick each player in player group" function... The trigger deals with movement of the players unit, so I need seperate instances of this trigger running for each player at the interval. And If I should use the for each player function what do I use to reference the current player in array index, like where I'm using picked player now?
My second question has to do with attachment points. I want to make a gun attached to a unit using an attachment point.
Right now I have it just creating a unit at the attachment point, but its not even making the unit.. How do I get the names of the attachment points? And will it actually attach it to the other unit or just create it at that point like this.. How the hell do I attach stuff basically, I know theres prob a thread but I can't find a good all around attachment thread, and I really want to know how to do that and make some crazy unit frankenstines as well as put a damn gun on my vulture's weapon mounts ><.
Just getting into Sc2 map editor, lots of exciting stuff.. Used to mess around all day with Sc1 edit back in the day and a got into WC3 for a while, but I never learned player groups and such and now I want to write these triggers properly and am running into problems.
I have the function of the trigger working perfectly, for one person. Its a periodic event, that fires currently every .05 seconds of game time.
The problem is I want this trigger to run for each user controlled player in the game seperatley every time it fires. Obviously I don't want 4 plus copies of the same trigger, I'd rather do it all in one, but I'm not sure the best way to do this..
I have it set up right now in a player group -> pick every player in active players and do actions. I have arrays to hold the unit and other player specific values I need and am indexing them with picked player... But I'm not sure if this is going to run the trigger once with all the players selected somehow or run multiple copies of the actions at the same time, each dedicated to a player, which is what I want.
It will run a the trigger in a single thread and complete the actions on each player sequentially. This will be more obvious to you if you add a "wait 1 second" action within the Pick Each Player actions group. You can have everything run "at the same time" by using an action definition with the "Create Thread" option checked for the actions you want. The actions won't all run exactly at the same time because the trigger still goes from one player to the next sequentially, but it will be so close that you probably won't notice.
I'm not sure if I should be using the "For each player in player group" or the "Pick each player in player group" function... The trigger deals with movement of the players unit, so I need seperate instances of this trigger running for each player at the interval. And If I should use the for each player function what do I use to reference the current player in array index, like where I'm using picked player now?
"For Each Player" works exactly the same as "Pick Each Player" except that it uses a variable you specify rather than the (picked player) function. The only real reason you should ever need to use "For Each Player" is if you have a stack where (picked player) would refer to 2 separate things. Like alliance triggers, for example:
My second question has to do with attachment points. I want to make a gun attached to a unit using an attachment point.
Right now I have it just creating a unit at the attachment point, but its not even making the unit.. How do I get the names of the attachment points? And will it actually attach it to the other unit or just create it at that point like this.. How the hell do I attach stuff basically, I know theres prob a thread but I can't find a good all around attachment thread, and I really want to know how to do that and make some crazy unit frankenstines as well as put a damn gun on my vulture's weapon mounts ><.
Thanks
Not my area of expertise, but I know there's a tutorial around here somewhere...
Thanks a lot BasharTeg, was insightful and what I needed to know :).
About attachment points though, I poked around and apparently there are two ways to make them, one method is through in game triggers andallows abilties to be put on the attached unit, which is what I need, other is through data editor somehow I think. Basically I want to make mountable weapons that will fire straight and impact the first unit, doodad or cliff they contact. I've found a sample map with a ability like this, but I have no friggen idea how I would make one of these from scratch, which I need to know. I think I can trigger it fairly easy to fire, the data editor just has me at a total loss and I dont really know where to begin, any ideas where I should start learning?
Oh and I read some thread about utilizing some multi thread funtionality of the engine or something. It said if you make a trigger that tells your others to fire, it will run them all at once and independantly of course and use system power more efficently. I'm thinking about setting it up like this..
Every 0.05 seconds of game play
Actions: fire a seperate movement trigger for each player that is active.
initially have say, all 4 players have actions in there to fire their trigger but just disable that action at game start if they are not present.
I think I can trigger it fairly easy to fire, the data editor just has me at a total loss and I dont really know where to begin, any ideas where I should start learning?
Check out the tutorials listing and go through the things that seem relevant to you. Obviously starting at the ones marked "Beginner" would probably be the best place to start.
Oh and I read some thread about utilizing some multi thread funtionality of the engine or something. It said if you make a trigger that tells your others to fire, it will run them all at once and independantly of course and use system power more efficently. I'm thinking about setting it up like this..
Well, that's not exactly true because a trigger still runs sequentially from the first action to the last. The only time trigger sequences overlap is when actions are happening in a different thread. To make a trigger fire 4 times simultaneously an event needs to be satisfied 4 times at once... but I strongly doubt you will need perfect timing with what you're looking for.
Every 0.05 seconds of game play Actions: fire a seperate movement trigger for each player that is active.
initially have say, all 4 players have actions in there to fire their trigger but just disable that action at game start if they are not present.
If a player is not present in a game he will not be in the group Active Players. You can also use a custom player group and manually remove players from it when they leave the game.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Just getting into Sc2 map editor, lots of exciting stuff.. Used to mess around all day with Sc1 edit back in the day and a got into WC3 for a while, but I never learned player groups and such and now I want to write these triggers properly and am running into problems.
I have the function of the trigger working perfectly, for one person. Its a periodic event, that fires currently every .05 seconds of game time.
The problem is I want this trigger to run for each user controlled player in the game seperatley every time it fires. Obviously I don't want 4 plus copies of the same trigger, I'd rather do it all in one, but I'm not sure the best way to do this..
I have it set up right now in a player group -> pick every player in active players and do actions. I have arrays to hold the unit and other player specific values I need and am indexing them with picked player... But I'm not sure if this is going to run the trigger once with all the players selected somehow or run multiple copies of the actions at the same time, each dedicated to a player, which is what I want.
I'm not sure if I should be using the "For each player in player group" or the "Pick each player in player group" function... The trigger deals with movement of the players unit, so I need seperate instances of this trigger running for each player at the interval. And If I should use the for each player function what do I use to reference the current player in array index, like where I'm using picked player now?
My second question has to do with attachment points. I want to make a gun attached to a unit using an attachment point.
Right now I have it just creating a unit at the attachment point, but its not even making the unit.. How do I get the names of the attachment points? And will it actually attach it to the other unit or just create it at that point like this.. How the hell do I attach stuff basically, I know theres prob a thread but I can't find a good all around attachment thread, and I really want to know how to do that and make some crazy unit frankenstines as well as put a damn gun on my vulture's weapon mounts ><.
Thanks
First of all, welcome to SC2Mapster!
It will run a the trigger in a single thread and complete the actions on each player sequentially. This will be more obvious to you if you add a "wait 1 second" action within the Pick Each Player actions group. You can have everything run "at the same time" by using an action definition with the "Create Thread" option checked for the actions you want. The actions won't all run exactly at the same time because the trigger still goes from one player to the next sequentially, but it will be so close that you probably won't notice.
"For Each Player" works exactly the same as "Pick Each Player" except that it uses a variable you specify rather than the (picked player) function. The only real reason you should ever need to use "For Each Player" is if you have a stack where (picked player) would refer to 2 separate things. Like alliance triggers, for example:
Not my area of expertise, but I know there's a tutorial around here somewhere...
Ah, try this.
I am currently working on a tutorial of my own that will help explain much of what I talked about here. Once it is finished I will provide a link.
Thanks a lot BasharTeg, was insightful and what I needed to know :).
About attachment points though, I poked around and apparently there are two ways to make them, one method is through in game triggers andallows abilties to be put on the attached unit, which is what I need, other is through data editor somehow I think. Basically I want to make mountable weapons that will fire straight and impact the first unit, doodad or cliff they contact. I've found a sample map with a ability like this, but I have no friggen idea how I would make one of these from scratch, which I need to know. I think I can trigger it fairly easy to fire, the data editor just has me at a total loss and I dont really know where to begin, any ideas where I should start learning?
Oh and I read some thread about utilizing some multi thread funtionality of the engine or something. It said if you make a trigger that tells your others to fire, it will run them all at once and independantly of course and use system power more efficently. I'm thinking about setting it up like this..
Every 0.05 seconds of game play Actions: fire a seperate movement trigger for each player that is active.
initially have say, all 4 players have actions in there to fire their trigger but just disable that action at game start if they are not present.
Check out the tutorials listing and go through the things that seem relevant to you. Obviously starting at the ones marked "Beginner" would probably be the best place to start.
Well, that's not exactly true because a trigger still runs sequentially from the first action to the last. The only time trigger sequences overlap is when actions are happening in a different thread. To make a trigger fire 4 times simultaneously an event needs to be satisfied 4 times at once... but I strongly doubt you will need perfect timing with what you're looking for.
If a player is not present in a game he will not be in the group Active Players. You can also use a custom player group and manually remove players from it when they leave the game.