Player StompingVersion B1if(!isObject($DamageType::Stomp))
AddDamageType("Stomp",'%1 <bitmap:base/client/ui/ci/crater>','%2 <bitmap:base/client/ui/ci/crater> %1',1,1);
package swol_stomp
{
function Armor::onCollision(%this, %obj, %col, %vec, %force)
{
%obj.stompOn(%col,%vec);
return parent::onCollision(%this, %obj, %col, %vec, %force);
}
function Armor::onImpact(%this, %obj, %col, %vec, %force)
{
%obj.stompOn(%col,%vec);
return parent::onCollision(%this, %obj, %col, %vec, %force);
}
function player::stompOn(%pl,%vi,%pvel)
{
if(strPos(%vi.getClassName(),"Player") == -1 || %vi.getDamagePercent() >= 1)
return;
if(!isObject(%pl.minigame) || !isObject(%vi.minigame))
return;
if(%pl.minigame != %vi.minigame)
return;
if(%pvel $= "")
%pvel = %pl.getVelocity();
%ppos = %pl.getPosition();
%vpos = %vi.getPosition();
%p_z = getWord(%ppos,2);
%v_z = getWord(%vpos,2);
%vsc = %vi.getScale();
%vsc_x = getWord(%vsc,0);
%vsc_y = getWord(%vsc,1);
%vsc_z = getWord(%vsc,2);
%vvel = %vi.getVelocity();
%pvel_x = getWord(%pvel,0);
%pvel_y = getWord(%pvel,1);
%pvel_z = getWord(%pvel,2);
%vvel_x = getWord(%vvel,0);
%vvel_y = getWord(%vvel,1);
%vvel_z = getWord(%vvel,2);
if(%p_z > %v_z)
{
if(%pvel_z < -5 || %vvel_z > 2)
{
%pwr = (((-%pvel_z)/80)+(%vvel_z/80))*((%vsc_x+%vsc_y+%vsc_z)/3);
%pl.setVelocity(%pvel_x SPC %pvel_y SPC mClampF((-%pvel_z)*0.5,4,30));
if(!isEventPending(%vi.squisgSched))
%vi.stompSquish(%vsc,0.5*%pwr,0,5,1);
%vi.setVelocity(%vvel_x*0.4 SPC %vvel_y*0.4 SPC %vvel_z+(%pvel_z*0.5));
if(%pwr > 0.2)
{
%dmg = %pwr*100;
%vi.damage(%pl,%vi.getPosition(),%dmg,$DamageType::Stomp);
}
}
}
}
function player::stompSquish(%pl,%start,%amt,%step,%max,%callback)
{
cancel(%pl.squishSched);
if(%step > %max)
{
if(%callback)
%pl.squishSched = %pl.schedule(1,stompSquish,%pl.getScale(),-%amt,0,%max,false);
return;
}
if(%amt < 0)
%stepAm = -(%amt)*(1-(%step/%max));
else
%stepAm = %amt*(%step/%max);
%psc_x = getWord(%start,0);
%psc_y = getWord(%start,1);
%psc_z = getWord(%start,2);
%pl.setScale(1+%stepAm SPC 1+%stepAm SPC 1-%stepAm);
%step++;
%pl.squishSched = %pl.schedule(25,stompSquish,%start,%amt,%step,%max,%callback);
}
};
activatePackage(swol_stomp);
My own take on player stomping, tested to a certain extent, I know that the minigame checks probably won't work with bots, too lazy to look up the minigame damage function or whatever
has a squishing animation
just thought I'd post it for anyone who wanted it
if you want to tune up the numbers and make it feel more natural or make it more versatile: I wouldn't care if you released it and took like 90% of the credit
DownloadSwololol.com
1.08kb