Home   Help Search Login Register  

Author Topic: Old script  (Read 1326 times)

0 Members and 1 Guest are viewing this topic.

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Old script
« on: 27 Feb 2009, 02:12:57 »
I want to ask a question regarding the following script but the thread has been locked.

http://www.ofpec.com/forum/index.php?topic=30279.0

In the thread mandoble says "in your infobase add:"
What does he mean by that? I can't find any more occurences of infobase anywhere.

The main point of my search was to see if I could get the script working.
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 Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Old script
« Reply #1 on: 27 Feb 2009, 03:58:18 »
The info base is most probably part of General Barron's AI Info Share.

I think Mandoble was referreing to the fact that knownUnits was called before it was assigned any compiled code.
try { return true; } finally { return false; }

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Old script
« Reply #2 on: 27 Feb 2009, 10:29:12 »
If you want info-sharing, you can do it "better" with some new ArmA commands. Here's a script I made for this purpose using the nearTargets command:

Code: [Select]
//Script that allows for full info-sharing between two groups - essentially making sure both have the same information about targets available at all time. Uses the nearTargets command to parse out all viable units and then simply reveals them. By Wolfrug @OFPEC.

//Called: [group1, group2, distance] execvm "shareinfo.sqf"; distance = how far out the search goes in meters (i.e., 1000, 500...)
_grp1 = _this select 0;
_grp2 = _this select 1;
_distance = _this select 2;

//Interval between rounds of revealing in seconds.
_waitTime = 5;

//Predetermined empty arrays which will be filled by targets units to be revealed
_ViableTargets = [];
_AllTargets = [];

while {{alive _x} count units _grp1 > 0 && {alive _x} count units _grp2 > 0} do
{

//Grabs ALL the available targets and adds them to an array

_AllTargets = _AllTargets + (vehicle leader _grp1 nearTargets _distance);
_AllTargets = _AllTargets + (vehicle leader _grp2 nearTargets _distance);

//Parses enemy targets from the list (by checking if their subjective cost is positive)

for "_i" from 0 to ((count _AllTargets) - 1) do
{
_SubjectiveCost = (_AllTargets select _i) select 3;
_Unit = (_AllTargets select _i) select 4;

if (_SubjectiveCost > 0) then {_ViableTargets = _ViableTargets + [_unit]};

//hint format ["Revealed: %1", _viableTargets];

};

//Reveals all viable targets to both group leaders.

{vehicle leader _grp1 reveal _x} forEach _ViableTargets;
{vehicle leader _grp2 reveal _x} forEach _ViableTargets;

//Sleeps, then allows the script to continue looping.

sleep _waitTime;
_AllTargets = [];
_ViableTargets = [];
};

// All units in one or both groups are dead. Oh well.

It's very simple, basically just there to parse out enemy targets from the array nearTargets provides (since nearTargets provides a list of ALL units, rather than just "targets", oddly enough). The only thing you might want to change is to check if the knowsAbout is high enough for the leader of either group to recognize the target as an enemy, but since I made this script to interact between a helicopter and a ground-based group, I wanted it to be effective ;)

As to using it for more groups...maybe you can have one "central" hub group that all the other groups have as their second group - since the info-sharing is two-sided, that should assure all information is spread among al groups through the hub.

Didn't check out the older scripts THAT much, so this might just be a crude and unnecessary version of what you wanted. Sorry in that case!

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

Offline The-Architect

  • Former Staff
  • ****
  • Bite my shiny metal...
    • Bob's Un-official Flashpoint Page
Re: Old script
« Reply #3 on: 27 Feb 2009, 11:30:40 »
Cool. I want it for helicopters too.

Code: [Select]
[pagan, cobgrp, 10000] execvm "shareinfo.sqf"
When I call this through a trigger I get a "type script expected nothing error". Same as when I call it from a unit's init.
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 Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Old script
« Reply #4 on: 27 Feb 2009, 11:32:46 »
Remember that when calling it from a trigger/in-editor on activation place, you need to give it a handle:

nul = [pagan, cobgrp, 10000] execvm "shareinfo.sqf";

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