Home   Help Search Login Register  

Author Topic: BAS rapelling bug  (Read 1193 times)

0 Members and 1 Guest are viewing this topic.

Offline calvinb1nav

  • Members
  • *
  • I'm a llama!
BAS rapelling bug
« on: 06 Nov 2004, 22:54:09 »
Greetings,
  I'm using the BAS_AIrope.sqs script with the BAS MH-60 in two of my missions.  It works like a champ and the soldiers rapel out just fine BUT the helicopter just sits there and hovers until I actually turn and look at it.  When I do that, then it proceeds to the next waypoint that I built for it.  It does this with both an AI squad and a squad with a human player.  In both cases, the chopper won't go to the next waypoint until the human player turns and looks directly at it.  Anyone else seen this and/or know how to fix it?  Thanks!

PBAR
Bone WSO

Offline Killswitch

  • Members
  • *
  • Peace, cheese and ArmA
Re:BAS rapelling bug
« Reply #1 on: 07 Nov 2004, 18:44:11 »
I have seen it and know the reason.

The why
The reason it doesn't work unless you are looking at the helo in question is a bug (or feature?)in OFP and how it handles animated parts of models. The BAS helos uses a nifty trick where there are small
animated parts used to keep track of what state a certain feature such as rapelling is in.

As you may know, one can use the command animate to activate an animation. The 'sister' to that is animationState with which one can query how far a certain animation has come. For example, think of an animated road checkpoint gate with a red-and-white barrier that can be elevated and lowered again. One can make that animated gate so that animationState returns 0 when the gate is lowered and 1 when it is fully up. Since lowering and raising the gate isn't instantaneous, animationState will return values between 0 and 1 while
the animation is in process.

The MAH60 helo (and many other addons out there) uses similar non-visible animations and their animationState values to keep track of how far a rapelling has proceeded. A very nifty trick, if I may say so myself  ;D

Now comes the crux of the matter: the OFP engine will not actually update the value that animationState returns unless the object that is being animated is viewed by the player(*).

Now, the BAS_AIRappel.sqs script within the MAH60 addon depends on animationState to return proper values so the script can control the sequence of events needed to make a rapelling a reality.

Consequences
Well, you've seen one of them first hand - your nice mission won't work unless you are around to stare at the nice Blackhawk rapelling down its cargo  :-X

A similar thing happens if you try to do this and have an AI-flown helo rope down an AI squad in a MP mission hosted on a dedicated server. See, a dedicated server will always return 0 for an animationState call. The theory here is that a deddy doesn't load certain parts of an addon model (since they aren't needed - a deddy doesn't do any graphical rendering). Animations are indeed affected by this and animationState is utterly useless in this case.

Solution
I can't think of a quick/easy one at the moment. I can imagine one could examine the inner workings of the MAH60 scripts and see if there's another way of doing it that doesn't depend on animation states being reported correctly. (That's my way of saying "I can't be ar*ed at the moment'" in a nice way ;D)


(*) This is not entirely true. There seems to be certain animated parts (the back ramp of the BAS MH47E Chinook is one) that have specific model properties that make animationState update even if a player isn't looking straight at it or is even close to the vehicle in question. Modelling and animations aren't my forté, so if anyone knows more about the magics of this, feel free to correct and amend to what I've written.
« Last Edit: 07 Nov 2004, 19:06:41 by Killswitch »

DeadMeatXM2

  • Guest
Re:BAS rapelling bug
« Reply #2 on: 08 Nov 2004, 18:50:20 »
(*) This is not entirely true. There seems to be certain animated parts (the back ramp of the BAS MH47E Chinook is one) that have specific model properties that make animationState update even if a player isn't looking straight at it or is even close to the vehicle in question. Modelling and animations aren't my forté, so if anyone knows more about the magics of this, feel free to correct and amend to what I've written.

We believe it is because the MH-47 has a sound fx attached to the ramp animation. I.e. the sound is broadcast globally from the helicopter, thus taking the animation state with it.

A simple solution would be to tie silent sounds to all of the animations, so that the state is broadcast to all clients.