Target cone
Moderator: Moderators
Target cone
Is there any way we could get support for a target cone, basically the opposite of the aiming cone, so that we can specify exact parts of a target to aim? I would think the code for aiming could be largely recycled here, with a simple check to see if the aim point and target point are both in their respective cones.
I want to be able to simulate tailchasing weapons.
I want to be able to simulate tailchasing weapons.
http://spring.clan-sy.com/wiki/Lua_Scripting
More precisely:
More precisely:
Spring.GetUnitPosition
( number unitID ) -> nil | number x, number y, number z
Spring.GetUnitBasePosition
( number unitID ) -> nil | number x, number y, number z
Spring.GetUnitDirection
( number unitID ) -> nil | number dx, number dy, number dz
Spring.GetUnitHeading
( number unitID ) -> nil | number heading
Adding a COB function would probably be the best way to do this.
How about something like:
The AimPrimary() COB function can be used to block shots, but
it will only do so if forwardOnly is not enabled. The other problem
is that you wont know what the target is.
It might be better to set this up for an immediate return value.
How about something like:
Code: Select all
// targetID = unitID or (featureID + offset) or 0 for ground target?
AllowShot(weaponNum, targetID)
if (MyTestGoesHere(weaponNum, targetID)) {
return 1;
} else {
return 0;
}
}
it will only do so if forwardOnly is not enabled. The other problem
is that you wont know what the target is.
It might be better to set this up for an immediate return value.
I have it coded as the following:
Now I just need to test it 
Code: Select all
AllowShot1(unitID, retval)
{
// unitID = 0 for ground targets
if ( the shot should not be fired ) {
retval = 0;
}
return (whatever);
}
AllowShot2() ...

Would yall prefer BlockShot#() ?
Code: Select all
BlockShot1(unitID, blockShot)
{
// unitID = 0 for ground targets
if ( the shot should not be fired ) {
blockShot = 1;
}
return (whatever);
}