Blockland Forums > Modification Help
Headshots without using Raycasts?
<< < (3/3)
Amade:

--- Quote from: takato14 on January 11, 2011, 11:18:27 PM ---I. Dont. Want. To. Use. Raycasts.
--- End quote ---

--- Quote from: Amade on January 10, 2011, 10:53:37 PM ---raycasts aren't that different from projectiles
--- End quote ---
IE you learn from a raycasting weapon and apply it to a projectile.
ZSNO:

--- Quote from: phflack on January 12, 2011, 02:40:05 PM ---it's blue, has 2 prongs on the end which i think are supports, which fails badly as it never rests on anything, makes a funny sputting noise when fired, says "Headshot!" to the client in centerprint in the default red when you get a headshot

--- End quote ---
SIG SG550 v2?
http://forum.blockland.us/index.php?topic=72261
http://forum.blockland.us/index.php?topic=76067.0
Destiny/Zack0Wack0:
I haven't tested it, but it should work.

--- Code: ---//Quickly whipped up, mostly stolen from Tier Tactical but allows for more ease of use
//Zack0Wack0 9:46 AM 13/01/2011
//Example (you can make the damage values different, obviously):
//datablock ProjectileData(YourProjectile)
//{
// ...
// directDamage = 25;
// directHeadshotDamage = 50;
// directHeadShotDamageType = $DamageType::YourWeaponHeadshot;
// ...
//};
if($Support_Headshots >= 0.1)
return;
$Support_Headshots = 0.1;
package Support_Headshots
{
function ProjectileData::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(%col.getType() & $TypeMasks::PlayerObjectType)
{
%colScale = getWord(%col.getScale(),2);
if(getWord(%pos, 2) > (getWord(%col.getWorldBoxCenter(), 2)-3.3)*%colScale)
{
%directDamage = %this.directHeadshotDamage;
%damageType = %this.directHeadshotDamageType;
if(isObject(critProjectile))
{
%col.spawnExplosion(critProjectile,%colScale);
if(isObject(%col.client))
%col.client.play2d(critRecieveSound);
}
if(isObject(%obj.client.player))
{
if(isObject(critProjectile))
{
serverplay3d(critFireSound,%obj.client.player.getHackPosition());
if(isObject(%obj.client))
%obj.client.play2d(critHitSound);
}
}
}
%col.damage(%obj,%pos,%directDamage,%damageType);
}
else
{
%col.damage(%obj,%pos,%directDamage,%damageType);
}
}
};
activatePackage(Support_Headshots);

--- End code ---
Put directHeadshotDamage and directHeadshotDamageType in your projectile. You would make directHeadshotDamage larger then the normal directDamage of course.
takato14:
:o

Thanks, Ill test it.

And if it doesnt work, Ill just try looking at the tier+Tactical set.

EDIT:

Er, stuff.

I want to spawn a different explosion depending on where I hit them (so I can spawn one that sends them flying), not alter the damage amount. Can I set it to change the vertical/impact impulse instead of the damage? Or is that static after the server is started? (I know that when I try to use the console to change it in-game, it doesnt do anything until I load a new mission.) I know how I could change the code to do that, but would it actually change?
Destiny/Zack0Wack0:
Try putting
--- Code: ---%col.addVelocity(vectorScale(-getWord(%normal,0) SPC -getWord(%normal,1) SPC -getWord(%normal,2),%velocityScale);
--- End code ---
inside the part where it checks if it is a head shot (if(getWord(%pos, 2) > (getWord(%col.getWorldBoxCenter(), 2)-3.3)*%colScale)).

%velocityScale is the amount you want to push them away. I'm guessing this should work.
Navigation
Message Index
Previous page

Go to full version