Home   Help Search Login Register  

Author Topic: complicated script I need help with  (Read 455 times)

0 Members and 1 Guest are viewing this topic.

Nobby

  • Guest
complicated script I need help with
« on: 10 Jul 2003, 17:17:09 »
first of all there is you - player
and a policeman - p1

#1 Then, when the player picks up a M21 the policeman goes to "COMBAT"

?player hasweapon "M21": p1 setbehaviour "COMBAT"

#2 if M21 is fired then p1 will kill you

?player hasweapon "m21": player addeventhandler ["Fired",{p1 dofire player}]

#3 if you leave p1s company at more than 10 metres, he will kill you

? player has weapon "M21" and player distance p1 > 10: p1 dofire player

#4 if player surrenders then p1 will walk up to you and arrest you

? player hasweapon "M21": surrender = player addaction ["Surrender","surrender.sqs"]

#surrender.sqs
player removeaction surrender
player switchmove "FXStandsuruniv"
p1 domove getpos player
?player distance p1 < 1: removeallweapons player; p1 addweapon "m21"
exit

What I want to know is:

1) how do you get the p1 to calculate a 10m diameter of the spot you are from, and if you leave that circumfrence then he shoots you (kinda like a "DON'T MOVE" scenario
2)how do you get the p1 to hold his fire and stay "SAFE" until he sees (detects) you, otherwise, as soon as you pick the gun up he goes into "COMBAT"
3)can all this be worked into one big script instead of triggers everywhere
4) are there any suggestions that people want to add to the script.
5)is there anything wrong with the syntax's so far

Any help is needed and will be much appreciated.

Cheers

Nobby.

Rubble_Maker

  • Guest
Re:complicated script I need help with
« Reply #1 on: 10 Jul 2003, 21:07:44 »
1) use the "distance" function

2) use "combatMode group unit" to set unit's combat mode to "never fire" (see official script manual), and use this to wait until he sees you:

_thres=0.3
@unit knowsAbout player>_thres

Experiment with the "_thres" value though. 1 means he knows definetely where you are, 0 means he knows nothing.