Author Topic: [Solved] Need help with some code  (Read 616 times)

I just want to know what part of this mod makes it where you take damage over time, I looked through the code but I don't know exactly what part is the damage over time, the mod is pass's spells

[Solved]

Code: [Select]
function FirethrowProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
 %col.schedule(1000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(2000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(3000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(4000, "damage",0, "0 0 0", 5, "Fire");
}
  
« Last Edit: August 14, 2016, 09:21:43 PM by YounqD »

Code: [Select]
function FirethrowProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
 %col.schedule(1000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(2000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(3000, "damage",0, "0 0 0", 5, "Fire");
      %col.schedule(4000, "damage",0, "0 0 0", 5, "Fire");
}

this is the code you are looking for.

this is the code you are looking for.

Thanks man



I wanted to know which part is it that i guess steals health from an enemy player from Ghille's pixel spells mod

[solved]
Code: [Select]
function healProjectile::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%this.directDamage <= 0)
      return;

   %damageType = $DamageType::Direct;
   if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;

   %scale = getWord(%obj.getScale(), 2);
   %directDamage = mClampF(%this.directDamage, -100, 100) * %scale;
   
   if(isObject(%obj.sourceObject) && %obj.sourceObject.getType() & $TypeMasks::PlayerObjectType && %col.getType() & $TypeMasks::PlayerObjectType)
   {
      %firer = %obj.sourceObject;
      %col.damage(%obj, %pos, %directDamage, %damageType);
     
  if(%firer.getWhiteOut() < 0.2)
        %firer.setWhiteOut(0.2);
     
      if(getSimTime() - %firer.lastHealImageTime > 500)
      {
         //%firer.mountImage(healImage,3);
         %firer.lastHealImageTime = getSimTime();
      }
     
      if(%firer.getDamageLevel() > 0)
      { 
if(%firer.getDamageFlash() < 0.3)
   %firer.setDamageFlash(0.3);
         %firer.addHealth(15);
      }
      else
      {
         %firer.setHealth(%firer.dataBlock.maxDamage);
      }
   }
   else
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }       
}
« Last Edit: August 13, 2016, 12:58:50 PM by YounqD »

This part.
Code: [Select]
function healProjectile::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%this.directDamage <= 0)
      return;

   %damageType = $DamageType::Direct;
   if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;

   %scale = getWord(%obj.getScale(), 2);
   %directDamage = mClampF(%this.directDamage, -100, 100) * %scale;
   
   if(isObject(%obj.sourceObject) && %obj.sourceObject.getType() & $TypeMasks::PlayerObjectType && %col.getType() & $TypeMasks::PlayerObjectType)
   {
      %firer = %obj.sourceObject;
      %col.damage(%obj, %pos, %directDamage, %damageType);
     
  if(%firer.getWhiteOut() < 0.2)
        %firer.setWhiteOut(0.2);
     
      if(getSimTime() - %firer.lastHealImageTime > 500)
      {
         //%firer.mountImage(healImage,3);
         %firer.lastHealImageTime = getSimTime();
      }
     
      if(%firer.getDamageLevel() > 0)
      { 
if(%firer.getDamageFlash() < 0.3)
   %firer.setDamageFlash(0.3);
         %firer.addHealth(15);
      }
      else
      {
         %firer.setHealth(%firer.dataBlock.maxDamage);
      }
   }
   else
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }       
}

Thanks a lot dude.

-nvm-
« Last Edit: August 14, 2016, 09:20:54 PM by YounqD »