IPB


Welcome Guest ( Log In | Register )

 Forum Rules ArmedAssault.info Forum Rules
 
Reply to this topicStart new topic
> Other groups see what my group see, HOW?
Dmurskain
post Sep 15 2009, 14:44
Post #1


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Hello!

How can i make my side's every group to see in the map what my soldier see? If one soldier see an enemy, in any group, my whole army see that enemy on map. Is it possible?

This post has been edited by Dmurskain: Sep 15 2009, 14:45
 
Quote Post
Rellikki
post Sep 15 2009, 18:01
Post #2



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



You should use General Barron's AI info share scripts. Read the descriptions carefully on how to use it:

CODE
;===============================================================================
==
;===============================================================================
==
;infoShare.sqs
;by General Barron
;aw_barron@hotmail.com
;12/20/03

;This script makes friendly units that are near each other share information on enemy locations (i.e. they reveal the enemies to each other).
;It prevents the common problem of one group shooting at some enemies while another group 5 meters away dumbly faces the other direction,
;doing nothing. With this script, the other group would turn around and also shoot at the enemy.

; To use the script, put the script and the function "knownEnemies.sqf" in your mission folder. Put this line in your init.sqs:
;      knownUnits = compile (preprocessFileLineNumbers "knownUnits.sqf");

; To call the script:
;      [unit, [array of friends], [array of enemies] ] exec "infoShare.sqs"

;Unit = leader of the group to be sharing the information. If the unit is not the leader of his group, the script will exit.
;[array of friends] = an array of units that the group will reveal the enemies to.
;[array of enemies] = an array of units that will be considered the enemy, and revealed to the friendly units

; The easiest way to call the script:
;Make a trigger, covering the entire mission area. Activation = once, "west present". In the "on activation" field, put: "west_units = thisList"
;Make another trigger, same as above only for east. (activation = once, "east present", on activation = "east_units = thisList")
;In init.sqs, put the following lines:
;      knownEnemies = preprocessFile "knownEnemies.sqf"
;      {[_x, west_units, east_units] exec "infoShare.sqs"} foreach west_units
;      {[_x, east_units, west_units] exec "infoShare.sqs"} foreach east_units

;This will make all the west units share information with each other on all the east units, and vice versa.
;The script will run on each group until all the units in that group are killed.
;===============================================================================
==
;===============================================================================
==


_unit = _this select 0
_friends = _this select 1
_enemies = _this select 2

_maxRange = 50
    ;//Maximum distance (in meters) units can be from each other and still share enemy locations
    ;//If you want all units to share information, regardless of distance, set this to 9999
_delay = 5
    ;//Delay (in seconds) between loops. E.g. a delay of 5 means the groups will share info every 5 seconds.
    ;//Lower values mean shorter delays, but can slightly increase lag with large numbers of units.

?_unit != leader group _unit : exit
_group = group _unit
~random _delay

#Loop
_knownEnemies = [leader _group, _enemies] call knownUnits
_i = 0
   #InnerLoop
     _unit = _friends select _i
     if ({(_unit distance _x) <= _maxRange} count (units _group) > 0) then { {_unit reveal _x} foreach _knownEnemies}
     _i = _i + 1
  ? _i < count _friends : goto "InnerLoop"
~_delay
?count units _group > 0 : goto "Loop"
exit


CODE
/*knownUnits.sqf
By General Barron
aw_barron@hotmail.com
11/15/03

This returns a list of units detected by the passed unit. List is sorted in order of closest to farthest. To call:
[detector, [units to detect from]] call knownUnits

Usage example: make a trigger, covering entire map, activation = once, "east present". On activation = "east_units = thisList"
Make another trigger. Condition = "count ([player, east_units] call knownUnits) > 0". On activation = "hint "enemy spotted" "
The hint will appear once the player detects one or more east units.
*/

private ["_unit", "_list", "_return", "_numArray","_j","_k","_tempVal","_tempNum","_element"];

_unit = _this select 0;
_list = _this select 1;
_return = [];

{if ((_unit knowsabout _x) > 0.105) then {_return = _return + [_x]}} foreach _list;

/*-----------------------------------------------------------------------------------
Start bubble sort (sort units from closest to farthest)
Code taken from sortBubble.sqf
By bn880 2/24/2003
(slightly modified to fit in this function)
-----------------------------------------------------------------------------------*/

_count = count _return;
_numArray = [];
_numArray resize _count;

// ACQUIRE NUMERIC VALUES FROM EVALUATION
_j = 0;
while {_j < _count} do
{
    _element = _return select _j;
    _numArray set [_j,_element distance _unit];
    _j = _j + 1;
};

_j = 0;
// SORT
while {_j < _count -1} do
{
    _k = _j + 1;
    while {_k < _count} do
    {
        if (_numArray select _j > _numArray select _k) then
        {
            _tempNum = _numArray select _j;
            _numArray set [_j,(_numArray select _k)];
            _numArray set [_k,_tempNum];
            
            _tempVal = _return select _j;
            _return set [_j,(_return select _k)];
            _return set [_k,_tempVal];
        };
        _k = _k + 1;
    };
    _j = _j + 1;
};

_return


You also need to put this in the init.sqs:

CODE
knownEnemies = preprocessFile "knownEnemies.sqf"
 
Quote Post
Dmurskain
post Sep 15 2009, 18:53
Post #3


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Thanks! Ill try it! smile.gif
 
Quote Post
Dmurskain
post Sep 17 2009, 17:53
Post #4


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



I couldn't find "knownEnemies.sqf" anywhere... Plz help!
 
Quote Post
Rellikki
post Sep 17 2009, 20:00
Post #5



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



Hmm, change the knownEnemies into knownUnits on the command, or vice versa: Rename the script from knownUnits.sqf to knownEnemies.sqf.
 
Quote Post
Dmurskain
post Sep 18 2009, 15:01
Post #6


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



I tried that and doesn't work. sad.gif Could it be that knownEnemies and knownUnits ain't the same thing... Maby I need the knownEnemies.sqf
 
Quote Post
Rellikki
post Sep 18 2009, 15:16
Post #7



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



No, they're definately the same thing. I can remember using these scripts in the past and recalled the wrong naming in the scripts as you reported it. You must be doing something wrong. Double check that everything's named correctly.
 
Quote Post
Dmurskain
post Sep 20 2009, 15:49
Post #8


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Ok, I triple checked everything, and still can't get it work. Here is what i did:

Init.sqs
CODE
knownEnemies = preprocessFile "knownEnemies.sqf"
{[_x, resistance_units, east_units] exec "infoShare.sqs"} foreach resistance_units
{[_x, east_units, resistance_units] exec "infoShare.sqs"} foreach east_units


knownEnemies.sqf
CODE
private ["_unit", "_list", "_return", "_numArray","_j","_k","_tempVal","_tempNum","_element"];

_unit = _this select 0;
_list = _this select 1;
_return = [];

{if ((_unit knowsabout _x) > 0.105) then {_return = _return + [_x]}} foreach _list;

/*-----------------------------------------------------------------------------------
Start bubble sort (sort units from closest to farthest)
Code taken from sortBubble.sqf
By bn880 2/24/2003
(slightly modified to fit in this function)
-----------------------------------------------------------------------------------*/

_count = count _return;
_numArray = [];
_numArray resize _count;

// ACQUIRE NUMERIC VALUES FROM EVALUATION
_j = 0;
while {_j < _count} do
{
_element = _return select _j;
_numArray set [_j,_element distance _unit];
_j = _j + 1;
};

_j = 0;
// SORT
while {_j < _count -1} do
{
_k = _j + 1;
while {_k < _count} do
{
if (_numArray select _j > _numArray select _k) then
{
_tempNum = _numArray select _j;
_numArray set [_j,(_numArray select _k)];
_numArray set [_k,_tempNum];

_tempVal = _return select _j;
_return set [_j,(_return select _k)];
_return set [_k,_tempVal];
};
_k = _k + 1;
};
_j = _j + 1;
};

_return


infoshare.sqs
CODE
_unit = _this select 0
_friends = _this select 1
_enemies = _this select 2

_maxRange = 9999
;//Maximum distance (in meters) units can be from each other and still share enemy locations
;//If you want all units to share information, regardless of distance, set this to 9999
_delay = 5
;//Delay (in seconds) between loops. E.g. a delay of 5 means the groups will share info every 5 seconds.
;//Lower values mean shorter delays, but can slightly increase lag with large numbers of units.

?_unit != leader group _unit : exit
_group = group _unit
~random _delay

#Loop
_knownEnemies = [leader _group, _enemies] call knownEnemies
_i = 0
#InnerLoop
_unit = _friends select _i
if ({(_unit distance _x) <= _maxRange} count (units _group) > 0) then { {_unit reveal _x} foreach _knownEnemies}
_i = _i + 1
? _i < count _friends : goto "InnerLoop"
~_delay
?count units _group > 0 : goto "Loop"
exit


Then in editor i made two triggers to cover entire mission area and put activation: opfor once and on act. "east_units = thisList" and activation independent once on act. "resistance_units = thisList"

I just don't get this right, please help!
 
Quote Post
Rellikki
post Sep 20 2009, 15:54
Post #9



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



Perhaps you've named the script files incorrectly, if you really keep getting an error message about missing knownEnemies.sqf. Make sure you didn't name it knowEnemies.sqf.txt, knowEnemies.sqs or something similiar. It's a common problem.
 
Quote Post
Dmurskain
post Sep 20 2009, 17:15
Post #10


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



No error messages, it just doesn't seem to work...
 
Quote Post
Rellikki
post Sep 20 2009, 18:14
Post #11



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



Alright, I now found out what's the problem. The scripts shouldn't be executed in init.sqs, but in a trigger or a script, after the start of the mission. Place a trigger on the map, with condition true and maybe a 1 second delay before it executes. Paste the commands from your init.sqs into the activation field of the trigger. That should do the trick.
 
Quote Post
Dmurskain
post Sep 20 2009, 19:08
Post #12


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Still nothing. I made "lataa.sqs" witch looks like this
CODE
~2
knownEnemies = preprocessFile "knownEnemies.sqf"
~2
{[_x, resistance_units, east_units] exec "infoShare.sqs"} foreach resistance_units
{[_x, east_units, resistance_units] exec "infoShare.sqs"} foreach east_units


It is executed at the begining of mission but i still can't see enemies in map if other group on my side sees it... Damn this is hard sad.gif

This post has been edited by Dmurskain: Sep 20 2009, 19:13
 
Quote Post
Rellikki
post Sep 20 2009, 19:48
Post #13



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



That's not what's supposed to happen. The script will only share info between AI squads. It doesn't work for the player.
 
Quote Post
Dmurskain
post Sep 20 2009, 20:27
Post #14


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Oh ok, sooo is it possible then to do script that works like that? So player can see what AI see, in other group.
 
Quote Post
Dmurskain
post Sep 22 2009, 17:28
Post #15


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Please? unsure.gif
 
Quote Post
Rellikki
post Sep 22 2009, 18:04
Post #16



Group Icon

Group: Addon Maker
Posts: 1,148
Joined: 4-November 06
Member No.: 13



Well, that goes beyond my own knowledge, so you've got to rely on someone else about that.
 
Quote Post
Dmurskain
post Sep 22 2009, 18:25
Post #17


Member
***

Group: Members
Posts: 39
Joined: 17-November 08
From: Finland
Member No.: 4,544



Ok, thanks for your effort! smile.gif
 
Quote Post

Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 16th April 2024 - 21:23