Johxz Posted June 23, 2016 Share Posted June 23, 2016 Hello!someone can give a hand here :) a little explanation how this works? I don't found what %sourceObject it meansShapeBase::damagePlayerData::damageThanks!! Quote Link to comment Share on other sites More sharing options...
damik Posted June 23, 2016 Share Posted June 23, 2016 function WeaponImage::onFire( %this, %obj, %slot ) { %p = new Projectile() { dataBlock = ProjectileData; sourceObject = %obj; sourceSlot = %slot; sourceClass = %obj.getClassName(); }; } function ProjectileData::onCollision( %data, %proj, %col, %fade, %pos%normal ) { %col.damage( %proj, %pos, %dmg, %data.damageType ); } function PlayerData::damage( %this, %obj, %sourceObject, %position, %damage, %damageType ) { %shooter = %sourceObject.sourceObject; if( %shooter.team $= %obj.team ) echo( "FRIENDLY FIRE" ); } Quote Link to comment Share on other sites More sharing options...
rlranft Posted June 24, 2016 Share Posted June 24, 2016 Yeah, as the code that damik posted says, it's the player object that the damage originated from. When the weapon is fired the player id is set on the projectile. When the target takes damage it asks the projectile who it belongs to so the right person gets credit for the kill (if it kills them). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.