//////////////////////////////////////////////////////////////////////////////// // // Siege Couillard - Fires the Projectile // os_fire_cou // by Don Anderson // dandersonru@msn.com // //////////////////////////////////////////////////////////////////////////////// #include "os_inc" void main() { object oCouillard = OBJECT_SELF; string sCouillard = GetTag(oCouillard); object oArea = GetArea(oCouillard); object oPC = GetPCSpeaker(); vector vCurrentPosition = GetPosition(oCouillard); float fCurrentFacing = GetFacing(oCouillard); //Calculate the target location. float fRange = GetLocalFloat(oCouillard, "RANGE"); if (fCurrentFacing > 360.0) { fCurrentFacing = 720 - fCurrentFacing; } int nRX = Random(2); int nRY = Random(2); int nRN = Random(2); //Positive Error if(nRN == 0) nRX = nRX; //Negative Error if(nRN == 1) nRX = nRX * (-1); //Positive Error if(nRN == 0) nRY = nRY; //Negative Error if(nRN == 1) nRY = nRY * (-1); //Total Range Error for Location Target float fMult = 3.0; if(sCouillard == SIEGEBRICOLE) fMult = IntToFloat(d4(1)); if(sCouillard == SIEGEPERRIERE) fMult = IntToFloat(d3(1)); if(sCouillard == SIEGECOUILLARD) fMult = IntToFloat(d2(1)); float fError = SIEGE_ERRANT * fRange * fMult; vector vDelta; //On Target if (fError <= 2.0) { vDelta.x = cos(fCurrentFacing) * fRange; vDelta.y = sin(fCurrentFacing) * fRange; AssignCommand(oCouillard, SpeakString("Projectile away and on target!")); } //A little off Target else { vDelta.x = cos(fCurrentFacing) * (fRange + (fError * IntToFloat(nRX))); vDelta.y = sin(fCurrentFacing) * (fRange + (fError * IntToFloat(nRY))); AssignCommand(oCouillard, SpeakString("Projectile away and a little off target!")); } vector vImpact; vImpact.x = vCurrentPosition.x + vDelta.x; vImpact.y = vCurrentPosition.y + vDelta.y; location lLoc = Location(oArea, vImpact, fCurrentFacing); float fImpactDelay = fRange/16; //Play the Couillard's VFX effect eImpact; effect eBump; int nSpell; int nAmmo; float fRadius; PlaySound("cb_sh_catapult"); //Stone was Loaded if(GetLocalInt(oCouillard,"LOADED") == 1) { eImpact = EffectVisualEffect(VFX_COM_CHUNK_STONE_MEDIUM); eBump = EffectVisualEffect(VFX_FNF_SCREEN_BUMP); nSpell = HURL_ROCK; fRadius = STONE_RADIUS; nAmmo = STONE; StoneBlast(lLoc,fImpactDelay,eImpact,eBump,nSpell,fRadius,nAmmo); SetLocalInt(oCouillard,"LOADED",0); DeleteLocalInt(oCouillard,"AMMOTYPE"); } }