| 01-21-2008, 07:31 PM | #1 |
Hi ho :) I've got a very weird problem. I was messing around converting GUI to decent vJass and such. And suddenly, when I tested the map, I started being player 2, instead of default player 1, but I appeared on the player 1 starting location, although it are fixed locations (obviously, it's a TD). Now I'm not going to ask you to analyze my code or so, I'm just asking: is it actually even possible to make a person switch players on runtime? I thought it wasn't, but this somehow really looks like it. Even if I just make a custom game with Warcraft III, and I actually close all other player slots, I keep being player 2... I for example choose to be red, but I get the colour of player two... It's happening somewhere in between some Jass code, because I know for debugging reasons I give five wood to player 1 at the beginning of map initialization, and I still got that. It's quite clear I'm player 2, instead of 1. I get the colour of player 2, and I made a quick test trigger, that gives you your player number when you ask it through chat, and he says I'm player 2. The only thing that's not player 2 about me is that I start at player 1 starting location, although it's fixed. This obviously messes up whole my TD. The creeps try to run to the creeps finish location of player 2, but I am on player 1's starting location, so they just start hugging the wall. I also tested it with a computer being player two at setup, but then when I start the game, his name is Player 2 (but that's just a name), but he's got the colour of player three. And he also returns the number of player 3 when I ask for it (2 as an integer, because it starts at 0). Thanks in advance, Jitse |
| 01-21-2008, 10:01 PM | #2 |
well obviously it's possible so post code! |
| 01-24-2008, 08:01 PM | #3 | |
Oh my god... Hehehehe... It was a melange of circumstances that made me actually really think I in some mysterious way changed the players during gameplay. ![]() One of the things I noticed was that the creeps started running to the finishing spot of the next player, instead of the current player itself. Now I found out that was just illusion, they were actually all just walking to 0,0. I've got something to remember now: never assign the globals created with WE itself manually, in the initializer code of a library. Because vJass seems to put the execution just before the actual internal assignments of udg_ globals by WE itself. So everything you do with udg_'s in a library initializer, will just be nullified. xD Now the most important thing that made me think I suddenly somehow switched players, was that the colours swapped. This is actually very stupid. You know that little option you got, a button next to the minimap, that hides the actual colours of the players, and instead shows you as blue, and allies as teal? Lol, that was it. :p I probably accidentally hotkey'ed it or so. Now the final thing that made me be absolutely certain about the player swapping, was that the player numbers actually told me I was player 2. But I now realize that GetConvertedPlayerId does +1 again ( so you have to do -1 yourself once again in some situations ^.- ). When it showed 1 I really thought he meant Player 2, because internally you start at 0 with the players. (I know, I know, I could have checked the internal code of GetConvertedPlayerId.) Anyway, situation enlighted, you can all start calling me noob now. Edit: Quote:
Eh, what did you actually mean with "obviously it's possible"? |
| 01-24-2008, 08:07 PM | #4 |
Using GetConvertedPlayerId() is pretty useless and only adds inefficiency to the code - I recommend using GetPlayerId(), in fact, I don't just recommend it. If you don't use it I will personally plant weeds in your garden so that your neighbors are disgusted and send you angry letters. |
| 01-24-2008, 08:21 PM | #5 |
I don't have neighbours, pwned. |
