Home   Help Search Login Register  

Author Topic: How can I achieve a target view focus as in flight sims? Is it possible?  (Read 3247 times)

0 Members and 1 Guest are viewing this topic.

Offline p75

  • Members
  • *
Hi Lads,

If I would like to have a target view focus as you have in flight sims, meaning that you press a button and you see the locked target in 3rd person view and can spin 360 degrees around it.

Does such a script already exist? If not, what should I do to create it? I'd like it be general and only for singl player (my own missions), so no matter if your playing in a vehicle or not.

Appreciating your help. Thanks!

Offline p75

  • Members
  • *
Hi Lads,

I was wondering if one of you scripting gururs can help me out with this. If I want to add an action which would allow to switch from current position (say blue) to locked target view (say red). Preferably 3rd person view, allowing to turn around the object in freelock mode. First person view would be a bonus.

Appreciating all the help I can get with this!

Thanks!
« Last Edit: 08 Aug 2009, 13:19:24 by p75 »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Even though your first attempt got no responses, please stick to one thread per topic. Thanks.  :good:

Unfortunately, as far as I know, there's no way to determine exactly who or what you're targetting. Eventhandlers would enable you to determine the target, but only at the moment it gets hit, which is obviously not ideal for your purposes.

Offline p75

  • Members
  • *
Hi,

First of all my bad, I thought alittle about it and tried to formulate it better.

My line of thought is that when you have a lock on a target the data must be somewhere stored in the memory (variable), how can the rocket else find its target? That seems not logical.

If the target location is triggered after the fire button is pulled, then it would be possible to get the coordinate data of the target and design a script which would switch to the "missles" target view.

I'm thinking correctly?

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
There's lots of stuff in memory. The problem is that most of the time you're not allowed to access it. The game - of course - knows the locked target but it provides no (known) possibility to access it via script.

In case you find one, please enlighten us! :)
try { return true; } finally { return false; }

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
 as with all things Bis game related there are workarounds .

 In order to create a workaround you must first know certain parameters for which the script is needed , most important of these is :
 MP
 MP dedicated
 Addon based
 Scipt in mission
 Fire action repeatedly
 Just for a film
 Singleplayer personal fun or mass distribution.

 The easiest start is single player for which you can simply add an incomingmissile eventhandler toy your enemies which will activate a script, you can refine whteher this script will execute the PanCamera script depending on  a variable being true , this variable is set true by the shooter of the missile pressing a Keydown . incomingmissile handler will provide you with all you need missile and shooter etc.
 you can also do very complex maths using the camera of the unit and its angles , take this and LOS and some nearestobject magic and you can retrieve what your looking at rather than whats targeted.

 you can also use laserdesignator to give the refference point, but i think the only thing with this avaiable in the air is a custom addon ?

 Lots of ways but none out of the box unfortunately.

 if you then wish to export to MP then you refine everything ans start to add the apropiate Public  handlers variables etc. all of which can be found here on ofpec tutes.

 good luck.

 
 
« Last Edit: 08 Aug 2009, 18:55:30 by DeanosBeano »
I love ofp

Offline p75

  • Members
  • *
Hi Lads,

Thank you for the replies. I need to study the replies as I'm completely new to this. It is much appreciated!

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
One i nearly forgot is  cursorTarget

 ihavent messed with it yet but  i believe it will return the object you are pointing to , i have only read that it wont return visitor placed objects and objects that are behind windows , however with some observations and trials i am sure it will be best suited for your ideas here .

  i know there is some info on BIS wiki and some guy used it to attach satchels to sheep and things in a mission, if i found out more i will edit this post but i wont be editing for a week or so .

 
I love ofp

Offline p75

  • Members
  • *
Thanks, mate, appreciating your input, I'll have a look at this coming week.

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
 no problem
 My advice would be to simply use work arounds and compromise .
 However if you feel upto it CusrorTarget is a very handy thing , a word of warning though,
 cursortarget will return what your looking at I.E where your corss hairs are at in scope view or where your heads looking at in freeview .
 What you must remember is when you lock a target this will create a Nullobjet between you and your actual target and will then force the return from Cursortarget to be NullObject .
 The Grail is for someone one day to find what the p3d of that Nullobject is and apply a variable to it so we can then ascertain whats been locked , but for you in Single player you simply need .

 Mytarget = CursorTarget ; hint format ["i am looking at %1",Mytarget];

 put it in a script a radio trigger or whatever and try tohave fun with the Mytarget variable, i will have a look myself next week sometime

 Good luck.

edited the code missed some ""
« Last Edit: 09 Aug 2009, 11:29:49 by DeanosBeano »
I love ofp

Offline p75

  • Members
  • *
Great, thank You!

I'll give it a go this week. I'll update the thread with the results.

@Worldeater

Hey mate,

A mate of mine (Gigan) managed to make the script (meaning - shifting the view from my perspective to the targetview - and we're able to spin and zoom around it). I'll post the script later (still testing it). We tried it as you suggested with the crosshairs over the target, this has it limits though, as one needs to be kind of close and precise.

Now, we are looking if we can get it through the action menu, meaning we select a target through the action menu and the target view is then activated.

But for now we're stuck in the sense that when we have the target view activated we lose control of our helicopter, meaning that I as pilot (manual fire) can't fire any missle anymore as I lost the control of my vehicle. We would like to be able to fire when we are in this targetview. The question is, how could we achieve that?
« Last Edit: 10 Aug 2009, 11:59:38 by p75 »

Offline DeanosBeano

  • Addons Depot Staff
  • *****
  • SirDeanosbeano bstowed on me by sui ;)
    • Fraghaus
 unfortunately when you use camera view , you as a player are actually the camera ,you will notice in camera.sqs when going near a unit he will look at you :).

 the trick you need to have an ai in the gunner seat if its a two seater amd press left CTRL which will make the Ai fire , if there is no Ai then you must createvehiclelocal a Logic or an Ai place him in your group and in the gunners seat and tell him to fire as above always making sure you are the higher rank .
 If its a 1 seater plane then your gonna have to create a miracle with ATAN2 and script the missile to be fired , using selectweapon and fire action and script the missile all the way to the intended target.

 However i know others have way more experience than me in this field and may offer better alternatives.

 Good luck Gigan is a wise choice for a partner in this :)

I love ofp

Offline p75

  • Members
  • *
Thank You!

Yes, he is a great guy!

If anyone else wants to chimp in, please do so. As we're getting close to the intended script goal. Appreciating all the help we can get.

« Last Edit: 10 Aug 2009, 13:15:22 by p75 »