Jump to content
Sign in to follow this  
Teryan

Spotter script

Recommended Posts

I can't get a clear answer on ofpec, so I'm coming here for your help.

Here is what i want the script to do:

You the sniper selects the target (thru a right click {reporting someone}, or the target; select target, or what ever), and the spotter calls out the range from you to the target (with in 10% accuracy). This is updated every three seconds. You shoot and if it is a hit, the spotter calls out a hit, if it is a miss, the spotter calls out a miss.

The only problem i'm really having is this:

The range can be found thur:

spottername sidechat format ["Distance = %1",snipername distance targetname]

But that is if you know the name, so:

1) Is it possible to get the name of something when you "select" them?

2) Is it possible to assign a name for that target?

3) In game, when you right click on something and the "Machinegunner, 200 yards." thing pops up, is it possible to use an event action to select that?

I think the guy at the bottom of the post (Here) had something, but i'm not shure. I can't really understand it (i'm new at this).

Any other ideas out there about how to do this?

Thanks for your help,

Teryan

Share this post


Link to post
Share on other sites

The rangefinding should be no problem... it's built-in. But how to acces it to use it for your purposes is something else... Anyone else?

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">spotter1 knowsAbout target1 > 3

I don't know if that's the correct way to design the code string. If it is, use it for all targets and use it as a condition for that distance command (spottername sidechat format ["Distance = %1",snipername distance targetname]).

Share this post


Link to post
Share on other sites
Quote[/b] ]The rangefinding should be no problem... it's built-in.

Not when the commander calls out the range:

Go here for pic

@iNeo: I'm not really shure what you sead.... rock.gif

But thanks for the help

Share this post


Link to post
Share on other sites

I mean, to activate the trigger where you have put:

spottername sidechat format ["Distance = %1",snipername distance targetname]

use as Condition:

spotter1 knowsAbout target1 > 3

But use one trigger per target.

So one trigger would look like this:

Condition: spotter1 knowsAbout target1 > 3

On Activation: spotter1 sidechat format ["Distance = %1",snipername distance target1]

And another one like this:

Condition: spotter1 knowsAbout target2 > 3

On Activation: spotter1 sidechat format ["Distance = %1",snipername distance target2]

Share this post


Link to post
Share on other sites

Ok,

so everyone would have a name, target1, target2, etc. and when the sniper/spotter hit the WP the spotter spots target1, then another WP, spotter spots target2.

That is a good idea, but not quite what i am looking for.

Thanks.

Share this post


Link to post
Share on other sites

No, I didn't mean WP's. knowsAbout detects if the spotter knows about the target. Ranging from 1 to 4 (how much). So when he right-clicks, it should be at least 3 I was thinking. And that triggers the distance message on sidechat. smile_o.gif

Share this post


Link to post
Share on other sites

I think i get it now....

For every person there is a trigger (no WP biggrin_o.gif ), and when they right click on that person the trigger is actaveted, and the rangecall is called.  Sounds great, except with mission with a ton of people.

Did I get it this time?

Thanks alot.

How does this look?

Creat a trigger,

Condition: spotter1 knowsAbout target1 > 3

On Activation: Call script spotter

Creat a trigger,

Condition: spotter1 knowsAbout target2 > 3

On Activation: Call script spotter

Creat a trigger,

Condition: spotter1 knowsAbout target3 > 3

On Activation: Call script spotter

Script spotter:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

spotter sidechat format ["Distance = %1",sniper distance target1]

_dis=sniper distance _target1

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target1 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;and targetkilled.sqs contains this:

_killer=_this select 1

?_killer==sniper:hint "Hit!"

;target2

spotter sidechat format ["Distance = %1",sniper distance target2]

_dis=sniper distance _target2

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target2 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;and targetkilled.sqs contains this:

_killer=_this select 1

?_killer==sniper:hint "Hit!"

;target3

spotter sidechat format ["Distance = %1",sniper distance target3]

_dis=sniper distance _target3

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target3 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;and targetkilled.sqs contains this:

_killer=_this select 1

?_killer==sniper:hint "Hit!"

;so on for however many targets there are...

Share this post


Link to post
Share on other sites

Yep you got it biggrin_o.gif I must be terrible at explaining things lol

Share this post


Link to post
Share on other sites

Na, I'm just new at this (and have not been sleeping for the past couple of days.)  What do you think of the script?  Ooops I see an error now, there should be two scripts:

One for the calling of the range and the caculation of errors and another to see if the sniper hit the target.

New script:

Quote[/b] ]

spotter sidechat format ["Distance = %1",sniper distance target1]

_dis=sniper distance _target1

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target1 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;target2

spotter sidechat format ["Distance = %1",sniper distance target2]

_dis=sniper distance _target2

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target2 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;target3

spotter sidechat format ["Distance = %1",sniper distance target3]

_dis=sniper distance _target3

_dis=_dis + _dis*(((random 20)/100) -.1)

spotter sidechat format ["Distance = %1",_dis]

target3 addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

;so on for however many targets there are...

target killed.sqs

Quote[/b] ]

_killer=_this select 1

?_killer==sniper:hint "Hit!"

Share this post


Link to post
Share on other sites

Also through some trig functions you can make sure you have the right target by checking if the caller is looking within say 10degrees of the direction of the target. smile_o.gif That would be pretty bullet proof combined with knowsabout, especially if you give isntructions to look in the exact direciton of target when calling.

Share this post


Link to post
Share on other sites

Hum, I'm having trouble getting it to work.  Would some one else please try to get it work? It's prlobley somethign dum that i am screwing up.

@bn880, sounds good (what i could understand of that), but i'm not shure how to do that.  sad_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×