Home   Help Search Login Register  

Author Topic: WW2 Tank Firing  (Read 1530 times)

0 Members and 1 Guest are viewing this topic.

Offline Ale

  • Members
  • *
WW2 Tank Firing
« on: 11 Apr 2007, 17:42:06 »
Hello all,

I'm a great fan of OFP and of all the mods, but specially of WW2 mods. In these mods there are many tanks, but they are similar to modern tanks, in fact they do not stop when firing. While a Tiger tank is moving it fires a shot to a vehicle or another tank. Here is my question: do you know a way to make the behaviour of ww2 tanks more real and less similar to that of a T72 or a M1 Abrams?

Thank you

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: WW2 Tank Firing
« Reply #1 on: 13 Apr 2007, 00:42:55 »
You'd have to script it so that they did things you'd want.

Take stopping before firing for instance. I'm not sure how it would be done, but you could write a script that would temporarily give the tank a stop command and then remove it after it has fired.

The reason for it to stop is the hard part.
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: WW2 Tank Firing
« Reply #2 on: 13 Apr 2007, 18:10:56 »
The thing is that there is absolutely no way to tell whether a unit is about to fire..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: WW2 Tank Firing
« Reply #3 on: 14 Apr 2007, 02:09:23 »
That's what I meant. Could there possibly be a workaround of some sort. Only allowing ammo for a certain amount of time or something. The player wouldn't ever have to know.

I dunno, summit along those lines. :confused:
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Ale

  • Members
  • *
Re: WW2 Tank Firing
« Reply #4 on: 20 Apr 2007, 17:15:00 »
Well I confess that I have problem with the scripts, I have read hundreds of posts but with no result.

Probably I have found a way to stop the tank with the command "SetFuel 0" and the command "KnowsAbout";

I have made a simple mission with one Tiger (panzer1) and one Sherman (ustank), with SetCombatMode "Green" to prevent shooting while they are moving. I have set a trigger with this condition "panzer1 KnowsAbout ustank> 2" and on activation "panzer1 SetFuel 0"; so the Tiger stops and open fire on the Sherman. Another trigger set the fuel to 1 if "panzer1 KnowsAbout ustank < 2", and the Tiger continue his patrol.

Now I need some help if you can:

I must check all enemy units for  each tank in the mission, but I don't know how.

Thanks

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: WW2 Tank Firing
« Reply #5 on: 20 Apr 2007, 21:02:09 »
It's basicly easy, but it will eat resources and thus probably make your mission lag a bit..
What you need to do is to create a global array of all the enemy tanks and then write a script that monitors the knowsAbout for each of those enemy tanks..

init.sqs
Code: [Select]
my_enemytankArray = [nme_tank1,nme_tank2,nme_tank3,nme_tank4]
monitor.sqs (friendlytankname exec "monitor.sqs")
Code: [Select]
_i = 0

#check
? (_i + 1) == count my_enemytankArray: _i = 0
? !(alive _this): exit

_fuel = fuel _this
_nme = my_enemytankArray select _i
? _this knowsAbout _nme > 2: goto "haltForFiring"

_i = _i + 1
~0.1
goto "check"

#haltForFiring
_this setFuel 0
@_this knowsAbout _nme < 2
_this setFuel _fuel
goto "check"
I have no idea if that works though..
And the script continues to loop until the tank it monitors is dead so that might need improving upon..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Ale

  • Members
  • *
Re: WW2 Tank Firing
« Reply #6 on: 20 Apr 2007, 23:00:08 »
It works perfectly, thank you. :clap:

Now I'm testing with more tanks and different "knowsabout" levels; thank to your help I have seen many duels between Tiger and Sherman, King Tiger and T34 and so on...
And I have seen that they never miss one shot; if the tank fires, it fires on the target.
It would be nice to add some more error in the firing ability of the ai tanks.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: WW2 Tank Firing
« Reply #7 on: 21 Apr 2007, 00:17:04 »
You can cause the AI to shoot poorly by scripting dispersion..

That is done by 'catching' the fired shell by utilising the fired eventHandler and altering the shell's velocity, which causes it to go 'off course'..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.