OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Tyger on 08 Feb 2004, 02:43:29

Title: Targeting
Post by: Tyger on 08 Feb 2004, 02:43:29
Anyone have any ideas for how to create a script that returns a value when an object has been targeted?

I want to make a mission where the player is out to assainate a high ranking Kremlin offical visiting the front lines. When the player targets the offical, it activates a trigger.

Anyone have any ideas???

Cheers :cheers:
:gunman:Tyger:gunman:
Title: Re:Targeting
Post by: macguba on 08 Feb 2004, 11:43:47
You could fake it with a knowsAbout command.      

Condition:   player knowsAbout target > 1.5
Activation:   as you like

syntax not guaranteed.
Title: Re:Targeting
Post by: Tomb on 08 Feb 2004, 15:02:48
syntax prob. maccy ,  because the game engine don't know exactly WHEN the player
has detected a certain unit - the best way to beat this bug is to assign a grouped trooper
to the player, and when the AI moron in yer group detects the enemy, the trigger can fire.


 :-* later
Title: Re:Targeting
Post by: Tyger on 08 Feb 2004, 15:14:10
Hmm...

sounds like thats not nessarily workable.  :(
unfourtunatly, that means ill have 2 rework my mission
it was a nice attempt 2 help

(No sweat, ive done it three times or so now, due to scripting errors...) :P

Cheers :cheers:

Tyger
Title: Re:Targeting
Post by: h- on 08 Feb 2004, 17:43:43
syntax prob. maccy ,  because the game engine don't know exactly WHEN the player
has detected a certain unit - the best way to beat this bug is to assign a grouped trooper
to the player, and when the AI moron in yer group detects the enemy, the trigger can fire.
What bug? I've had the player knowsAbout working just fine...
Once you 'reveal' a target by right clicking your mouse (or what you have bind) the players knowsAbout value is risen, and it works the same way the AIs knowsAbout works...
Longer distance lowers the knowsAbout and vice versa...
I think it was something like 1.05 or 1.5 that is the limit before the player/AI reports a contact via radio though...

So the game engine knows exactly the same time player knows, IF he tells that to the engine, as does the AI... (the AI kinda presses an invisible 'reveal' button...)

So if a trigger is conditioned player knowsAbout target >= 1 it will be activated once the player 'reveals' the target (via the right click or something...)

I'm currently making a mission in which I have this kinda thing succesfully working...
Title: Re:Targeting
Post by: Tyger on 09 Feb 2004, 01:42:32
r u just saying create a trigger with this in the cond field:

player knowsAbout myTarget >=1

and in the activation field:

blah blah blah

if so, then this is a lot easier than i thought...

Title: Re:Targeting
Post by: macguba on 09 Feb 2004, 12:23:02
It's definitely worth a try.    You may have to play with the number a bit, maybe its 1, or 1.5.    Use a hint format command to investigate that.

hint format ["player knowsabout myTarget = %1", player knowsAbout myTarget]
Title: Re:Targeting
Post by: h- on 09 Feb 2004, 17:55:40
r u just saying create a trigger with this in the cond field:

player knowsAbout myTarget >=1

and in the activation field:

blah blah blah

if so, then this is a lot easier than i thought...
Yup... That works fine... In OFP almost everything is lots'a easier than it sounds...  ;)

I think when a player is in question you probably could use > 0 as well...  ???

Oh, and the value I was talking about (the 'magic value') is actually 0.105...  :-[ and has absolutely nothing to do with this current issue  ;D...
Check the on-line comref for knowsAbout, Toadlife and Pals have some exellent info there...
Title: Re:Targeting
Post by: Tyger on 09 Feb 2004, 21:40:09
excellent!

cheers all :cheers:

Tyger
Title: Re:Targeting
Post by: Kuro on 12 Feb 2004, 09:45:17
I have made a script which checks where are you aiming. (using some sinus and cosinus).

Do you want to give it a try ?

Greetings Kuro
Title: Re:Targeting
Post by: General Barron on 12 Feb 2004, 22:46:59
Quote
I have made a script which checks where are you aiming. (using some sinus and cosinus).

Do you want to give it a try ?

Greetings Kuro


Now does that script indicate elevation, or just which direction the unit is facing?
Title: Re:Targeting
Post by: Kuro on 13 Feb 2004, 04:12:26
No evaluation, because i have found no way to determine the angle which a player aims.
Title: Re:Targeting
Post by: sa8gecko on 13 Feb 2004, 20:53:49
Quote
No evaluation, because i have found no way to determine the angle which a player aims.

But if the player or AI fires a weapon you can get it. Is there some way
to do that without actually firing a weapon ?
Title: Re:Targeting
Post by: DrStrangelove on 14 Feb 2004, 11:22:54
If you know where he is aiming and what unit he knows about you can tell which unit his target is. By checking the height distance between player & target and the distance you can calculate the elevation.
Title: Re:Targeting
Post by: sa8gecko on 14 Feb 2004, 12:56:23
Quote
If you know where he is aiming and what unit he knows about you can tell which unit his target is. By checking the height distance between player & target and the distance you can calculate the elevation.
Yes, this is true. The problem is to know where he's aiming, especially
if he's in a turret. If I am right getdir returns the direction where is
pointed the nose of the vehicle, or can getdir returns the direction
of the gunner too (i.e. : getdir gunner vehicle player) ?
If knowsabout goes up to a certain value when the unit fires a shot
at his intended target, then this can lead to an interesting application:
giving the unit an eventhandler "fired", you could guess his target.
Then suppose the unit is a gunner of a car: if you replace the shell
with a beatiful missile, you could have a car launching a missile.
For guidance purpose you could use SEFE's script. I did a crappy
jeep firing SAMS, AI could engage too, but I used the method
to catch the shell and then go all along the shell's trajectory to
search for a suitable target, having found one I passed this to
SEFE's script.
But I think I'm gone a little off-topic so I stop here.