Author Topic: When a player is caught by a shark/T Rex  (Read 2462 times)

Edited
When a player is caught by a shark/T Rex, the player can't use his weapon and can only wave his hands.
 Is it possible to let the player shoot/use his weapon while he's caught?

Code: [Select]
function SharkHoleBot::onBotCollision( %this, %obj, %col, %normal, %speed )
{
if( %obj.isDisabled() )
return;

%canDamage = miniGameCanDamage(%obj,%col);

if( isObject(%obj.hEating) || %obj.getMountedObject( 0 ) || %col.isDisabled() || %canDamage == 0 || %canDamage == -1 ) // !checkHoleBotTeams(%obj,%col) ||
return;

//Check if we can attack, then check if it's a minifig, then eat him//%col.isHoleBot &&
%oScale = getWord(%obj.getScale(),0);
%cScale = getWord(%col.getScale(),0);
// if( (!getRandom(0,1)|| %obj.hIsGreatWhite) && %obj.getState() !$= "Dead" && checkHoleBotTeams(%obj,%col) && !isObject(%obj.hEating) && %col.getState() !$= "Dead" && miniGameCanDamage(%obj,%col) == 1)

// if we collide with a vehicle then eject the player
// this may cause some funky things, but it should be entertaining
%wasEjected = 0;

// %checkTeam = checkHoleBotTeams(%obj,%col);

if( %col.getMountedObjectCount() && ( !getRandom( 0, 2 ) || %obj.hIsGreatWhite || ( %col.getType() & $TypeMasks::VehicleObjectType ) ) )
{
if( %col.hIsShark && %col.getMountedObject( 0 ).hIsShark )
return;

%col = %col.ejectRandomPlayer();
%wasEjected = 1;

if( %col.client )
%col.client.setControlObject( %col );
}

%checkTeam = checkHoleBotTeams(%obj,%col);

if( ( !getRandom(0,2)|| %obj.hIsGreatWhite || %wasEjected ) && %checkTeam )
{
if(  %oScale+0.5 >= %cScale && %col.getDataBlock().shapeFile $= "base/data/shapes/player/m.dts")
{
if(%col.getClassName() $= "Player" && %col.client)
{
%col.client.camera.setOrbitMode(%obj, %obj.getTransform(), 0, 10, 0, 1);
%col.client.setControlObject(%col.client.camera);
//hSpazzClick(%col,0,1);
}
%obj.stopHoleLoop();
%obj.hRunAwayFromPlayer(%col);
// %obj.setImageTrigger(3,1);
%obj.setCrouching(1);
%obj.mountObject(%col,2);

%obj.hIgnore = %col;
%obj.hEating = %col;
%obj.hLastEatTime = getSimTime();

// temporarily set the shark to invulnerable when he eats someone to avoid getting
%obj.invulnerable = true;
schedule( 200, %obj, eval, %obj @ ".invulnerable = false;" );

%obj.hSharkEatDelay = scheduleNoQuota(5000,0,holeSharkKill,%obj,%col);
return;
« Last Edit: August 25, 2016, 03:04:58 PM by BlockAlpha »

While a player caught by a shark/Trex, the player can't use his weapon but only waving his hands.
Does it possible to let the player shoot/use his weapon while he's been cought?
did you forget how to grammar?

i dont think english is his first language

i dont think english is his first language
really? he seemed pretty good at english-ing in his previous posts

really? he seemed pretty good at english-ing in his previous posts
Really? Thanks, it's very flattering

In the time when a player caught by a shark/T Rex, the player can't use his weapon but only could wave his hands.
Does it possible to let the player shoot/use his weapon while he's been caught?

Does it better now?
« Last Edit: August 20, 2016, 02:07:37 PM by BlockAlpha »

In the time When a player is caught by a shark/T Rex, the player can't use his weapon but only could and could only wave his hands.
Does Is it possible to let the player shoot/use his weapon while he's been caught?
I fixed it for you. Everything crossed out is incorrect, everything in bold was added in by me, and everything underlined was capitalized.
You are doing good though, the majority of this was actually correct!
« Last Edit: August 20, 2016, 02:20:38 PM by Bing2 »

I fixed it for you. Everything crossed out is incorrect, everything in bold was added in by me, and everything underlined was capitalized.
You are doing good though, the majority of this was actually correct!

     TRIGGERED

I fixed it for you. Everything crossed out is incorrect, everything in bold was added in by me, and everything underlined was capitalized.
You are doing good though, the majority of this was actually correct!
You messed up too. The could you added should be can.

OT:
It should work if you remove the bolded.
Quote
function SharkHoleBot::onBotCollision( %this, %obj, %col, %normal, %speed )
{
    if( %obj.isDisabled() )
      return;

   %canDamage = miniGameCanDamage(%obj,%col);
      
   if( isObject(%obj.hEating) || %obj.getMountedObject( 0 ) || %col.isDisabled() || %canDamage == 0 || %canDamage == -1 ) // !checkHoleBotTeams(%obj,%col) ||
      return;
      
   //Check if we can attack, then check if it's a minifig, then eat him//%col.isHoleBot &&
   %oScale = getWord(%obj.getScale(),0);
   %cScale = getWord(%col.getScale(),0);
   // if( (!getRandom(0,1)|| %obj.hIsGreatWhite) && %obj.getState() !$= "Dead" && checkHoleBotTeams(%obj,%col) && !isObject(%obj.hEating) && %col.getState() !$= "Dead" && miniGameCanDamage(%obj,%col) == 1)
   
   // if we collide with a vehicle then eject the player
   // this may cause some funky things, but it should be entertaining
   %wasEjected = 0;
   
   // %checkTeam = checkHoleBotTeams(%obj,%col);
   
   if( %col.getMountedObjectCount() && ( !getRandom( 0, 2 ) || %obj.hIsGreatWhite || ( %col.getType() & $TypeMasks::VehicleObjectType ) ) )
   {
      if( %col.hIsShark && %col.getMountedObject( 0 ).hIsShark )
         return;
   
      %col = %col.ejectRandomPlayer();
      %wasEjected = 1;
      
      if( %col.client )
         %col.client.setControlObject( %col );
   }
   
   %checkTeam = checkHoleBotTeams(%obj,%col);
   
   if( ( !getRandom(0,2)|| %obj.hIsGreatWhite || %wasEjected ) && %checkTeam )
   {
      if(  %oScale+0.5 >= %cScale && %col.getDataBlock().shapeFile $= "base/data/shapes/player/m.dts")
      {
         if(%col.getClassName() $= "Player" && %col.client)
         {
            %col.client.camera.setOrbitMode(%obj, %obj.getTransform(), 0, 10, 0, 1);
            %col.client.setControlObject(%col.client.camera);
            //hSpazzClick(%col,0,1);
         }

         %obj.stopHoleLoop();
         %obj.hRunAwayFromPlayer(%col);
         // %obj.setImageTrigger(3,1);
         %obj.setCrouching(1);
         %obj.mountObject(%col,2);
         
         %obj.hIgnore = %col;
         %obj.hEating = %col;
         %obj.hLastEatTime = getSimTime();
         
         // temporarily set the shark to invulnerable when he eats someone to avoid getting
         %obj.invulnerable = true;
         schedule( 200, %obj, eval, %obj @ ".invulnerable = false;" );

         %obj.hSharkEatDelay = scheduleNoQuota(5000,0,holeSharkKill,%obj,%col);
         return;
      }   
      if(  %oScale >= %cScale+0.5 && %col.getDataBlock().shapeFile $= "Add-Ons/Bot_Shark/shark.dts")
      {
         if(%col.getClassName() $= "Player" && %col.client)
         {
            %col.client.camera.setOrbitMode(%obj, %obj.getTransform(), 0, 10, 0, 1);
            %col.client.setControlObject(%col.client.camera);
            //hSpazzClick(%col,0,1);
         }

         %obj.stopHoleLoop();
         %obj.hRunAwayFromPlayer(%col);
         %obj.mountObject(%col,3);

         %obj.playThread(1,biteReady);
         %col.playThread(0,biteFix);
         %obj.hIgnore = %col;
         %obj.hEating = %col;
         %obj.hLastEatTime = getSimTime();
         
         %obj.invulnerable = true;
         schedule( 200, %obj, eval, %obj @ ".invulnerable = false;" );
         
         %obj.hSharkEatDelay = scheduleNoQuota(5000,0,holeSharkKill,%obj,%col);
         return;
      }
   }
   
   if( %checkTeam )
   {
      %obj.hAttackDamage = 35;
      %obj.hMeleeAttack( %col );
      %obj.hAttackDamage = 0;
   }
}

You messed up too. The could you added should be can.

OT:
It should work if you remove the bolded.
Edited^.
Thanks! but now I can also get out from the shark when I press right click (like a vehicle)
« Last Edit: August 25, 2016, 03:22:55 PM by BlockAlpha »

bump

maybe you could look at the code for the graboid playertype, as that actually had players mount in their mouth after it clicked them (even if player controlled). the ony way to escape was if the graboid died somehow before it ate the player

What the forget is a graboid