Author Topic: Animation for underwater  (Read 611 times)

I was making a fish player type for fun, and I was wondering if there was a script for when the player enters water, it plays this animation. Any help?
« Last Edit: August 08, 2009, 05:46:30 PM by DarkStar »

You could look at Traders water events script for entering water.

Code: [Select]
Package Fishy{
armor::onEnterWater(%client)
{
%client.player.setDataBlock(Fish);
}
};
ActivatePackage(Fishy);
Isnt it something like that?

Code: [Select]
Package Fishy{
armor::onEnterWater(%client)
{
%client.player.setDataBlock(Fish);
}
};
ActivatePackage(Fishy);
Isnt it something like that?
Are you 100% sure the first parameter is a GameConnection?

And you should have a %this anyway. You didn't parent it either.

K fixed it.
Code: [Select]
package fishy
{
function armor::onEnterLiquid(%this, %obj, %coverage, %type)
{
Parent::onEnterLiquid(%this, %obj, %coverage, %type);
%obj.setDataBlock(FishPlayer);
}
function Armor::onLeaveLiquid(%this, %obj, %type)
{
Parent::onEnterLiquid(%this, %obj, %type);
%obj.setDataBlock(StandardPlayerArmor);
}
};
activatepackage(fishy);
Change FishPlayer to whatever your player datablock is.
And yes I DID test this code.. the other I didnt =P
« Last Edit: August 09, 2009, 11:41:32 AM by ZSNO »

uh, but how would I make it play an animation when it enters the liquid? %obj.playthread(run); or something after onEnterLiquid? Cause it didn't seem to work :/

Are you trying to make a whole new player, or add a .dsq to the player?

I'm making a whole new player, its a fish player type and I wanted it to just play 1 animation underwater, If I made it the one for crouch, it'll get messed up if he goes above water like to look out or something. Cause the crouch animation plays backwards to the beginning. So I just wanted to set an animation for one of the sequences that won't really be used(like the fall) and make it play once you enter the water.

ya, I dont really think you can, I just tried doing it, and it didnt let me.

ya, I dont really think you can, I just tried doing it, and it didnt let me.

I would say you were not the best person to be dictating what is and what is not possible in this game engine.

A playThread would work fine in an onEnterLiquid callback except I doubt you've actually set those animations up, or know how to use them.