Author Topic: Make a player "ignore" water?  (Read 1881 times)

You see, I'm trying to make an item that, when used, would make a player basically sink to the bottom of water and walk around like normal.

The only problem is that I'm not sure how I should go about doing this.

I've tried the following:
  • Increasing the player datablock density. However, if I bump this even to 2, I slide madly down slopes with no control, but it DOES get me under the water in the way I kind of want...
  • Defining a PlayerData::onEnterLiquid(%DB, %obj, %coverage, %type) to simply return. This accomplishes nothing.

I do NOT want to manipulate the map's water density/viscosity, as this item needs to be used on all maps.
I already have functions defined for making the player change datablocks and such with the desired effect.

Help pl0x?

Try adding a physical zone with weird gravity.

I CAN NOT TINKER WITH THE MAPS IN THE PROCESS

I hope I made that clear...
The point is for the item to be able to be used on any map.

Any other ideas?

Make them crouch then play the root animation to make them stand.

Try increasing player mass.

Try increasing player mass.
Tried that, doesn't effect anything...
Make them crouch then play the root animation to make them stand.
K, I'll try that later...

You could apply force downward when they enter the water if they have the object on, so it would make them sink.

I don't think there's a good way to do this without modifying the map / mission.

You could also make diving weights that add to the players weight so the player goes downward.

Ok, I just realized, mass DOES have an effect here. I wasn't remembering what numbers I was changing in my player datablock.

Apperantly, super-high density DOES work, I just had a high mass at the same time, which messed me up. Sinking works as well as it can nao.

Only, I have a few problems still.

1. Playing root animation underwater doesn't work. Nothing happens.
I'm using this command within a slash command:
Code: [Select]
%client.player.playthread(0,root);
2. I also don't want this player to take damage. I made sure that it just plain returns on the new player datablock's ::OnDamage function, but the player still impulses on a hit, what should I do here? I know it has something to do with ::OnCollision...?

3. I don't want the player to be able to change colors during the effect of the script. (It changes node "ALL" to a shade of gray, but if the player is painted or changes clothing under the effect, they revert to original colors.) What should I package over? More ::OnCollision stuff?

4. For some reason, when the function that reverts the player back to normal is called, it doesn't change the datablock of the player back to normal, if the player is outside of a minigame.
Not really working codez:
{code}      if(getMiniGameFromObject(%obj)) {   
         %minigame = getMiniGameFromObject(%obj);
         echo(%minigame.PlayerDataBlock);
         %obj.setDataBlock(nametoID(%minigame.PlayerDataBlock));
      }
      else %obj.setDataBlock(nametoId("PlayerStandardArmor"));
{/code}
The part that executes within the if works fine, and the player is reverted successfully, but the else doesn't work right. It always says "Can't find datablock "-1" ". And yet, when I perform the exact same NameToID("PlayerStandardArmor"); function within the console (inside an echo), it always produces a number. And yet, if I try doing the same thing with that number, it still produces the "Can't find -1" error. It works fine changing the datablock to the "new" player datablock, but not the other way around. I have to use the mission editor to revert it... and even so it doesn't make it work right.

Help appreciated much.
« Last Edit: November 23, 2007, 02:11:09 PM by Kirbylikesit »

Is this a Gravity Suit?

Is this a Gravity Suit?
Err... No...
Thanks for bumping.

But I still do need help from 2 posts up.

tl;dr-ers: here's a summary:

1. Can't get root to play underwater. Don't know why.

2. I can make the player not take damage, but I don't want him to impulse either. What should I do to do that?

3. I don't want the player to be able to be painted; that makes him revert from the effect to normal clothing. What should I do to prevent that?

Isn't there a anti-painting script?

Isn't there a anti-painting script?
Not that I could easily search for.
I doubt it.

Code: [Select]
function paintProjectile::OnCollision(%this, %obj, %col, %fade, %pos, %normal){
if(%col.getClassName() $= "Player"){ return; }
parent::OnCollision(%this, %obj, %col, %fade, %pos, %normal);
}