OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bdfy85 on 25 Oct 2005, 02:09:00

Title: How to make unit target nothing ?
Post by: bdfy85 on 25 Oct 2005, 02:09:00
white frame over the target shows vehicle target ( I'm commander ). Is that possible to remove it and make vehicle taret nothing by script ?
I tried
_gun doTarget objNull,( gunner _gun) doTarget objNull - no luck :(


Title: Re:How to make unit target nothing ?
Post by: Raptorsaurus on 25 Oct 2005, 02:28:08
Try:   tank commandTarget objNull (where tank is the name of the tank).  Or if the player is the commander you may be able to use:  player commandTarget objNull.
Title: Re:How to make unit target nothing ?
Post by: bdfy85 on 26 Oct 2005, 01:14:22
No, it doesn't work.
Title: Re:How to make unit target nothing ?
Post by: Raptorsaurus on 26 Oct 2005, 02:21:14
OK, I did some testing and this worked for me. Make a game logic:

_gl = "logic" createVehicle [0,0,0]

Then have your commander (player) target the game logic, then delete the game logic

player commandTarget _gl
~ .01
deleteVehicle _gl
Title: Re:How to make unit target nothing ?
Post by: bdfy85 on 26 Oct 2005, 02:45:01
No it doesn't help(only target box appears for a moment ). I can still see the frame over target.
Let me explain my problem :
I've almost finished movable 45mm gun for LIBMOD
http://www.flashpoint.ru/forum/showthread.php?goto=newpost&t=35198
but I encounter serious trouble :( I have to remove weapons\magazines from the gun in order to prevent it firing while moving. But if gun is targeting smth and you try to remove its weapon - the game will crash :( That's why I'm looking for a solution to set null target.
Any suggestions ?
Title: Re:How to make unit target nothing ?
Post by: Raptorsaurus on 26 Oct 2005, 20:23:22
How about what I said with the game logic, but do not delete the game logic, instead just make the game logic out of range of the gun so it will not fire at it?  At this point I must say I am grasping at straws, but what else is there?
Title: Re:How to make unit target nothing ?
Post by: bdfy85 on 27 Oct 2005, 02:13:25
I guess, It's an OFP bug...
 Try put Jeep with MG on the map, be a driver. Then try to target something (ex. tank nearby ) and  then  try Removeallweapons command, The game crashes :( I wonder how to prevent this.
OFP 1.96
Title: Re:How to make unit target nothing ?
Post by: Raptorsaurus on 27 Oct 2005, 22:57:51
How about if instead of making it target nothing, instead just set its combatMode to "green" or "blue (_unit setCombatMode "blue")?  That would keep it from firing.  You could make a script that would change the combat mode to "blue" for "green" as soon as it begins to move.
Title: Re:How to make unit target nothing ?
Post by: bdfy85 on 29 Oct 2005, 00:22:23
Solved. I have to removw weapons , but one by one -  not with RemoveAllWeapons.
anyway there's game bug. Look at the demo mission : launch it, then command gunner to target tank ahead ,then press 0-0-1 or 0-0-2. Game crashes.