Author Topic: What affects the way lava does damage to a player?/packaging help possibly?  (Read 578 times)

I know the Standard Player takes 3 hits into lava to kill, where as any other player type, including ones directly based off of the Standard player, such as the No-Jet player, are instantly killed in lava.
« Last Edit: November 07, 2009, 11:37:49 AM by ladios »

Code: [Select]
%DamageLava       = 0.01;
%DamageHotLava    = 0.01;
%DamageCrustyLava = 0.01;




function ShapeBase::setDamageDt(%this, %damageAmount, %damageType)
{
   if( %this.getState() !$= "Dead" ) {
      %this.damage(0, "0 0 0", %damageAmount, %damageType);
      %this.damageSchedule = %this.schedule(50, "setDamageDt", %damageAmount, %damageType);
   }
   else
      %this.damageSchedule = "";
}

function ShapeBase::clearDamageDt(%this)
{
   if( %this.damageSchedule !$= "" ) {
      cancel(%this.damageSchedule);
      %this.damageSchedule = "";
   }
}


function PlayerArmorDataNameHere::onEnterLiquid(%this, %obj, %coverage, %type)
{
   switch(%type)
   {
      case 0: //Water
      case 1: //Ocean Water
      case 2: //River Water
      case 3: //Stagnant Water
      case 4: //Lava
         %obj.setDamageDt(%this, %DamageLava, "Lava");
      case 5: //Hot Lava
         %obj.setDamageDt(%this, %DamageHotLava, "Lava");
      case 6: //Crusty Lava
         %obj.setDamageDt(%this, %DamageCrustyLava, "Lava");
      case 7: //Quick Sand
   }
}


function PlayerArmorDataNameHere::onLeaveLiquid(%this, %obj, %type)
{
   %obj.clearDamageDt();
}
Garage Games code.
« Last Edit: November 06, 2009, 01:40:03 PM by Jimmg »

I am obviously a complete dumbass.

putting
Code: [Select]
function LavaBoatArmor::onEnterLiquid(%this, %obj, %coverage, %type)
{
   switch(%type)
   {
      case 0: //Water
      case 1: //Ocean Water
      case 2: //River Water
      case 3: //Stagnant Water
      case 4: //Lava
      case 5: //Hot Lava
      case 6: //Crusty Lava
      case 7: //Quick Sand
   }
}
at the end of my playtype just left me with this error in console
Code: [Select]
base/server/scripts/allGameScripts.cs (8321): Unable to find object: '' attempting to call function 'getState'
BackTrace: ->armor::onEnterLiquid->armor::onEnterLiquid->ShapeBase::setDamageDt
base/server/scripts/allGameScripts.cs (8323): Unable to find object: '' attempting to call function 'schedule'
BackTrace: ->armor::onEnterLiquid->armor::onEnterLiquid->ShapeBase::setDamageDt
and would not exec the file.

Ignore all of that. My problem was because I am a dumbass and did not link the shape file correctly.

The console errors are still existing but the Vehicle itself does resist lava damage now.
« Last Edit: November 06, 2009, 02:42:24 PM by ladios »


Package/parent it.
Code: [Select]
package LavaBoatPackage
{
function LavaBoatArmor::onEnterLiquid(%this, %obj, %coverage, %type)
{
    switch(%type)
    {
      case 0: //Water
      case 1: //Ocean Water
      case 2: //River Water
      case 3: //Stagnant Water
      case 4: //Lava
      case 5: //Hot Lava
      case 6: //Crusty Lava
      case 7: //Quick Sand
    }
Parent::onEnterLiquid(%this, %obj, %coverage, %type);
}
};

activatePackage(LavaBoatPackage);

I did this and still got the errors
Code: [Select]
base/server/scripts/allGameScripts.cs (8321): Unable to find object: '' attempting to call function 'getState'
BackTrace: ->armor::onEnterLiquid->armor::onEnterLiquid->ShapeBase::setDamageDt
base/server/scripts/allGameScripts.cs (8323): Unable to find object: '' attempting to call function 'schedule'
BackTrace: ->armor::onEnterLiquid->armor::onEnterLiquid->ShapeBase::setDamageDt
And when I spawned it, it died upon touching the water, just like the regular RowBoat except now giving an error with it:
Code: [Select]
base/server/scripts/allGameScripts.cs (8321): Unable to find object: '' attempting to call function 'getState'
BackTrace: ->LavaBoatArmor::onEnterLiquid->armor::onEnterLiquid->armor::onEnterLiquid->ShapeBase::setDamageDt

Arghhh
It works just fine with the thing not in a package like that. While it does give annoying errors when you first make the server, at least it works.

Did you package both?