Home   Help Search Login Register  

Author Topic: Spoter script  (Read 2864 times)

0 Members and 1 Guest are viewing this topic.

Teryan

  • Guest
Spoter script
« on: 10 Aug 2003, 00:01:52 »
I would like to make/have a script where the spoter.
It goes like this:

Sniper (you) find person, right click on them.
Spoter trackes enemy until you right click on something else or thing dies.
During that time the spoter calls out the range from the spoter to the target (with in 10% accuracy) every three seconds.
Each time the sniper fires the spoter calls a hit or a miss.

Any idea how I could make this?  I'm just getting into the tutorials on the site and this is just a little over my head.

SharkDog

  • Guest
Re:Spoter script
« Reply #1 on: 10 Aug 2003, 13:34:57 »
Whats a spoter?

SheepOnMintSauce

  • Guest
Re:Spoter script
« Reply #2 on: 10 Aug 2003, 15:52:16 »
I think he means spotter.  :)

Crassus

  • Guest
Re:Spoter script
« Reply #3 on: 10 Aug 2003, 16:39:07 »
May I suggest posting a reference to this question in the Advanced Scripting section....

What your asking for is advanced scripting requiring the following:
  • That a specific person or persons be audibly identified.
I don't believe there is a way to script detecting mouse or keyboard actions, beyond the command which will wait for the player to press "C".

  • Your spotter to track the target
Probably just a series of doWatch commands, with checks to make sure he's still watching the intended target

  • Intermittent checks and reporting of distance between your sniper/spotter team and the target(s).
  • A method of detecting whether your shots hit or miss (and you call yourself a sniper!  ;D)
    I don't believe there is a method for detecting this. Though, and I'm probably just spewing junk, I believe there's a command to check if a weapons been fired, so if you fire your weapon, and a getDammage check of your target(s) is made and found to be zero, then perhaps "hit" or "miss" could be scripted.

    Again, I could be talking out of my arse, so get help from real scripters.

Teryan

  • Guest
Re:Spoter script
« Reply #4 on: 10 Aug 2003, 18:58:11 »
Quote
May I suggest posting a reference to this question in the Advanced Scripting section....
Will do.

Quote
That a specific person or persons be audibly identified.
I don't believe there is a way to script detecting mouse or keyboard actions, beyond the command which will wait for the player to press "C".

Ya know when you right click on an enemy and it reports it to the commander?  "Soldiger 200 yards."  Maby it is possible so that when you report it as the commander the spotter watches with those doWatch command.  So it would not half to be a button but a report.  The engion would half to check every time you right click on something weather it has been reporter or not.  So maby if it has been reported and you right click on it, the spotter starts spotting.

Quote
and you call yourself a sniper!  
Funny guy huna?

Quote
don't believe there is a method for detecting this. Though, and I'm probably just spewing junk, I believe there's a command to check if a weapons been fired, so if you fire your weapon, and a getDammage check of your target(s) is made and found to be zero, then perhaps "hit" or "miss" could be scripted.

Sounds good.

SheepOnMintSauce

  • Guest
Re:Spoter script
« Reply #5 on: 10 Aug 2003, 19:24:18 »
Quote
don't believe there is a method for detecting this. Though, and I'm probably just spewing junk, I believe there's a command to check if a weapons been fired, so if you fire your weapon, and a getDammage check of your target(s) is made and found to be zero, then perhaps "hit" or "miss" could be scripted.

You might have to consider that if the sniper missed, but another unit in the area hit the target, the spotter would report back "hit" even the sniper missed. Ok, this might be rare, but it's something to be thought about. It sounds like a great idea for a script though.  ;D

Offline KJAM

  • Contributing Member
  • **
  • Why Me, Whats it For?
    • Nightstalker mod
Re:Spoter script
« Reply #6 on: 10 Aug 2003, 22:12:58 »
just suppose your bullet went thru two people who conviniently went in a coloumn before you shot, would the spotter report 2 hits? hehehe

Teryan

  • Guest
Re:Spoter script
« Reply #7 on: 10 Aug 2003, 22:29:45 »
Quote
just suppose your bullet went thru two people who conviniently went in a coloumn before you shot, would the spotter report 2 hits? hehehe

Do bullets go thru people?  I did not think they did, I've never seen it.  Explosions and that kind of thing, but that is not the roll of a sout/sniper.  As for a direct answer to your question:  No, the spoter is on one person, not two.

Quote
You might have to consider that if the sniper missed, but another unit in the area hit the target, the spotter would report back "hit" even the sniper missed.

So it would not be perfect, but the person is dead and that is the objective.

Quote
It sounds like a great idea for a script though
So far no one can make it, so let's break it down into segmetns:

1) Range finding. From Sniper to target.
2) Reporting the range. Reporting it.  It could be a text thing.
3) Calling a Hit / Miss.

I know the rangefinding is possible but not how.

deaddog

  • Guest
Re:Spoter script
« Reply #8 on: 10 Aug 2003, 23:00:11 »
Quote
1) Range finding. From Sniper to target.
2) Reporting the range. Reporting it.  It could be a text thing

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

Easy, huh ? :)

or, for +/- 10% accuracy:

_dis=snipername distance _target
_dis=_dis + _dis*(((random 20)/100) -.1)
spottername sidechat format ["Distance = %1",_dis]
« Last Edit: 10 Aug 2003, 23:10:38 by deaddog »

SheepOnMintSauce

  • Guest
Re:Spoter script
« Reply #9 on: 10 Aug 2003, 23:14:23 »
Quote
spottername sidechat format ["Distance = %1",snipername distance targetname]

That would work.  ;D I used that before when finding the distance between a helicopter and a shilka.  :)

Quote
Do bullets go thru people?  I did not think they did, I've never seen it.  Explosions and that kind of thing, but that is not the roll of a sout/sniper.  As for a direct answer to your question:  No, the spoter is on one person, not two.

No, you're right they don't. Pity that too. :(

Quote
So it would not be perfect, but the person is dead and that is the objective.

Not to accurately indicate if a sniper has hit a target or not? ??? I'm sure there is another way, to do it though, so that only a bullet from the sniper will indicate a hit, and not a (stray?) bullet from another unit report as a hit, so it returns as a miss by the sniper otherwise. Then, you could say if the target was neutralised after that.




deaddog

  • Guest
Re:Spoter script
« Reply #10 on: 11 Aug 2003, 00:57:52 »
The "killed" event handler can be used to determine who the killer is:

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

and targetkilled.sqs contains this:

_killer=_this select 1

?_killer==snipername:hint "The sniper killed this guy!!"

Teryan

  • Guest
Re:Spoter script
« Reply #11 on: 11 Aug 2003, 03:37:22 »
Quote
Not to accurately indicate if a sniper has hit a target or not?

I'm not too worried about this, beacuse mostley when I snipe or in sniper missions, 1) I constrate on the people that can't be hit easley, 2) I'm by my self with no other frendley units around.  Thow it seems deaddog found a reasonable response, so it's all good.

Thanks for the help so far.

Teryan

  • Guest
Re:Spoter script
« Reply #12 on: 11 Aug 2003, 22:09:00 »
I tried the script and nothign happend.
This is what i used:

Code: [Select]
;spotter is name of spotter
;sniper is name of the sniper
;target1 is the name of the target

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]

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

;and targetkilled.sqs contains this:

_killer=_this select 1

?_killer==sniper:hint "The sniper killed this guy!!"


I am new at this(as you can tell), but why did that not work?
Some other problems, there could only be one person that the spotter could report on.  I want anyone in the battle field that is a person for the spotter to report the distance.  Maby it could go like this:

_target1 gets assigned (thur an even action(or something), like telling the spotter to target the target) to the person targeted, it then goes thur the:
spotter sidechat format ["Distance = %1", sniper distance target1]

That sound good?

Then there is the report every x seconds, (I think three sounds good).  How would that happen?  Is there a time thing?  A loop would work for this I think.  After the guy gets targeted, a loop starts.  If the guy is dead or the sniper targets something else (any thing, like the ground; dont want him going on forever) he stops.

Thanks for the help so far,
Teryan

deaddog

  • Guest
Re:Spoter script
« Reply #13 on: 11 Aug 2003, 23:53:15 »
Quote
target addEventHandler ["killed",{_this exec "targetKilled.sqs"}]

Shouldn't that be target1 instead of target?

 :)

Teryan

  • Guest
Re:Spoter script
« Reply #14 on: 12 Aug 2003, 07:10:32 »
Quote
Shouldn't that be target1 instead of target?

 

Yea, probley.  I'll test tomarrow.

I was thinking today, what if instend of having the spotter track the auctual person, what if a marker was made at that spot (like when calling arterly)?  
Ex:
So let's say that the sniper is the highest rank.  There is three men on a hill some distance away, the sniper call's out all the targets (and get's back some bogus range {I tested that today}.  The sniper (player) then selects the spoter and uses the target (key 3) the person he wants spotted.  The scipt makes a marker at that position (the name would always be the same, so there would be no assigning different names in the: spotter sidechat format ["Distance = %1", sniper distance target1]).  Sniper reports range.  Guy 1 gets sniped, and is reported as dead.  The second guy just drop and is soon taken out, but no report beacuse he was not targeted.  The third guy decieds to run, the sniper tells the spotter to target him.  Spotter returns with a range, and the sniper fires.  The sniper misses the first time.   The spotter tells him he missed, so he fires again and gets a hit report back.

As for telling if it is a hit/miss with the marker, there could be another part of the script that selects the person closest to the marker, and ......

Any other ideas on how to do this out there?  Can you assign names?

*Edit*
The last guy that posted in this link, had some way of finding targets and range to targets(I think, I dont know what the hell the script is trying to say thow).  So if you can decode for me what is is saying it would be greatley apprecated.
Link:
http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=705c734f25ac84d6e7b47b182f1c71d3;act=ST;f=7;t=32775;hl=distance+to+target

I tried the script and still nothing happened.
« Last Edit: 12 Aug 2003, 19:17:32 by Teryan »