Home   Help Search Login Register  

Author Topic: Detection Script Problems  (Read 449 times)

0 Members and 1 Guest are viewing this topic.

worksexdeath

  • Guest
Detection Script Problems
« on: 21 Jun 2004, 01:41:50 »
Hi.  Im new to this scripting idea, and im already having problems on my first script.  Im trying to make a script which will be called by a trigger when a helicopter knowsabout of the player level rises above 0.2. So far I have had a few problems with this.

The first is choosing the knowsabout level.  I did some research but couldnt get a definate answer, what is the value when the ai knows that you are there? ie when they first see you.

The second problem I assume is within the script.  What I would like is far 3 groups to have a search and destroy waypoint placed on the players position when the trigger is switched (when the helicopter has seen the player) as well as the helicopters search&destroy waypoint being moved.  I thought this would be simple with the script

#loop

[BMP, 2] setWPPos getPos Dave
[BMP_1, 2] setWPPos getPos Dave
[BMP_2, 2] setWPPos getPos Dave
[Searchopper1,3] setWPPos getPos Dave
~60
goto "Loop"


but the helicopter decides to switch off its engine when the script is activated.  I

The third problem I had is I couldnt find how to exit the script from the trigger, ie, what do I put in the deactivation field of the script that will stop the script from looping?

Quite simple problems I know, but I cant figure them out and cant find answers in the forum, so maybe you guys can help.
Thanks in advance.

j-man

  • Guest
Re:Detection Script Problems
« Reply #1 on: 21 Jun 2004, 02:41:17 »
Hey there,

Have a search through this page:

http://www.ofpec.com/editors/comref.php?letter=K

it has a ton of info on the "knowsabout" command.
« Last Edit: 21 Jun 2004, 02:41:35 by j-man »

CrashnBurn

  • Guest
Re:Detection Script Problems
« Reply #2 on: 21 Jun 2004, 02:51:18 »
Someone may correct me on this...maybe not. When a unit starts as a mission loads, it already has a waypoint value of "0" which is the spot it starts at on level load, whether it was given an editor placed waypoint or not. So in theory, an editor placed waypoint with a number of "0" is actually "1". Try changing all your numbers up by a unit of "1" in your setwppos script. If it's 2 change it to 3 and see what happens.

#loop

[BMP, 2] setWPPos getPos Dave
[BMP_1, 2] setWPPos getPos Dave
[BMP_2, 2] setWPPos getPos Dave
[Searchopper1,3] setWPPos getPos Dave
~60
goto "Loop"

==========================================

Try this instead-

#loop

[BMP, 3] setWPPos getPos Dave
[BMP_1, 3] setWPPos getPos Dave
[BMP_2, 3] setWPPos getPos Dave
[Searchopper1,4] setWPPos getPos Dave
~60
goto "Loop"

=======================================

Don't ask my why, but this actually worked for me in a mission I was working on. Go figure ??

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Detection Script Problems
« Reply #3 on: 21 Jun 2004, 10:21:08 »
Deactivation fields are conceptually more tricky than they look:  in fact they are rarely used.    They are appropriate when you want something to happen when the trigger condition has previously been true, but has now switched back to false.

Script loops are entirely different.   The usual way to end a script loop is something like this

#loop
? condition: goto "next"
the looping script stuff
goto "loop"

#next
a whole bunch of stuff.  

When the condition becomes true, the computer moves on to the next section of the script.   Sometimes you just have this

? condition: exit

Quite often condition is a variable, which of course may have been set to true by a trigger in the mission.    If you really wanted the deactivation of a trigger to end your loop, that is how you would do it.   However, in this case I suspect its unlikely that that's what you really want and there is certainly no virtue in using deactivation unless it really does what you want.   Think carefully about the conditions under which you want the loop to stop.

Note that S&D destroy waypoints don't last forever:  the group will eventually go on to its next waypoint, or if that is the last one they'll just stand there.      S&D waypoints are often paired with a cycle WP.    Use a switch trigger synched to the cycle WP to get them to move on when you want.

Notwithstanding the excellent stuff written about knowsabout, you may need to do some experiments of your own to find the right level for your mission.
Plenty of reviewed ArmA missions for you to play