This cog will track a player with projectiles. I'm not sure if it works in mp yet.
The problem is that when i switch off of 1st person perspective the projectiles dont trakck me anymore.
code
trigger:
if(GetSourceRef() != 11001 + trapID) Return;
for(i = 0; i <rounds; i = i + 1)
{
dimwit = FireProjectile(skull0, proj_tpl, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV);
//SetThingParent(dimwit, GetParam(0)); NOT SURE IF THIS WOULD DO ANYTHING
SetThingPulse(dimwit, 0.01);
Sleep(rate);
}
Sleep(delay);
Return;
# ........................................................................................
pulse:
victim = -1;
maxDot = 0;
// Search for all players and actors.
potential = FirstThingInView(GetSenderRef(), 180, 7, 0x404);
while(potential != -1)
{
if (HasLOS(GetSenderRef(), potential) && (potential != GetSenderRef()) &&
(VectorDist(GetThingPos(GetSenderRef()), GetThingPos(potential)) <= 4) &&
!(GetThingFlags(potential) & 0x200) && !(jkGetFlags(potential) & 0x20))
{
dot = ThingViewDot(GetSenderRef(), potential);
if(dot > maxDot)
{
victim = potential;
maxDot = dot;
}
}
potential = NextThingInView();
}
// If we have a victim...
if(victim != -1)
{
ApplyForce(GetSenderRef(), VectorScale(VectorSub(GetThingPos(victim), GetThingPos(GetSenderRef())), Flexforce));
}
Return;
------------------
The problem is that when i switch off of 1st person perspective the projectiles dont trakck me anymore.
code
trigger:
if(GetSourceRef() != 11001 + trapID) Return;
for(i = 0; i <rounds; i = i + 1)
{
dimwit = FireProjectile(skull0, proj_tpl, fireSound, -1, '0 0 0', '0 0 0', 1.0, 0x60, autoAimXFOV, autoAimZFOV);
//SetThingParent(dimwit, GetParam(0)); NOT SURE IF THIS WOULD DO ANYTHING
SetThingPulse(dimwit, 0.01);
Sleep(rate);
}
Sleep(delay);
Return;
# ........................................................................................
pulse:
victim = -1;
maxDot = 0;
// Search for all players and actors.
potential = FirstThingInView(GetSenderRef(), 180, 7, 0x404);
while(potential != -1)
{
if (HasLOS(GetSenderRef(), potential) && (potential != GetSenderRef()) &&
(VectorDist(GetThingPos(GetSenderRef()), GetThingPos(potential)) <= 4) &&
!(GetThingFlags(potential) & 0x200) && !(jkGetFlags(potential) & 0x20))
{
dot = ThingViewDot(GetSenderRef(), potential);
if(dot > maxDot)
{
victim = potential;
maxDot = dot;
}
}
potential = NextThingInView();
}
// If we have a victim...
if(victim != -1)
{
ApplyForce(GetSenderRef(), VectorScale(VectorSub(GetThingPos(victim), GetThingPos(GetSenderRef())), Flexforce));
}
Return;
------------------