I do want him to respawn in water if carrying the aqualung though.
How would I fix this?
Possibly it's the respawn part thats throwing the game off. I believe the default for water death is '5', so look in the Player.gs file for func PlayerRespawn(). The two PlayerSet lines use XSAFE & YSAFE. Copy the whole function and paste it under the respawn function. Name it func PlayerRespawn_5() and switch the PlayerSet lines.
func PlayerRespawn_5() //water death
{
//respawn
SamplePlay(FX_RESPAWN);
PlayerSet(P_DEATH, 0);
PlayerSet(P_LIFE, 100);
PlayerSet (P_X, GameGet(G_WATER X) );
PlayerSet (P_Y, GameGet(G_WATERY));
PlayerEnterIdle();
MusicFade(0,3);
MusicRestore();
}
If you've been adding your own respawn functions that respawn Dizzy to specific co-ordinates, make sure you don't have another PlayerRespawn_5() function. If so, change the number in the 'death' property of the object and the number in the respawn function.
Hope this works.
Possibly it's the respawn part thats throwing the game off. I believe the default for water death is '5', so look in the Player.gs file for func PlayerRespawn(). The two PlayerSet lines use XSAFE & YSAFE. Copy the whole function and paste it under the respawn function. Name it func PlayerRespawn_5() and switch the PlayerSet lines.
func PlayerRespawn_5() //water death
{
//respawn
SamplePlay(FX_RESPAWN);
PlayerSet(P_DEATH, 0);
PlayerSet(P_LIFE, 100);
PlayerSet (P_X, GameGet(G_WATER X) );
PlayerSet (P_Y, GameGet(G_WATERY));
PlayerEnterIdle();
MusicFade(0,3);
MusicRestore();
}
If you've been adding your own respawn functions that respawn Dizzy to specific co-ordinates, make sure you don't have another PlayerRespawn_5() function. If so, change the number in the 'death' property of the object and the number in the respawn function.
Hope this works.
[/quote]Nah its not working, I don't know what I'm doing wrong and to be perfectly honest, at this point I'm about to give up and scrap the game.
OK, having made my own little game I've got it to work with a small change in the respawn function in Player.GS.
Add the two global defines in GameDef.GS and the extra coding in the HandlerPlayerUpdate (between cloud and water) as in Jamie's post. Then replace func PlayerRespawn() in the Player.GS file with the following:
func PlayerRespawn()
{
SamplePlay(FX_RESPAWN);
PlayerSet(P_DEATH, 0);
PlayerSet(P_LIFE, 100);
if (InventoryHasItem(100)) // id of the scuba/aqualung
{
PlayerSet(P_X, PlayerGet(P_XSAFE));
PlayerSet(P_Y, PlayerGet(P_YSAFE)):
}
else
{
PlayerSet(P_X, GameGet(G_WATER X) );
PlayerSet(P_Y, GameGet(G_WATERY));
}
PlayerEnterIdle();
MusicFade(0,3);
MusicRestore();
}
My game had a pond with a ledge on either side and a fish in the middle. Without the scuba when Dizzy either drowns or is eaten by the fish he respawns at the edge of the ledge he entered the water. When wearing the scuba and eaten by the fish he respawns just next to the fish that ate him.
I'll keep my fingers crossed that this works for both of you.
I’ll keep my fingers crossed that this works for both of you.
[/quote]YES! It works thanks!
There is an error in your above code tho, theres a colon instead of a semi-colon on the 9th line.