I have a cog for a new weapon that works fine in single player games but I want it for multi-palyer ones. This is what it does:
It locks onto the first thing in site, then when you fire it rechecks the target after .7 seconds of flight time and adjusts its trajectory to track the target. So I wrote a client side cog for it. here's the problem:
After the .7 sec of flight, it locks onto me!! And comes back and kills me. Can someone show me how to keep the victim from the weapon cog and pass it to the client cog. I think that the missile is locking onto me because it doesn't know that who the victim was originaly. Here's the client cog:
------------------
-----------------
mohh
"Seen it all, done it all, can't remember most of it."
It locks onto the first thing in site, then when you fire it rechecks the target after .7 seconds of flight time and adjusts its trajectory to track the target. So I wrote a client side cog for it. here's the problem:
After the .7 sec of flight, it locks onto me!! And comes back and kills me. Can someone show me how to keep the victim from the weapon cog and pass it to the client cog. I think that the missile is locking onto me because it doesn't know that who the victim was originaly. Here's the client cog:
Code:
# Jedi Knight Cog Script # # Client_Concrifle.COG # # # This Cog is Not supported by LucasArts Entertainment Co # # [mohh] # # This flag makes the cog act locally, no broadcasting, less lag. flags=0x404 symbols flex autoAimFOV=90 local flex autoAimMaxDist=200 local template projectile=+swarm local thing dummy local thing dummy2 local thing dummy3 local thing dummy4 local vector path local vector path2 local vector path3 local vector path4 local vector path0 local vector path02 local vector path03 local vector path04 local vector path00 local vector path002 local vector path003 local vector path004 local int timerID local int random local int random2 local int random3 local int random4 local int wait local message trigger message timer message home end # ======================================================================================== code trigger: if( (GetSourceRef() == 90) | | (GetSourceRef() == 91) ) //Either sent with primary or secondary fire mode... { dummy = FireProjectile(player, projectile, -1, -1, '0.0207 0.15 0.00', '0 0 0', 1.0, 0x00, autoAimFOV, autoAimMaxDist); dummy2 = FireProjectile(player, projectile, -1, -1, '-0.05 0.2 -0.05', '0.0 0 0', 1.0, 0x00, autoAimFOV, autoAimMaxDist); dummy3 = FireProjectile(player, projectile, -1, -1, '0.0 0.5 0.00', '0.0 0 0', 1.0, 0x00, autoAimFOV, autoAimMaxDist); dummy4 = FireProjectile(player, projectile, -1, -1, '0.05 0.3 0.07', '0.0 0 0', 1.0, 0x00, autoAimFOV, autoAimMaxDist); wait = 0; KillTimerEx(3); call timer; } return; # ........................................................................................ timer: timerID = GetSenderId(); //Check which timer is being sent if(timerID == 2) { StopKey(player, holsterTrack, 0.0); Return; } else if(HasLOS(dummy, victim) && (victim != dummy) && (GetThingHealth(victim) > 0)) { //Create a new vector from the projectiles to the victim path = VectorSub(GetThingPos(victim), GetThingPos(dummy)); path2 = VectorSub(GetThingPos(victim), GetThingPos(dummy2)); path3 = VectorSub(GetThingPos(victim), GetThingPos(dummy3)); path4 = VectorSub(GetThingPos(victim), GetThingPos(dummy4)); path0 = VectorNorm(path); path02 = VectorNorm(path2); path03 = VectorNorm(path3); path04 = VectorNorm(path4); path00 = VectorScale(path0, 1.5); path002 = VectorScale(path02, 1.5); path003 = VectorScale(path03, 1.5); path004 = VectorScale(path04, 1.5); //Stop the homing timer KillTimerEx(3); call home; } else { KillTimerEx(3); } Return; # ........................................................................................ home: random = Rand(); random2 = Rand(); random3 = Rand(); random4 = Rand(); // There is a small chance that the missiles will miss otherwise it's // too powerful if(wait == 0) { wait = 1; SetTimerEx(0.2, 3, 0, 0); Return; } else if(wait == 1) { if(random <= 0.8) { // Set the projectiles velocity to head towards the victim SetThingVel(dummy, path00); #Print("Homing"); } if(random2 <= 0.75) { SetThingVel(dummy2, path002); } if(random3 <= 0.6) { SetThingVel(dummy3, path003); } if(random2 <= 0.5) { SetThingVel(dummy4, path004); } } // Set the timer for 0.7 seconds before the missiles re-check their direction SetTimerEx(0.7, 3, 0, 0); Return; #...................................................................... end
------------------
-----------------
mohh
"Seen it all, done it all, can't remember most of it."