Author Topic: RUG PointSwitch (ACCEPTED)  (Read 1405 times)

0 Members and 1 Guest are viewing this topic.

Offline Wolfrug

  • Addons Depot
  • Administrator
  • *****
  • Official OFPEC Old Timer
RUG PointSwitch (ACCEPTED)
« on: 17 Mar 2008, 00:44:35 »

This is a little random widget I've been fiddling with for a while - and no, as usual, don't expect any new Mando/Spooner-styled wonders here, I've merely stuck together other people's code as best I could. Especially Mandoble's stuff has been in heavy use :D

What is RUG Pointswitch?

Teamswitching in a large group has always been annoying - you want to switch to the guy right in front of you, but instead you switch to whomever is next in the list. Or you pick from a dialog box, but how are you to know which "Rifleman" it is that's straight ahead of you? Well - worry no more, RUG Pointswitch to the rescue. In its simplest form, what PS allows you to do is simply point your gun at anyone who's teamswitchable, and press a key (as defined by yourself), and you teamswitch into them!

However, it does have more features than that - for instance you always teamswitch back to your original PC from the pointswitch, and the pointswitched retains his stance (crouched/prone/standing) and heading, allowing you to set up your AI in positions they'd never go to normally (for instance behind a car wreck, next to some barrels, barely sticking their gun out from behind a wall...). Also, if you're the team leader (which is what PS was designed for), "you" will shut up while you move your AI around so that they don't suddenly start engaging or attacking enemies they're not supposed to.

Caveats: Due to the weirdness of default TS, all the units in the group are stopped whenever a PS happens - otherwise all the units you've ordered as squad leader to their positions using normal move commands will return to formation! Therefore the recommended method of using PS is as follows : order each of your AI to move to their assigned defensive position using normal move orders, and then fine-tune their positions using PS. Alternatively, keep your AI close to your team leader, and simply move them one by one to their locations (you will teamswitch back to the squad leader whenever you click the default teamswitch button). Also, when not squad leader (i.e., pointswitched), he will still send out commands (such as attacking enemies) but he will not order anyone to engage or leave their position.

Also remember when displacing to order your men to "keep low"! Otherwise all who were crouched will remain crouched, all who were prone will crawl etc. If you leave someone standing, they will default to "auto" as well. Finally, mando_getpos (which is used to gauge the units' stance) does not work on roofs etc., so if you want to place a sniper prone on a roof, you will have to order him separately using the command menu to get down.

Finally, this script uses weaponDirection to decide where you're pointing (which is more precise than just using getDir) : currently it doesn't use any "weapon in hand?" scripts to decide if you've got a rifle, pistol or launcher or nothing in hand; it only checks for rifle. So if you're in "safe" mode (rifle pointing down) or using a sidearm or launcher, you will probably be unable to pointswitch (since it aims up in the air). Also, it uses a little remnant from Mando Draw, a small yellow orb that slowly drifts into the air. This shows you the extreme end of the trigger that checks for possible pointswitch candidates, and also tells you that the script fired properly. If it's really annoying, it can be removed in future versions. :)

Use : handle = [size, "anystring", interval] execvm "RUG_PointSwitch.sqf";

size = size (will be /2) of the trigger that checks for possible matches. 1 is a good default.

"anystring" = just an initializing string, can be anything as long as it's a string.

interval = interval in meters for each click of the "plus" and "minus" range adjustment - from 0 to 500. 50 is a good default (note : the script will always pick up the closest unit to your position if it is within the trigger in front of you - with that in mind, you probably won't really have to adjust the range much, but keep it at max/almost max most of the time).

Uses code from mando_getpos and mando_draw ( All thanks to Mandoble for that!

Bug reports etc. go here. Not sure if this is actually going to be useful for anyone, but it was fun making it!
Possible future features : a proper map-resource that shows all teamswitchable units, and allows you to click on any of them for even quicker switching.

Version history:

0.1 beta
- Initial release

Wolfrug out.

« Last Edit: 10 Aug 2009, 21:49:56 by hoz »
"When 900 years YOU reach, look as good you will not!"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: RUG PointSwitch
« Reply #1 on: 20 Mar 2008, 10:43:28 »
So far this seems to work, will you still keep it as 0.1 beta? Any immediate improvements planned?