Hello, I'm an ex-starcraft mapmaker and I'm having some trouble adapting to the trigger style of SC2, seeing how it's 100 times more complex.
In the rpg map I'm making, heroes are specific. Normally, in SC or WC3 I would have set player 1 as hero 1, player 2 as hero 2, etc... I understand that the player order is determined solely by joining order in SC2, and I presume that is why you can no longer return a player number.
I need to find a substitute. In principle, I want to tell every player "remember this number", so that when I have triggers that are dependant on being a certain player, particularly when I need to look up that hero's value in an array, I can simply return that number and look up the relevant values.
Now, I haven't figured out a way to do that elegantly. The way I've done it now is that I've set a certain upgrade called "player number", assigned a different level for every different hero at map start, and I look up the upgrade level for that particular upgrade whenever I want to return the 'effective player number'. But I'm aware that this is a fairly clumsy method, and I was wondering if there was any more elegant suggestions.
What if that hero dies?
What if he's not currently owning said hero?
What if he's temporarily controlling some other unit because of the story?
No, too many bug potentials with that.
Plus, that woudn't return a number, would it? Unless I do a function that compares each unit and returns the associated number everytime I want to, say, edit a position in an array.
what about using an array like playerHero[X] (type: Unit), and modify that whenever they change their hero?
player clicks a "Pick the Zealot" button -> give control and set playerHero[Triggering Player] = Zealot;
X is the total number of players +1
If any player triggers an event, you can do something on his unit by using again playerHero[Triggering Player]
I just want to know a good way to return a number for a player. In WC3, if I wanted to edit an array value called, say, skillpoints[i] where i was the player number, I simply needed to use 'set skillpoints[playernumber(triggering player)]'.
In SC2, first you can't simply return a player number, and second it woudn't be very useful, because the player number is not determined by where you're sitting in the lobby, but the join order.
Thus, I need another way to return an 'effective player number'. I figured just assigning an upgrade of different levels to different players and counting those levels, but it seems pretty messy. I thought someone else might have had a cleverer way.
You don't need to, Triggering Player is an Integer and already means "number of player (Triggering Player)".
Also, yes the player number is determined by the join order, but you can setup teams if you need to split roles.
I was gonna experiment with game attributes, somehow getting lobby players to select a number relevant to their slot and then using that in game to determine their slot position. But haven't tried with that yet. It'd only work if the host makes sure it's line up 1-12 top to bottom in the lobby. or wevs, maybe they can be used a diff way too.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello, I'm an ex-starcraft mapmaker and I'm having some trouble adapting to the trigger style of SC2, seeing how it's 100 times more complex.
In the rpg map I'm making, heroes are specific. Normally, in SC or WC3 I would have set player 1 as hero 1, player 2 as hero 2, etc... I understand that the player order is determined solely by joining order in SC2, and I presume that is why you can no longer return a player number.
I need to find a substitute. In principle, I want to tell every player "remember this number", so that when I have triggers that are dependant on being a certain player, particularly when I need to look up that hero's value in an array, I can simply return that number and look up the relevant values.
Now, I haven't figured out a way to do that elegantly. The way I've done it now is that I've set a certain upgrade called "player number", assigned a different level for every different hero at map start, and I look up the upgrade level for that particular upgrade whenever I want to return the 'effective player number'. But I'm aware that this is a fairly clumsy method, and I was wondering if there was any more elegant suggestions.
@Xatham: Go
Why don't you just use Owner of Unit to get the player who controls a hero?
@RileyStarcraft: Go
What if that hero dies? What if he's not currently owning said hero? What if he's temporarily controlling some other unit because of the story?
No, too many bug potentials with that.
Plus, that woudn't return a number, would it? Unless I do a function that compares each unit and returns the associated number everytime I want to, say, edit a position in an array.
I don't think I understand your problem...
what about using an array like playerHero[X] (type: Unit), and modify that whenever they change their hero?
player clicks a "Pick the Zealot" button -> give control and set playerHero[Triggering Player] = Zealot;
X is the total number of players +1
If any player triggers an event, you can do something on his unit by using again playerHero[Triggering Player]
Yes, players are considered "numbers" based on the slot they occupy. That number doesn't change during gameplay.
I just want to know a good way to return a number for a player. In WC3, if I wanted to edit an array value called, say, skillpoints[i] where i was the player number, I simply needed to use 'set skillpoints[playernumber(triggering player)]'.
In SC2, first you can't simply return a player number, and second it woudn't be very useful, because the player number is not determined by where you're sitting in the lobby, but the join order.
Thus, I need another way to return an 'effective player number'. I figured just assigning an upgrade of different levels to different players and counting those levels, but it seems pretty messy. I thought someone else might have had a cleverer way.
You don't need to, Triggering Player is an Integer and already means "number of player (Triggering Player)".
Also, yes the player number is determined by the join order, but you can setup teams if you need to split roles.
I was gonna experiment with game attributes, somehow getting lobby players to select a number relevant to their slot and then using that in game to determine their slot position. But haven't tried with that yet. It'd only work if the host makes sure it's line up 1-12 top to bottom in the lobby. or wevs, maybe they can be used a diff way too.