Home   Help Search Login Register  

Author Topic: Units patrol until opfor detected -> Search and Destroy?  (Read 2473 times)

0 Members and 1 Guest are viewing this topic.

Offline $nakezz

  • Members
  • *
Hey, i'd like to know how to set out a unit to move from waypoint to waypoint and cycle until the enemy is spotted, then all these waypoints are deleted, and a new assigned to search and destroy where the units where spotted? I know it's possible, but i've been lookin around for scripts and can't find one. Thanks!

Offline Sparticus76

  • Members
  • *
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #1 on: 22 Apr 2008, 11:04:56 »
try setwppos for all the waypoints to the enemy pos?

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #2 on: 22 Apr 2008, 12:10:54 »
You create your waypoints as normal.
You finish the last waypoint with a cycle right? Well, after the cycle make another waypoint which is the one that will go after the baddies.

Now make a trigger 0x0 or 1x1 it doesn't matter.
In it give it a condition and set it to "Switch". Condition can be anything. Try
Code: [Select]
GoGetEm
Now Sync the trigger with the Cycle waypoint.

That's it. When you want the guys to stop cycling meet the condition.
Code: [Select]
GoGetEm = True
James Andrew Wilkinson 1977 - 2005 R.I.P.
"If it ain't the friggin' incoming it's the friggin' outgoing. Only difference is who gets the friggin' grease, and that ain't no friggin' difference at all."

Offline Cold

  • Members
  • *
  • Mission Maker
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #3 on: 22 Apr 2008, 15:30:34 »
If you don't feel like changing the condition from "this" to something as The-Architect suggested, you can simply set the trigger type to "switch" and at the top of the box set it to Opfor, detected by BluFor... you'll have to make the trigger size encompass the area your troops and the enemy are however... something like 400x400. Hope it helped... this is just a way to do it without having to code anything - although coding can work better.
A leader is best when people barely know he exists, when his work is done, his aim fulfilled, they will say: we did it ourselves. <br />Lao Tzu

Offline $nakezz

  • Members
  • *
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #4 on: 27 Apr 2008, 18:32:02 »
Ahhh thanks! What I was looking for :D.!

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #5 on: 11 Jun 2008, 23:49:23 »
You create your waypoints as normal.
You finish the last waypoint with a cycle right? Well, after the cycle make another waypoint which is the one that will go after the baddies.

Now make a trigger 0x0 or 1x1 it doesn't matter.
In it give it a condition and set it to "Switch". Condition can be anything. Try
Code: [Select]
GoGetEm
Now Sync the trigger with the Cycle waypoint.

That's it. When you want the guys to stop cycling meet the condition.
Code: [Select]
GoGetEm = True

The waypoint i had after cycle is Seach and destroy. But after they have searched down and killed the enemy they still go on S&D. My trigger is a switch with GoGetEm in the condition field. and blufor detected by opfor. That thing with meet the condition i dont know how to do.. Can anyone enlighten me?

Thanks,

Offline Gcfungus

  • Members
  • *
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #6 on: 12 Jun 2008, 00:35:51 »
I think rather than using a variable, just use a normal trigger for the condition you want. Switch it's type to 'switch' and syncronise it with the cycle waypoint.

Also, I'm not sure about the S&D waypoint. Does it stop searching once everything is clear? Maybe that's just something with that type of WP. If they continue you could try using a trigger checking for no enemies, then stopping them from continuing.
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #7 on: 12 Jun 2008, 03:03:24 »
It's possible, but requires some nasty use of Repeating Switch triggers, which can confuse the hell out of anyone, to return the units to their previous patrol after no longer having any contacts. Luckily, ArmA has included a new command, setCurrentWaypoint which will alleviate a lot of your troubles!

Here's how I'd do it:

Say you have 4 move waypoints + 1 cycle waypoint. These would, I believe, be numbered 1,2,3,4 and 5 for the cycle. Now place down your S&D waypoint after the cycle, this one should be number 6. Lets assume the group is named "group1" (named by placing group1 = group this in the leader's init field, for instance)

Create a trigger, repeating, with something like "OPFOR detected by BLUFOR", as has been suggested. Now, instead of making it a Switch type and linking it with the Cycle WP to break it, we use the setCurrentWaypoint command instead, while also moving the actual waypoint (as you requested) using setWaypointPosition:

Code: [Select]
On Activation : [group1, 6] setwaypointposition [position (thisList select 0), 0]; group1 setcurrentwaypoint [group 1, 6]; [group1, 6] setwaypointposition [getWpPos [group1, 6], 0]; hint "Enemy detected, attacking."
On DeActivation = group1 setcurrentwaypoint [group 1, 1]; hint "Group resuming patrol!"

Now, the group will skip all their waypoints, including their cycle waypoint, and go towards their S&D wp, which, incidentally, has just been moved. The second "setwaypointposition" is there to address a slight bug I've found sometimes when moving waypoints - they would not be properly updated unless they've been moved "again" - might not be an issue though. In a "OPFOR detected by BLUFOR" trigger, the "thisList" of the trigger will always be a list of detected OPFOR units, which explains the placement. Now - I have not done too much research into the On Deactivation field of triggers, but generally they come into effect when the condition that started the trigger is no longer true - in this case that there are no more OPFOR detected by BLUFOR. Upon which the current waypoint of the group will be reset to within the loop cycle (waypoint 1), which will cause them to continue to patrol within it...until the repeated "OPFOR detected" trigger starts up again, that is!

I haven't got ArmA access here, so I can't test this, and if it doesn't work with the On Deactivation, you can always try with several triggers, global variables, and other funstuff. :)

Good luck!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline GomerPyle

  • Members
  • *
  • OFPEC rocks.....
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #8 on: 12 Jun 2008, 15:39:12 »
Ok this was tested and worked with the setup you suggested with 4 waypoint+cycle+seekanddestroy. Well atleast at some point. When enemy is sighted the text enemy spottet, attacking comes on the screen. They kill the enemy and "enemy killed, normal patrol" comes as text next. So the trigger is activated and deactivated. But looking on units through my scope it seems they do not go back to normal waypoints. Well some of them do. Maybe 4 soldiers go back on patrol. and 2-3 stay on combat alert.

I also had another group with about 10 waypoints. This group also worked well. Atleast until they should go back on patrol. They all went prone and crawled around during patrol. lolol.

Any suggestions? Since the activation and deactivation bit seems to be working i got no idea. It seems stange that some units go on patrol and some stay on alert.

The seek and destroy waypoint i have tried both normal and using a 200 placement radius on. This resulting in my soldiers running off into the sunset looking for enemies. And since they didnt went back on patrol they stayed there.
« Last Edit: 12 Jun 2008, 21:13:50 by GomerPyle »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Units patrol until opfor detected -> Search and Destroy?
« Reply #9 on: 12 Jun 2008, 22:49:52 »
Yay, it works! Good stuff.

As to problems in getting them back on patrol: have you tried messing with the Behaviours? Leaving it at "No Change" means just that - they might still stay in whatever mode you left them at from the S&D waypoints (such as "Danger", also known as "Combat"). Just change the behaviour in ALL the patrol waypoints to whatever you want it to be - for instance "safe" - and they should return to safe mode once they continue patrolling.

Otherwise, it might just be the ArmA AI being a little bitch - such as for instance the group leader ordering a couple of his guys to attack enemies that no longer exist, or people stuck in engage mode, or...or...gah. Anyway, can't really explain it. Suggest you make the waypoints inside the patrol radius as harmless as possible - Safe behaviour and Yellow combat mode, for instance (Open fire, do not engage at will).

But yay, it works. :D

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"