Ok,
I"m have an auto gun- it fires auto aiming conc bullets if an enemy is in line of sight. If the current distance is less than x,
it fires secondary weap_conc projectile. I had it working in weap_conc.cog, and I want to put it in force_pull, where I could toggle it on and off. The code I'm working with is in Timer and Pulse, in the attached cog. So to explain it better,
1. Weap_Concrifle Primary and Secondary Fire normally when fired.
2. When a toggle in force_pull is ON, it scans for enemies in Line of Sight, and Fires an autoaiming concbullet at the enemy. (If Curdist<X, it fires secondary so no splash damage)
And in timer,
I figure this might be a little difficult to do. But I would really appreciate it if anyone could help me, let me know if you need to know anything else.
[T0rN]
[EDIT: Forum dosent wrap it for some reason....?:(
I"m have an auto gun- it fires auto aiming conc bullets if an enemy is in line of sight. If the current distance is less than x,
it fires secondary weap_conc projectile. I had it working in weap_conc.cog, and I want to put it in force_pull, where I could toggle it on and off. The code I'm working with is in Timer and Pulse, in the attached cog. So to explain it better,
1. Weap_Concrifle Primary and Secondary Fire normally when fired.
2. When a toggle in force_pull is ON, it scans for enemies in Line of Sight, and Fires an autoaiming concbullet at the enemy. (If Curdist<X, it fires secondary so no splash damage)
Code:
// The Auto Gun Begins...
pulse:
if(GetThingHealth(player) <= 0)
{
Return;
}
potential = FirstThingInView(player, 45, 50, 0x404);
curdist = VectorDist(GetThingPos(player), GetThingPos(potential));
target = -1;
while(potential != -1)
{
if(HasLOS(player, potential) && potential != player && VectorDist(GetThingPos(potential), GetThingPos(player)) <= curdist && !(GetThingFlags(potential) & 0x200))
{
target = potential;
curdist = VectorDist(GetThingPos(player), GetThingPos(potential));
}
potential = NextThingInView();
}
if(target != -1)
{
if(curdist < 1.0) mode = 1;
else mode = 0;
if(mode == 0)
{
shot = projectile;
}
else
{
shot = projectile3;
}
dummy = FireProjectile(player, shot, fireSound, 18, '0.0 0.0 0.0', '0 0 0', 1.0, 0x20, autoAimFOV, autoAimMaxDist);
vel = VectorLen(GetThingVel(dummy));
SetThingLook(dummy, VectorSub(GetThingPos(target), GetThingPos(player)));
SetThingVel(dummy, VectorScale(GetThingLVec(dummy), vel));
// Provide a kick backwards
ApplyForce(player, VectorScale(GetThingLVec(player), -80));
powerBoost = GetInv(player, 63);
SetTimerEx(fireWait / powerBoost, 10, 0, 0);
DeactivateWeapon(player, mode);
SetPulse(0);
}
else
Return;And in timer,
Code:
if(GetSenderID() == 2)
StopKey(player, holsterTrack, 0.0);
if(GetSenderID() == 10)
SetPulse(0.1);I figure this might be a little difficult to do. But I would really appreciate it if anyone could help me, let me know if you need to know anything else.
[T0rN]
[EDIT: Forum dosent wrap it for some reason....?:(