Home   Help Search Login Register  

Author Topic: "Semi-ai" controlled vehicles?  (Read 3433 times)

0 Members and 1 Guest are viewing this topic.

Offline hsburn

  • Members
  • *
"Semi-ai" controlled vehicles?
« on: 15 Oct 2007, 01:40:05 »
Hello!
I've been thinking about the armory level in ArmA where you can preview/try all the vehicles and weaponry in the game. When trying out the A10 the player is invited to test attacking some targets - after which you're positioned up in the air. Now here's the thing, you lose control of the aircraft at this point, and it's "forced" into what I remember feeling is a pre-defined path. Is this just a temporary AI-controlled bit of flight or is it possible to script exact movements?
What I'm basically interested in is being able to "record" exact movements of vehicles/men of my own, and then have the AI play them back up. Call it imitating if you wish. Some examples of things I'd like to be able to achieve, for example: Plane rolling/looping, Precise convoy movement, More aggressive ground-vehicle advancement etc etc.

In-depth examples:
#1: Having a littlebird fly down between houses and drop people off in the street - without killing everybody in the process. I know this can be done using that precise landing script, but what if I want the heli to quickly move along the street for a while before the drop-off?
#2: Instead of painfully watching vehicles advance/reverse in that irritating manner over and over - before actually leaving for their destination - I'd like to see them seriously hit the gas and just go for it (ala' setvelocity-style).
#3 Precise strafing-runs by both airplanes and helicopters (actually being able to manually pinpoint the nose and then script the firing-sequence and thereby being able to see a non-player A10 for example hit a "fieldtoilet" with the cannon.
#4 "Intelligent" driving in urban areas, seeing non-player vehicles quickly turn and orientate throughout cluttered areas/taking detours through alleys etc.

Some other questions that may or many not be related:
Q1: Is it possible to maintain vehicle/playercontrol after executing camera.sqs (even to just fire a weapon while in cameramode)?
Q2: Is it possible to maintain the "free-look" of a camera while having it attached to a vehicle, or must it be assigned a target(s)? (I've not yet attempted to actually attaching it, so perhaps I'm missing something obvious here. If so, excuse me).

Any help or directions towards sources covering these topics would be greatly appreciated.

Thank you! :)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: "Semi-ai" controlled vehicles?
« Reply #1 on: 15 Oct 2007, 03:03:33 »
As far as precise movement, I haven't much of a clue, but:

Q1) You can't maintain the normal control over a vehicle in any sort of camera mode. What you can do during camera mode, though, is capture key-presses, mouse button presses and movement using displaySetEventHandler (on display 46) and then do something with them in your scripts.

Q2) You can move a camera any way you want via scripts (but see Q1 for how you might capture keyboard activity to allow manual control). There is no requirement to target a specific object; you can just use camSetPos, camSetRelPos, camSetBank, camSetDive to position the camera. You can also use setVectorDir, setVectorUp, setPos, etc, as you might do with any non-camera object if that is easier (the main advantage to the camera-specific commands is that they allow for automatic tracking shots).

« Last Edit: 15 Oct 2007, 03:13:48 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: "Semi-ai" controlled vehicles?
« Reply #2 on: 15 Oct 2007, 09:39:38 »
Actually you can maintain control over your main avatar using the switchCamera
"When 900 years YOU reach, look as good you will not!"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: "Semi-ai" controlled vehicles?
« Reply #3 on: 15 Oct 2007, 10:46:22 »
About the recording, create a script that picks up velocity, direction and Up vectors of your vehicle every second and stores them into an array, when you are finised, activate a menu action or radio trigger, open a dialog with one or many edit boxes and copy the stored script there so you may copy/paste its content into a external script.

Now you only need to reproducte these values with setVectorDir, setVectorUp and setVelocity.

Offline hsburn

  • Members
  • *
Re: "Semi-ai" controlled vehicles?
« Reply #4 on: 15 Oct 2007, 23:13:11 »
Hello again, and thank you guys for the quick replies!

Mandoble, assuming I got you right you speak as if this is something theoretically achievable, even simple. If so, how come it has not been done (at least not with this particular purpose)? I personally believe I'm in a bit over my head here, seeing as I'm not the best coder/scripter, however as seemingly both Wolfrug and I would consider a solution to this to be something "godsend" I'm sure a solution to this would be a great breakthrough and/or highly appreciated by many ArmA-users, or am I missing something?

I've done some thinking though - about groundvehicles and their movement. Wouldn't it be possible to create some kind of script-templates for this, allowing users to personally fine tune some pre-made "samples" of basic maneuvers? Think of the first basic scripts as "Slow forward", "Fast forward" etc, with the addition of a couple of basic turning-scripts with various values on the turn radius. Assuming this would/could be done and everything ran based on the vehicle at hands own axis we would for example be able to rush that truck through an alleyway for example (a precise 90 degree turn into a perfectly straight space between buildings). The ease-of-use changes one could make would be acceleration/speed and amount of turn per unit of time?

When it comes to the idea of "ready-to-use-moves" aircraft may be a different story considering the added dimensions of travel/movement I guess.

About my camera-questions I'd be happy for any further input to clarify what I need to do (if possible). What I want is basically the ability to permanently fix the cameras position to a moving vehicle, but maintain the ability to personally control zoom/angles etc. Think of it as sitting in the cargospace of a vehicle without actually "being there" as a unit, but still simulating that effect by allowing normal first person view possibilities (looking around plus the now enabled zoom and capturing of the cameraposition/target for input in scripts). In simple English I guess I could say "How do I create a static camera placed in a vehicle - and can I keep looking around while tied to a vehicle?"

Thanks again for all your answers so far! :)


Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: "Semi-ai" controlled vehicles?
« Reply #5 on: 15 Oct 2007, 23:23:12 »
I didnt say anything about "theoretically achievable", it is simple, it is achievable, and IMO, it is useless, oh, and this is nothing new, it has been done in the past.

EDIT:
Mr. Flea example
« Last Edit: 15 Oct 2007, 23:31:40 by Mandoble »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: "Semi-ai" controlled vehicles?
« Reply #6 on: 16 Oct 2007, 13:36:24 »
Actually you can maintain control over your main avatar using the switchCamera command (try it: switchcamera to another unit then use the left-right-up-down keys to move your main avatar around - haven't found a way to shoot though, maybe if you map it to a keyboard key instead of the mouse?).
Oops, that is the last time I accept Mandoble's word that something is impossible ;P Thanks for that, which has now vastly improved my rear-view mirror script.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline hsburn

  • Members
  • *
Re: "Semi-ai" controlled vehicles?
« Reply #7 on: 18 Oct 2007, 03:14:51 »
I didnt say anything about "theoretically achievable", it is simple, it is achievable, and IMO, it is useless, oh, and this is nothing new, it has been done in the past.

I'm sorry, I didn't mean to offend you or anything, I must have misunderstood you. However, thanks for the link, as you can tell I had no idea things like that had been done - but hey, now I do! Now I'll just have to go teach myself how. Thanks for the heads-up Mandoble!

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: "Semi-ai" controlled vehicles?
« Reply #8 on: 18 Oct 2007, 10:29:38 »
Hi,

in fwatch demo mission Fwatch_Race.Noe made by kegetys, the player drives a car through a "special stage", then afterwards the player can watch it as a replay. Fwatch is for OFP but I throw it into this discussion as the demo mission closely does what is wanted here.

I've stored all fwatch files released by kegetys, including the demo mission, at:
http://www.kolumbus.fi/baddo/ofp/tools/fwatch10d_all.zip

Have a look! There are some scripts in that demo mission which are certainly interesting to you.

Best Regards,
Baddo.