OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: NightJay0044 on 20 Sep 2005, 23:51:34

Title: Tanks Firing??
Post by: NightJay0044 on 20 Sep 2005, 23:51:34
Here my descrption. This is what I have inserted on the intro island.

-M1A1 Tank
-Mi-24 Hind
-Player (ME)

I've given the Mi-24 a name: H1

MY ISSUE:  
I want the M1A1 tank to fire at the hind. Here are the commands that I've already tried using with help from TriggerHappy.

Code: [Select]
this dowatch h1;this dotarget h1;this fire ["gun120","gun120"]
I've put that in the Init Field: of the M1A1 tank. The Tank Targets the hind and follows it with it's turret, but it doesn't open fire.

HELP:
Is there anything I'm doing wrong, or something new needs to be added? Thank you all.

Title: Re:Tanks Firing??
Post by: Kyle Sarnik on 20 Sep 2005, 23:56:57
Here my descrption. This is what I have inserted on the intro island.

-M1A1 Tank
-Mi-24 Hind
-Player (ME)

I've given the Mi-24 a name: H1

MY ISSUE:  
I want the M1A1 tank to fire at the hind. Here are the commands that I've already tried using with help from TriggerHappy.

Code: [Select]
this dowatch h1;this dotarget h1;this fire ["gun120","gun120"]
I've put that in the Init Field: of the M1A1 tank. The Tank Targets the hind and follows it with it's turret, but it doesn't open fire.

HELP:
Is there anything I'm doing wrong, or something new needs to be added? Thank you all.



The fire command is what you are doing wrong. When using the fire command:
-A unit will ONLY fire if it is ABLE to (waiting for weapon to load, etc..)
-If the unit is ready to fire, it will INSTANTLY fire, not giving it time to target
-If the unit is not able to fire (now this one is odd) it sometimes will cause a unit (it depends on the type of weapon) to fire as soon as it is ready to fire

There is no way to know of the M1 is targeting the hind, and no way to tell if its aiming at it, so that means you can't know when to execute the fire command. My advice is to use an addon that has air targeting shells.
Title: Re:Tanks Firing??
Post by: NightJay0044 on 21 Sep 2005, 00:06:18
Hey Kyle Sarnik~

Quote
There is no way to know of the M1 is targeting the hind, and no way to tell if its aiming at it, so that means you can't know when to execute the fire command. My advice is to use an addon that has air targeting shells.

yes what about the Inv.Target or that addon that's out , I have that?
Title: Re:Tanks Firing??
Post by: Kyle Sarnik on 21 Sep 2005, 00:12:18
Well, that could work if you used a script to setpos the target over the hind in a loop, however then you might end up with units firing guided anti-tank weapons at the helicopter, and actually locking on to it  :o  
Title: Re:Tanks Firing??
Post by: Pilot on 21 Sep 2005, 00:13:14
Wait, NightJay, you said in your first post that the M1 was moving it's turret to look at the Mi-24, right?  This means, to me at least, that the tank is watching the chopper.  The invisible addon should not be needed.  All you need to do is issue the fire command at the right time, which means waiting until the shell is loaded.

-Student Pilot
Title: Re:Tanks Firing??
Post by: Tyger on 21 Sep 2005, 00:14:52
Or get an invisible target addon and use the Threat: Armor target by setPosing it to the chopper's position.

Edit: Wow. Clicked too late. :P
Title: Re:Tanks Firing??
Post by: NightJay0044 on 21 Sep 2005, 00:17:28
Student Pilot~

Code: [Select]
Wait, NightJay, you said in your first post that the M1 was moving it's turret to look at the Mi-24, right?  This means, to me at least, that the tank is watching the chopper.  The invisible addon should not be needed.  All you need to do is issue the fire command at the right time, which means waiting until the shell is loaded.

How do I properly execute those commands then?


Tyger ~

Quote
Or get an invisible target addon and use the Threat: Armor target by setPosing it to the chopper's position.

Yes Im sure the inv.addon would work but it there is an easier way I'm all for it.. ;D



Title: Re:Tanks Firing??
Post by: Pilot on 21 Sep 2005, 00:20:01
He shouldn't need an invisible target, the tank already targets the chopper.  His problem is in this code:
Code: [Select]
this dowatch h1;this dotarget h1;this fire ["gun120","gun120"]He's giving the fire command right away, the tank doesn't have a shell ready at that time.  Wait ~30 seconds before giving the fire command.

-Student Pilot

EDIT:
Everyones...posting...too...fast...can't...keep...up :P

Maybe try putting the command in a trigger and setting the trigger to countdown from 30 seconds?
Title: Re:Tanks Firing??
Post by: Tyger on 21 Sep 2005, 00:20:08
Well, ignore my post. Someone already mentioned it, and apparently I click way too slow :P
Title: Re:Tanks Firing??
Post by: Kyle Sarnik on 21 Sep 2005, 00:25:04
He shouldn't need an invisible target, the tank already targets the chopper.  His problem is in this code:
Code: [Select]
this dowatch h1;this dotarget h1;this fire ["gun120","gun120"]He's giving the fire command right away, the tank doesn't have a shell ready at that time.  Wait ~30 seconds before giving the fire command.

-Student Pilot

EDIT:
Everyones...posting...too...fast...can't...keep...up :P

Maybe try putting the command in a trigger and setting the trigger to countdown from 30 seconds?

But like I said, this is not a sound method. Because you can't detect (in a script) if the tank has a firing solution, you can't be sure that when you issue the fire command that the tank is aiming at its target. And dotarget is NOT allways reliable, it can often not work depending on the units awareness of the target and also a few other factors, and sometimes the unit won't properly update its firing solution in time, meaning it will target where the hind started, but sometimes won't track it properly.
Title: Re:Tanks Firing??
Post by: Pilot on 21 Sep 2005, 00:29:49
True, but he's using a dowatch and a dotarget with each other.  I would think with that redundancy the tank would always be looking at the chopper, or at least most of the time.

-Student Pilot
Title: Re:Tanks Firing??
Post by: Kyle Sarnik on 21 Sep 2005, 00:31:59
True, but he's using a dowatch and a dotarget with each other.  I would think with that redundancy the tank would always be looking at the chopper, or at least most of the time.

-Student Pilot

Dowatch won't ensure anything, dowatch tells a unit to moniter something, not target it. Dowatch on a tank only makes the commander's turret follow the object or, even worse, the driver will point the tank in that direction.
Title: Re:Tanks Firing??
Post by: NightJay0044 on 21 Sep 2005, 00:32:35
Thanks for all your replies. Anybody who wants to take a look at the details in-game OFP, download is below..
Title: Re:Tanks Firing??
Post by: NightJay0044 on 21 Sep 2005, 00:50:00
Hoorah, it works with the inv.target addon. Now for my helicopter mission, it opens fire right away at the chopper. Cool thanks guys..