Author Topic: SOLVED: Sink in Liquid, no upward movement Playertype  (Read 2754 times)

Solved it myself.

set jumpforce to 0 in the sink playertype and used two functions to regulate between the playertypes for when they enter/leave water

Code: [Select]
function PlayerParkourArmor::onEnterLiquid(%this,%obj,%cov,%type)
{
%obj.changeDatablock(FloodPlayer_Sink);
Parent::onEnterLiquid(%this,%obj,%cov,%type);
}
function FloodPlayer_Sink::onLeaveLiquid(%this,%obj,%cov,%type)
{
%obj.changeDatablock(PlayerParkourArmor);
Parent::onLeaveLiquid(%this,%obj,%cov,%type);
}
« Last Edit: October 25, 2014, 12:23:56 AM by Tezuni 2.0 »

Just being picky here, but generally it's a good idea to code your mods in a way where they cannot even potentially interfere with other mods / normal game operation. This code will always change the player datablock on entering or leaving lava, regardless of if they're part of the minigame or whatever.

The best way to solve it is to make sure that the player is already of the opposite datablock. If someone isn't participating in the game, they won't have the playertype of PlayerParkourArmor and so on entering the water they won't be changed from PlayerStandardArmor to FloodPlayer_Sink.

Code: [Select]
function PlayerParkourArmor::onEnterLiquid(%this,%obj,%cov,%type)
{
if(%obj.getDatablock().getID() == PlayerParkourArmor.getID())
%obj.changeDatablock(FloodPlayer_Sink);
Parent::onEnterLiquid(%this,%obj,%cov,%type);
}
function FloodPlayer_Sink::onLeaveLiquid(%this,%obj,%cov,%type)
{
if(%obj.getDatablock().getID() == FloodPlayer_Sink.getID())
%obj.changeDatablock(PlayerParkourArmor);
Parent::onLeaveLiquid(%this,%obj,%cov,%type);
}

Just being picky here, but generally it's a good idea to code your mods in a way where they cannot even potentially interfere with other mods / normal game operation. This code will always change the player datablock on entering or leaving lava, regardless of if they're part of the minigame or whatever.

The best way to solve it is to make sure that the player is already of the opposite datablock. If someone isn't participating in the game, they won't have the playertype of PlayerParkourArmor and so on entering the water they won't be changed from PlayerStandardArmor to FloodPlayer_Sink.

Code: [Select]
function PlayerParkourArmor::onEnterLiquid(%this,%obj,%cov,%type)
{
if(%obj.getDatablock().getID() == PlayerParkourArmor.getID())
%obj.changeDatablock(FloodPlayer_Sink);
Parent::onEnterLiquid(%this,%obj,%cov,%type);
}
function FloodPlayer_Sink::onLeaveLiquid(%this,%obj,%cov,%type)
{
if(%obj.getDatablock().getID() == FloodPlayer_Sink.getID())
%obj.changeDatablock(PlayerParkourArmor);
Parent::onLeaveLiquid(%this,%obj,%cov,%type);
}
Wait, isn't that why the functions are methods of the respective datablocks?
Quote
function PlayerParkourArmor::onEnterLiquid
function FloodPlayer_Sink::onLeaveLiquid

woaaaah I'm a dumbass, I totally missed that and thought he was parenting armor::onEnterLiquid. Ignore me, I'm being silly.