Home   Help Search Login Register  

Author Topic: Helo moves to random locations during flight  (Read 7304 times)

0 Members and 1 Guest are viewing this topic.

Offline Rommel92

  • Members
  • *
Re: Helo moves to random locations during flight
« Reply #30 on: 20 Apr 2008, 23:49:47 »
Code: [Select]
_heli removeEventHandler ["dammaged",_HEid];
Sorry, forgot the index of the removeEventHandler. Give that one a burl now.
(Above post edited for easy Ctrl - C)

EDIT:
Also, what is "_spd" For?
(Its defined as 1100 mid-section of script)
« Last Edit: 20 Apr 2008, 23:51:53 by Rommel92 »

Offline trinec

  • Members
  • *
  • I'm a llama!
Re: Helo moves to random locations during flight
« Reply #31 on: 20 Apr 2008, 23:59:14 »
Not sure about the _spd part it was already there in the script .  It didnt look like it was in use to me, but I didnt delete it .

Offline trinec

  • Members
  • *
  • I'm a llama!
Re: Helo moves to random locations during flight
« Reply #32 on: 21 Apr 2008, 00:32:27 »
New update now it gives an error on the same line

Code: [Select]
_heli removeEventHandler ["dammaged",_HEid];
Error type any, expected number

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helo moves to random locations during flight
« Reply #33 on: 21 Apr 2008, 06:49:11 »
Trinec, do not post consecutively.
If you have something to add after a short period of time (less than 2-3 days) modify your post instead of 'replying to yourself'.


Anyhoo, there's a typo in the addEventhandler line, should be
Code: [Select]
_HEid = _heli addEventHandler ["dammaged",
{
if((_this select 1)=="mala vrtule"and(_this select 2)==1)then
{
rotordead=true
hint format ["s0: %1\ns1: %2\ns2: %3",_this select 0,_this select 1,_this select 2]
};
}];
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline trinec

  • Members
  • *
  • I'm a llama!
Re: Helo moves to random locations during flight
« Reply #34 on: 22 Apr 2008, 01:19:56 »
Sorry about the overposting.  Wasn't sure if I should have put that last message together with the other message or not.  But now I know. 

Well I still get the same error message.


Code: [Select]
_heli removeEventHandler ["dammaged",_HEid];
Error type any, expected number

Also all of the hint format messages some across as null not sure if they are suppose to or not.

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helo moves to random locations during flight
« Reply #35 on: 22 Apr 2008, 08:59:04 »
I must need new glasses  :D
There are more typos in the add eventhandler part (even though I had no errors even with all teh typos in  ??? ).

It should be
Code: [Select]
_HEid = _heli addEventHandler ["dammaged",
{
if((_this select 1)=="mala vrtule"and(_this select 2)==1)then
{
rotordead=true;
hint format ["s0: %1\ns1: %2\ns2: %3",_this select 0,_this select 1,_this select 2];
};
}];

The script doesn't do anything though, dunno if trying to use it the right way or not..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Rommel92

  • Members
  • *
Re: Helo moves to random locations during flight
« Reply #36 on: 22 Apr 2008, 09:14:26 »
Somehow... If you had no errors, then clearly its either, not launching the event handler, or this select 1 doesn't equal mala vrtule.

Offline trinec

  • Members
  • *
  • I'm a llama!
Re: Helo moves to random locations during flight
« Reply #37 on: 24 Apr 2008, 06:28:10 »
If you replace the rpg ammo line

Code: [Select]
_bullet = "pg7v" createvehicle _pos1;
with this line of code you should see multiple tracer rounds hitting near the rotor of the helicopter atleast on the blackhawk anyways.

Code: [Select]
_bullet = "B_127x99_Ball_noTracer" createvehicle _pos1;
I still get the same error even with the changes so not sure what i'm doing wrong.

I really don't know what "mala vrtule" means to be honest but it was part of this script.  But basicly I was trying to get a rpg to hit the tailrotor so the helicopter will go into a spin and hopefully not kill everyone on the way down.  The other script that I tried did this but basicly it just starts spinning and goes down with a smoking tail rotor.  However unrealistic as it is I might have to go back to that.  I know that this part of the code maybe able to re-use to get the rpg to hit the rotor at a decent spot not sure though.

Code: [Select]
_pos1 = _heli modelToWorld [1,-7.9,0.95];
_pos2 = _heli modelToWorld [-1,-7.9,0.95];
_vx = (_pos2 select 0) - (_pos1 select 0);
_vy = (_pos2 select 1) - (_pos1 select 1);
_vz = (_pos2 select 2) - (_pos1 select 2);
_bullet = "pg7v" createvehicle _pos1;
_bullet setpos _pos1;

Thanks

GiTrinec

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helo moves to random locations during flight
« Reply #38 on: 24 Apr 2008, 09:19:38 »
I only see a couple of soke puffs/hear a couple of 'tunk' sounds to indicate some sort of impact.
The other ammo originally used doesn't do anything.

But, I had to use the _heli = _this select 0; part instead of the _heli = vehicle player;, because if I used the latter there were no bullets fired at all.
But still no errors.

Quote
I really don't know what "mala vrtule" means
The models in the game can have many so called 'named selections', parts of the model are specially named so that the game knows what do with them.
"mala vrtule" is the tail rotor selection.

Which leads me to this, don't use modelToWorld alone, use selectionPosition as well.
This way you get the bullets to impact the desired selection without any "trial 'n' error".

So, replace this both _pos lines with:
Code: [Select]
_pos1 = _heli modelToWorld (_heli selectionPosition "mala vrtule");
_pos2 = _heli modelToWorld (_heli selectionPosition "mala vrtule");

EDIT:
Oh, and of course the pg7v doesn't show up because it's the weapons magazine class, you need to use the ammo class to create the rocket. In this case it's R_PG7V_AT. But that blows the chopper to pieces so something less powerfull is needed..

EDIT2:
Ok, changed your code a bit:
Code: [Select]
_heli = _this;
_rotordead = false;

_HEid = _heli addEventHandler ["dammaged",
{
if ((_this select 1)=="mala vrtule" && (_this select 2)>0.8) then
{
_rotordead=true;
hint format ["s0: %1\ns1: %2\ns2: %3",_this select 0,_this select 1,_this select 2];
};
}];
sleep 0.5;

_spd = 1100;

while {!_rotordead}
 do {
_pos1 = _heli modelToWorld (_heli selectionPosition "mala vrtule");
_pos2 = _heli modelToWorld (_heli selectionPosition "mala vrtule");
_vx = (_pos2 select 0) - (_pos1 select 0);
_vy = (_pos2 select 1) - (_pos1 select 1);
_vz = (_pos2 select 2) - (_pos1 select 2);
_bullet = "B_127x99_Ball_noTracer" createvehicle _pos1;
_bullet setpos _pos1;

_cvel = velocity _heli;
_fact = 50;

_bullet setvelocity [(_cvel select 0) + _vx * _fact,(_cvel select 1) + _vy * _fact,(_cvel select 2) + _vz * _fact];

sleep 0.1;
    };
   
_heli removeEventHandler ["dammaged",_HEid];

execute with
Code: [Select]
heloname execVM "script.sqf"
But using those bullets it takes up to the doomsday before the chopper gets any damage..
« Last Edit: 24 Apr 2008, 09:29:02 by h- »
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Rommel92

  • Members
  • *
Re: Helo moves to random locations during flight
« Reply #39 on: 24 Apr 2008, 10:46:04 »
Quote
But using those bullets it takes up to the doomsday before the chopper gets any damage..

Not necessarily, the higher the velocity you give the bullets the more it will damage, damage is based on speed in ArmA remember, so you can make a pistol bullet going mach 8 kill a tank (tested and worked hilariously.)

 :whistle:

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helo moves to random locations during flight
« Reply #40 on: 24 Apr 2008, 11:00:31 »
Oh?
I just thought it was one of those features that never made it to the game..

I'm a complete maths retard so setting a velocity for a bullet is completely out of my grasp so I never tested it.  :confused:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline trinec

  • Members
  • *
  • I'm a llama!
Re: Helo moves to random locations during flight
« Reply #41 on: 26 Apr 2008, 05:45:54 »
Not sure but it seems the

Code: [Select]
if ((_this select 1)=="mala vrtule" && (_this select 2)>0.8) then
doesnt detect dammage because the helo keeps constantly being hit even with heavier ammo. 



Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helo moves to random locations during flight
« Reply #42 on: 26 Apr 2008, 11:59:53 »
You can try to change the 0.8 to some lower value.

It did work when the chopper was hit with a missile instead of bullets so it should detect damage.  :scratch:
You could also try what Rommel was talking about, speed up the bullets..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.