Buu342 Posted November 13, 2016 Hey there. I'm working on a minigame gamemode, and I'm having some small issues. Three main bugs to be exact. They are as follows. 1) Thing_Move SOMETIMES causes the following bug: "Warning! Cannot Find Start point: (X,Y)" Solved. Apparently there were map spots outside the boundaries of the map. So as my minigame gamemode is round based, sometimes I have to teleport the player out of the waiting arena, but sometimes ONLY THE SECOND PLAYER doesn't make it to a mapspot assigned for him. Instead, I get that error message with a random X and Y coordinate, and at the same time the player gets killed 10 times in a row. The annoying thing is that some of the minigames do this while others don't, and it's ONLY for the second player. The players are being teleported like this: There are map spots in the arena with 16 unique TID's. Upon joining, the player is given a Unique TID based off the amount of players in the server and their ID is stored in a variable. Thing_ChangeTID(0, 1337+PlayerNumber()); ID[PlayerNumber()] = 1337+PlayerNumber(); Before being teleported, I spawn a mapspot on their location with their ID + 1000. Then I move them to the arena via: thing_move(ID[PlayerNumber()],50+ID[PlayerNumber()]-1337,false); Once the minigame is finished, they get teleported back to the mapspot with their ID + 1000, and then the mapspot is removed. So why does the second player and ONLY the second player SOMETIMES fail to teleport? 2) Unmorphing causes the game to crash.Solved! I stopped using powerups and instead used MorphActor() In one of the minigames, I cause the player to get morphed into a class where they cannot move, and must do so using a weapon which moves them utilizing recoil. Upon the minigame finishing, the players are morphed back into the DoomPlayer class again, however sometimes this causes a crash. Whether this happens or not seems to be random too... Decorate code: Spoiler ACTOR KartPlayer : DoomPlayer { player.forwardmove 0 player.sidemove 0 player.viewheight 24 player.jumpz 0 Health 100 Radius 16 Height 30 Mass 100 Player.ColorRange 112, 127 PainSound "" DeathSound "" Player.MorphWeapon "KartWeapon" Player.SpawnClass "KartPlayer" Player.SoundClass "player" Player.DisplayName "KartPlayer" +NOBLOOD +pushable +NOSKIN States { Pain: Melee: Missile: Goto See See: Spawn: KART A 5 Loop Death: MISL B 5 bright A_Playsound("weapons/rocklx") MISL C 5 bright MISL D 5 bright MISL D -1 Stop Death: goto Death } } ACTOR KartMorpher : PowerupGiver 15814 { Powerup.Type PowerKartPlayer Powerup.Duration 0x7FFFFFFF Inventory.MaxAmount 0 +INVENTORY.AUTOACTIVATE Inventory.PickupMessage "" States { Spawn: KART A -1 Stop } } ACTOR PowerKartPlayer : PowerMorph { PowerMorph.PlayerClass "KartPlayer" } actor KartWeapon : DoomWeapon { Weapon.SelectionOrder 2000 +WEAPON.DONTBOB Weapon.KickBack 20000 States { Ready: KRTW A 1 A_WeaponReady KRTW A 0 A_StopSound(6) loop Deselect: KRTW A 0 A_StopSound(6) KRTW A 1 A_Lower loop Select: KRTW A 1 A_Raise Loop Fire: KRTW A 2 A_Recoil(-4) KRTW A 0 A_PlaySound("DoomWare/KartEngine", 6, 1) KRTW A 0 A_ReFire goto Ready AltFire: goto Ready } } ACS code: Spoiler SetActorAngle(0,0.25); SetFont("BIGFONT"); SpawnSpotForced("MapSpot",ID[PlayerNumber()],ID[PlayerNumber()]+1000,0); thing_move(ID[PlayerNumber()],170+ID[PlayerNumber()]-1337,false); SetFont("BIGFONT"); SpawnSpotForced("KartTranslator",ID[PlayerNumber()],ID[PlayerNumber()]+2000,0); Thing_SetTranslation(ID[PlayerNumber()]+2000,-1); GiveInventory("KartMorpher",1); Thing_SetTranslation(0,-1); hudmessage(s:"Finish a lap";HUDMSG_PLAIN,1,cR_ORANGE,0.5,0.3,1); hudmessage(s:"\n\nShoot To Accelerate";HUDMSG_PLAIN,2,cR_RED,0.5,0.3,1); setplayerproperty(1, 1, PROP_TOTALLYFROZEN); delay(70); setplayerproperty(1, 0, PROP_TOTALLYFROZEN); delay(630-(35*SpeedupNum)); hudmessage(s:"";HUDMSG_PLAIN,2,cR_ORANGE,0.5,0.3,1); TakeInventory("KartWeapon",1); UnMorphActor(0,true); thing_move(ID[PlayerNumber()],ID[PlayerNumber()]+1000,false); thing_remove(ID[PlayerNumber()]+1000); // Code stuff Script 251 (void) { Thing_SetTranslation(ID[PlayerNumber()],-1); delay(1); thing_remove(0); } Crash Report: http://www.mediafire.com/file/bbc718c68adth57/CrashReport.zip 3) Player Color Not Being Applied To Morphed Player From Question AboveSolved! Player TID is apparently reset upon morphing. Simply setting it back using Thing_ChangeTID fixed the problem. This one isn't as urgent, but is still a bit odd. So the morphed player doesn't seem to be keeping his translation after being morphed. if you read the ACS code above, you might have noticed a Thing called "KartTranslator". The thing is supposed to execute a script which sets the color it was translated to via Thing_SetTranslation(ID[PlayerNumber()]+2000,-1); However it doesn't seem to work. Applying a translation right after the player has been morphed works without flaw, so why doesn't it work like this? Is there a way to get the players' translation color? Thanks guys! 0 Quote Share this post Link to post
scifista42 Posted November 13, 2016 Buu342 said:ID[PlayerNumber()] = 1337+PlayerNumber(); Why use an array to store a value that is linearly dependant (badly used term) depends just on the array index? You could just write "1337+PlayerNumber()" everytime instead of "ID[PlayerNumber()]", or even define a function or macro that accepts any integer as a parameter and returns 1337 + that integer.Buu342 said:Before being teleported, I spawn a mapspot on their location with their ID + 1000. Then I move them to the arena via: thing_move(ID[PlayerNumber()],50+ID[PlayerNumber()]-1337,false); Try if it works with "1337+PlayerNumber()" instead of "ID[PlayerNumber()]" and with "50+PlayerNumber()" instead of "50+ID[PlayerNumber()]-1337". 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 scifista42 said:Why use an array to store a value that is linearly dependant on the array index? You could just write "1337+PlayerNumber()" everytime instead of "ID[PlayerNumber()]", or even define a function or macro that accepts any integer as a parameter and returns 1337 + that integer. Try if it works with "1337+PlayerNumber()" instead of "ID[PlayerNumber()]" and with "50+PlayerNumber()" instead of "50+ID[PlayerNumber()]-1337". There's something I don't quite Understand. Does PlayerNumber return the number of players in a map or does it return the number of players that have joined? By the last one I mean everytime someone joins the server, PlayerNumber is like an ID given to the player based off how many players had previously joined before + 1. Regardless, utilizing 50+PlayerNumber() did not help. 0 Quote Share this post Link to post
scifista42 Posted November 13, 2016 Buu342 said:Does PlayerNumber return the number of players in a map or does it return the number of players that have joined? Neither. It returns the current script activator's player number that was assigned to him automatically when he joined the game. You can't always and don't ever need to know how this automatic assignment works. All that matters is that each particular player has a particular unique number, and each time you call PlayerNumber in a script activated by the same player, it will return the same number.Buu342 said:PlayerNumber is like an ID given to the player This is right. PlayerNumber() returns this ID.Buu342 said:Regardless, utilizing 50+PlayerNumber() did not help. How exactly do you spawn the mapspots? 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 scifista42 said:Neither. It returns the current script activator's player number that was assigned to him automatically when he joined the game. You can't always and don't ever need to know how this automatic assignment works. All that matters is that each particular player has a particular unique number, and each time you call PlayerNumber in a script activated by the same player, it will return the same number. This is right. PlayerNumber() returns this ID. How exactly do you spawn the mapspots? Well, it would help to know how the system works, because if that's the case I might need to redo the way I'm doing this. If we have 16 players, and 1 leaves, and another one joins, that player will have an ID of 17, which means he won't be teleported to the correct map spot. The map spots they get teleported to are already placed in the map. The ones that they spawn in order to be teleported back to the waiting room after the minigame completes is like this: SpawnSpotForced("MapSpot",ID[PlayerNumber()],ID[PlayerNumber()]+1000,0); thing_move(ID[PlayerNumber()],90+ID[PlayerNumber()]-1337,false); Delay(70); // Time for the Minigame thing_move(ID[PlayerNumber()],ID[PlayerNumber()]+1000,false); thing_remove(ID[PlayerNumber()]+1000); I was under the impression it returned the amount of players CURRENTLY in the map, so I was assigning an array as it would store that players' special ID based off the amount of players WHEN he joined the map. 0 Quote Share this post Link to post
scifista42 Posted November 13, 2016 Buu342 said:If we have 16 players, and 1 leaves, and another one joins, that player will have an ID of 17, I think if one player left and another joined, he would be assigned the number that formerly belonged to the one who left. Just a guess based on an assumption that the engine tries to be efficient. (EDIT: After all, the player numbers are probably directly related to the engine's player limit, which is a perfect reason for it to try to keep them as low as possible, because assigning higher ones than the limit would be impossible.)Buu342 said:I was under the impression it returned the amount of players CURRENTLY in the map, Let go of the idea that the return value of PlayerNumber() is in any way related to OTHER players than the one who activated the current script, no matter if it's an ENTER script or one that was called later. 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 scifista42 said:I think if one player left and another joined, he would be assigned the number that formerly belonged to the one who left. Just a guess based on an assumption that the engine tries to be efficient. Let go of the idea that the return value of PlayerNumber() is in any way related to OTHER players than the one who activated the current script, no matter if it's an ENTER script or one that was called later. If that's the case then all should be good. I'll give a quick shot at replacing the ID system I set up then. 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 NOW I remember why I was using the ID system. When the player was killed, his corpse would keep his ID, meaning that it too would be teleported all over the place, at times telefragging. So I was using the ID system to keep track of the players' ID so that upon respawning he could be given it back. But if what you said was correct, I won't be needing this system anymore. 0 Quote Share this post Link to post
scifista42 Posted November 13, 2016 You could use a DEATH script to just change the corpse's TID to 0. 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 scifista42 said:You could use a DEATH script to just change the corpse's TID to 0. That's what I was doing, and then in Respawn I was setting the player's ID back to the one he was assigned to in the beginning of the game. 0 Quote Share this post Link to post
scifista42 Posted November 13, 2016 It was always unnecessary to keep track of the player's "ID" in a custom array when the engine already does it internally and said "ID" is always accessible via the PlayerNumber function. 0 Quote Share this post Link to post
Buu342 Posted November 13, 2016 scifista42 said:It was always unnecessary to keep track of the player's "ID" in a custom array when the engine already does it internally and said "ID" is accessible via the PlayerNumber function. Yeah I understand that now. The Wiki wasn't really explanative of what PlayerNumber was, so I had to make some assumptions. I've finished replacing everything, testing now. Edit: Still having the same issue with thing_move. The gamemode works flawlessly however. Edit Edit: I made an interesting discovery. Apparently a massive sea of map spots were located way out of the boundaries of the map. How they got here? No clue. Most of them were using Unique TID's which I never assigned anything to before. Must have been a bug with Doom Builder 2 back when i was using it before switching to GZDoom Builder. That's fixed now. 1 down, 2 to go! 0 Quote Share this post Link to post
Buu342 Posted November 14, 2016 Everything is fixed now! Check the OP for details. Thank you everyone! 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.