Home   Help Search Login Register  

Author Topic: gun elevation  (Read 4463 times)

0 Members and 1 Guest are viewing this topic.

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
gun elevation
« on: 07 Nov 2007, 15:04:55 »
i know this sort of thing has been asked before several times. and i have searched them all.

but all i need is a way of making arty guns aim into the sky.

it would be easy if the invisible H about 20 meters up worked. but the guns will respond to nothing in the sky other than a chopper.

is there an easier way?
Campaigns are hard, I'll stick with scripting for now!

Offline Cheetah

  • Former Staff
  • ****
Re: gun elevation
« Reply #1 on: 07 Nov 2007, 15:09:44 »
I tried the following in one of my scripts:

Code: [Select]
_x doWatch [(getPos _x select 0),(getPos _x select 1),1000];
Sadly, it didn't work out that well. Should be possible to use something this easy. Could be that the command gets easily overridden by enemy forces for example.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline jones

  • Members
  • *
Re: gun elevation
« Reply #2 on: 07 Nov 2007, 15:10:50 »
try the "do commands 

http://www.ofpec.com/COMREF/index.php?action=list&game=All&letter=d#doWatch

This would have the gun look straight up.

_x = (getpos _unit) select 0;
_y = (getpos _unit) select 1;
_unit Dowatch [_x, _y, 1000};

This would get the unit to look foward and up 500 meters.

_apos = ( position _unit );
            _posa = ( _apos select 0 ) ;
            _posb = ( _apos select 1 ) + 500;
            _posc = ( _apos select 2 ) + 500;
            _cpos = [ _posa, _posb, _posc ];
_unit Do Watch _cpos;

Mind you I haven't actually tested it but I belive it would work.
i am not sure exactl what you are trying to accomplish if you were more specific you could probably get abetter answer.
« Last Edit: 07 Nov 2007, 15:24:39 by jones »

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: gun elevation
« Reply #3 on: 07 Nov 2007, 15:17:11 »
I tried the following in one of my scripts:

Code: [Select]
_x doWatch [(getPos _x select 0),(getPos _x select 1),1000];
Sadly, it didn't work out that well. Should be possible to use something this easy. Could be that the command gets easily overridden by enemy forces for example.

i've been trying that.  but when i make the target an invisible object, or even just a wooden fence. it targets the ground where the object is above.
Campaigns are hard, I'll stick with scripting for now!

Offline Cheetah

  • Former Staff
  • ****
Re: gun elevation
« Reply #4 on: 07 Nov 2007, 16:26:16 »
Well I didn't use an object to look at. Tried to make the gun look at a position 1 km into the air (_x is the artillery piece).
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: gun elevation
« Reply #5 on: 07 Nov 2007, 16:55:58 »
right, it all works fine now.

all i need now it to know how to make a unit completely ignore enemies.

i know theres the setcomabtmode "blue".

but even that will allow the unit to sometimes aim at units and then continue aiming in the sky.
Campaigns are hard, I'll stick with scripting for now!

Offline jones

  • Members
  • *
Re: gun elevation
« Reply #6 on: 08 Nov 2007, 15:09:04 »
have you tried running the script in a loop? this might prevent the unit from changing it's behaviour.

Offline Cheetah

  • Former Staff
  • ****
Re: gun elevation
« Reply #7 on: 08 Nov 2007, 15:30:59 »
My experience with using a loop to achieve this is the same as mentioned
Quote
but even that will allow the unit to sometimes aim at units and then continue aiming in the sky.
.

Guess the only way is to turn off the AI's thinking.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: gun elevation
« Reply #8 on: 09 Nov 2007, 17:11:04 »
DisableAi "FIRE"

I think thats right.

May I ask what you did to get the artillery to face into the sky?

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: gun elevation
« Reply #9 on: 09 Nov 2007, 19:04:37 »
i dont use disableai in my missions, because the saveGame bug ruins it.

and to get the arty guns aiming into the sky, cheetahs idea worked:

_x doWatch [(getPos _x select 0),(getPos _x select 1),1000];
Campaigns are hard, I'll stick with scripting for now!

Offline Hellbender

  • Members
  • *
Re: gun elevation
« Reply #10 on: 10 Nov 2007, 20:32:12 »
So what if someone also wanted these guns to fire repeatedly while aiming at the sky? (Replacing doWatch with doFire doesn't work her!)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: gun elevation
« Reply #11 on: 10 Nov 2007, 21:53:14 »
u shud probably use da fire comand....

ull need 2 figure out wat shells 2 use tho...

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Surdus Priest

  • Members
  • *
  • Only I can Forgive You!
Re: gun elevation
« Reply #12 on: 11 Nov 2007, 02:34:43 »
_gun action ["useWeapon", _gun,gunner _gun,0];

will make the gun fire
Campaigns are hard, I'll stick with scripting for now!

Offline Hellbender

  • Members
  • *
Re: gun elevation
« Reply #13 on: 11 Nov 2007, 04:40:22 »
Alright, that works!

Thanks!

One more thing though! How do I get it to fire again and again by using a trigger?
« Last Edit: 11 Nov 2007, 04:47:56 by Hellbender »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: gun elevation
« Reply #14 on: 11 Nov 2007, 14:14:44 »
easier 2 use a script...

create a file called "repeatedfire.sqf" and in it put

Code: [Select]
_arty = _this select 0;
_delay = _this select 1;

while {alive _arty} do
{
  _arty action ["useWeapon", _arty ,gunner _arty ,0];
  sleep _delay;
};

if (true) exitwith{};

now in da init of da arty put

[this,30] execVM "repeatedfire.sqf";

u can change da number 2 have more or less delay between shots...

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta