Jump to content

Recommended Posts

So, here is the problem, im editing a mission on Arma 3 (EXILE) editor and faced this problem.

i spawned on the editor some aircraft carriers, and destroyers with its guns well placed around the map to shoot players that go to far in te map down. So i spawned some centurions, praetorians and stuff like that with its crews. I want this to shoot anybody that comes close to the ship, but i want them to ignore the admins and, if its possible, anyone that is on their group.

is there any way for me to make the bots ignore some players by the UID, and even better, ignore all players on the group of this specific UID? 

I searched a lot before get here, because i don't wanna bother. but the closest that i got is  using the comand "forgetTarget" on the unit init. But with this i need to force the admins to use a specific playable slot when loggin in and don't allow anyone with other UID to join on these slots. 
which i don't know how to do as well.

if you guys can help me solving this problem in any of the 2 ways, i will thank you for ever. =D

Share this post


Link to post
Share on other sites
13 hours ago, Grumpy Old Man said:

Did you try setCaptive?

 

Cheers

In setCaptive i would have the same problems that i have with forgetTarget. Since it is a mpMission for me to set a player to captive i need a way to force this specific player (in this case the adms) to a specific playable unit that only the adms will be allowed to use. And i don't know how to do this.

btw, setCaptive will make all AI of the map ignore this players, i want to make just a specific group of AI, that has a fixed spawn at the mission (does not spawn dynamically). 

Just a reminder that im editing the mission.sqm of EXILE Mod. So bots of the missions like DMS and A3XAI should engage normally.
 

is there any way to make bots ignore players with specific UID? or something like that?

Share this post


Link to post
Share on other sites

Of course a simple command won't fix it, how you implement it is up to you.

You can always run a loop on the server that checks if a certain player (filtered by UID or what seems to fit) is in the target list or at a certain distance, then use setCaptive and forgetTarget in that specific order.

 

Cheers

Share this post


Link to post
Share on other sites
6 hours ago, Grumpy Old Man said:

Of course a simple command won't fix it, how you implement it is up to you.

You can always run a loop on the server that checks if a certain player (filtered by UID or what seems to fit) is in the target list or at a certain distance, then use setCaptive and forgetTarget in that specific order.

 

Cheers

So, do you have a exemple of this loop to check uid? 

btw i think that i was really tired when i read the description of forgetTarget. Because it only make the AI "forget" all information of its target... which wont help me in any case here i think, LOL.

but i was trying to initialize this AI that spawn with the mission, with some kind of command like _this donotMessWith [player uid]. but i dont know if even exists some command like this :/

or make run the loop you said and set this units friendly  to this AIs.

 

it seems that exile players spawn as independent (dont know if this can help)

i dont know if im been clear or if my english is too bad, but thanks for trying to help me xD

Share this post


Link to post
Share on other sites

Something like:

 

["doNotMess","onEachFrame", {
    {

       if (player in (_x targets [true,300]) && getPlayerUID player in [<some UIDs here>] ) then {

         _x forgetTarget player

       };

       nil

    } count units thisEnyGroup
}] call bis_fnc_addStackedEventHandler

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, pierremgi said:

Something like:

 

["doNotMess","onEachFrame", {
    {

       if (player in (_x targets [true,300]) && getPlayerUID player in [<some UIDs here>] ) then {

         _x forgetTarget player

       };

       nil

    } count units thisEnyGroup
}] call bis_fnc_addStackedEventHandler

 

 

ok, if im not asking too much, can you please explain a bit of this code?  like

1 - what does "onEachFrame" make? run this function on each frame of the animations??
2 - (_x targets [true,300]). what is this doing? what "true" and "300" stands for? meters?
3 - uids should be like this player in [123456789, 987654321, 654987321] or like player in ['321654987', '123456789', '654987321']?

4 - count units thisEnyGroup is counting AI group or player group?
5 - call bis_fnc_addStackedEventHandler, i assume that is only a thing to get this on the execution queue or something like this, right?
6 - if this should not be on the Unit initialization, what on this code makes it apply only to the right units, and not for ALL AI of the map?
7 - where should i put this? on the AI initialization or on the mission.sqm or in the init.sqf? 

thanks for your help 
 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/BIS_fnc_addStackedEventHandler

From BIKI:

https://community.bistudio.com/wiki/targets

 

UIDs: ["321654987","'123456789","'654987321"];

waiting for  string(s) of number, so in an array here.

 

count units thisEnyGroup, is just another way to write forEach units thisEnyGroup, under some conditions. Don't bother with that. Here thisEnyGroup is the group who you don't want to react under player's presence. What else?

 

Run the code in init.sqf or initPlayerLocal.sqf (better, as player must be defined).

 

Share this post


Link to post
Share on other sites
4 hours ago, pierremgi said:

https://community.bistudio.com/wiki/BIS_fnc_addStackedEventHandler

From BIKI:

https://community.bistudio.com/wiki/targets

 

UIDs: ["321654987","'123456789","'654987321"];

waiting for  string(s) of number, so in an array here.

 

count units thisEnyGroup, is just another way to write forEach units thisEnyGroup, under some conditions. Don't bother with that. Here thisEnyGroup is the group who you don't want to react under player's presence. What else?

 

Run the code in init.sqf or initPlayerLocal.sqf (better, as player must be defined).

 

ok, here it is...
with your help i made some progress, but still not working as it should. i made this:

in the general settings of the editor, in the init option(i imagine that this is the init.sqf) i inserted this:

airDefences = createGroup east;
[centurion01,centurion02, praetorian01, praetorian02, praetorian03, spartan01, spartan02] join airDefences;

this creates a group of opfor (since i cant spawn those guns with opfor crew). 
this part i know its working because the AI exploded the hell out me.

and in the init of my soldier (i assume this is the initPlayerLocal.sqf), this: (on the game i inserted the right UIDs)

["doNotMess","onEachFrame", { 
    {  
		if (player in (airDefences targets [true,300]) && getPlayerUID player in ["321654987","321654987"] ) then {
			airDefences forgetTarget player
       }; 
       nil  
    } count units thisEnyGroup 
}] call bis_fnc_addStackedEventHandler


and this should make me, part of their group, as long as my UID is there, but the AI still shoot the hell out of me the same way.

i also tried this:

 

["doNotMess","onEachFrame", { 
    {  
        if (player in (airDefences targets [true,300]) && getPlayerUID player in ["321654987","987654321"] ) then {
            player join airDefences; 
       }; 
       nil  
    } count units thisEnyGroup 
}] call bis_fnc_addStackedEventHandler

and also tried to replace "player" for "_this" and to insert this on the init.sqf

any idea what is wrong?

  • Haha 1

Share this post


Link to post
Share on other sites

Here thisEnyGroup was an example!

 

To make it right, as a good habit:

in initServer.sqf // create this file, if not yet in your mission folder (where mission.sqm is). This will run on server only. Useless to run it everywhere.

 

airDefences = createGroup east;

[centurion01,centurion02, praetorian01, praetorian02, praetorian03, spartan01, spartan02] joinSilent airDefences;

 

In initPlayerLocal.sqf // create it also, if not yet in your mission folder:

 

["doNotMess","onEachFrame", { 

        if (player in (airDefences targets [true,300]) && getPlayerUID player in ["321654987","987654321"] ) then {

            airDefences forgetTarget player

       }; 

}] call bis_fnc_addStackedEventHandler;

 

 

I don't know where forgetTarget must run exactly (no indication about that on BIKI but the command is recent, so probably MP compliant. If some trouble, we will have to run this in init.sqf.

 

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, pierremgi said:

Here thisEnyGroup was an example!

 

To make it right, as a good habit:

in initServer.sqf // create this file, if not yet in your mission folder (where mission.sqm is). This will run on server only. Useless to run it everywhere.

 

airDefences = createGroup east;

[centurion01,centurion02, praetorian01, praetorian02, praetorian03, spartan01, spartan02] joinSilent airDefences;

 

In initPlayerLocal.sqf // create it also, if not yet in your mission folder:

 

["doNotMess","onEachFrame", { 

        if (player in (airDefences targets [true,300]) && getPlayerUID player in ["321654987","987654321"] ) then {

            airDefences forgetTarget player

       }; 

}] call bis_fnc_addStackedEventHandler;

 

 

I don't know where forgetTarget must run exactly (no indication about that on BIKI but the command is recent, so probably MP compliant. If some trouble, we will have to run this in init.sqf.

 

Hello, i was trying right now some stuff and i discover a new command that maybe can help:
West setFriend [Independent, 0];

i think that forgetTarget is not the right command. here is its description:
Resets the info a group has about a target, forcing knowsAbout value to 0.
https://community.bistudio.com/wiki/forgetTarget

ill try to make what you said.
if i just crate the initServer.sqf in the same folder as the mission it will run automatically? there is no need to include it anywhere?

Share this post


Link to post
Share on other sites

Yes, you should start with I wrote.

Yes some sqf are automatic. They are event scripts. see also initialization order (automatic doesn't mean in any order).

Your setFriend command is for entire side relationship!

Share this post


Link to post
Share on other sites
5 hours ago, RNM-SpaceGhost said:

} count units thisEnyGroup 

 

Hello there RNM-SpaceGhost !

 

# I pushed a Haha above !  :torture::rofl:

 

For any codes or anything that you might see and you are not sure about , you can just make a seach on google and ( if it is something not like #thisEnyGroup Pieere's example !) then you can find it and check also the information and how to use this generally.

 

ex : arma 3 group

https://community.bistudio.com/wiki/group

 

Pierre is helping you , for stuff that you could just make a search and read some basic coding.

I would suggest you if you want to learn , start reading from the basic! :f:

https://community.bistudio.com/wiki/SQF_syntax

 

Welcome also to Bis Forums !

  • Like 1

Share this post


Link to post
Share on other sites

so guys sorry for the delay. I was  a bit buzy last days... so, with @pierremgi help i made progress, and came out with some code that worked. buy the way, its very possible that the first code that you sent me was working. but one thing that i did not know is that getPlayerUID, on single player returns _SP_PLAYER_, and not the UID of the player. So thats probably the reason, it did not work. i was creating this for a ARMA 3 EXILE Server, but since i was testing on ARMA 3 Editor, the only option you have is to play on single player. 

once i tested my code with "_SP_PLAYER_" in admins UID array it worked perfectly. So, here is the code that i created with Pierre's help 
included this at the very end of intServer.sqf:

//creates a group for all static AAs in EXILE it has to be "east" so the units join OPFOR becoming enemies with players
airDefences = createGroup east;
//inserted on this array all variable names set on editor for each unit created on Editor and make them join the created Opfor group
[centurion01,centurion02, praetorian01, praetorian02, praetorian03, spartan01, spartan02] joinSilent airDefences;

 

and in the very end of initPlayerLocal.sqf:

//array with all ADM UIDs that you want
_admArray = ["123456789","987654321"];
_uid = getPlayerUID player;
//verify if player is ADM
if (_uid in _admArray ) then {
  		//cool msg just to tell player that he is alowed to go to the area where AI is
		titleText ["<t color='#ff0000' size='2'>Air defences, Reporting in!</t>", "PLAIN", 1, true, true];
  		//makes player join the same group that the AI is. 
		[player] joinSilent airDefences;
	}; 

 

it worked fine for me. but if you guys get any suggestions to make the code better i would appreciate =D

@GEORGE FLOROS GR, i have to agree with you that im new with this, i've already created about 8 severs of ARMA 2 dayz and ARMA 3 EXILE, but in terms of coding, im starting now. Im a php dev, but im not familiar with sqf language and for sure ill read the documentation that you sent me to get better in this and stop making "dumb questions" LOL. but is nice to have people that answer this questions for me to have a start point in what, and where should i look and study. At least for me, i need a objective to start studding, like just read the documentation would not help me if im not trying to code anything.
And thanks for the welcome =D

but seriously, thanks for you guys time and attention, without people to help me start i would need alot of time just to make this simple codes. 

my next step will be create a infiSTAR custom function to add and remove players on the airDefence group =D. But maybe this isnt the right place to discuss this, as long it has to do with infiSTAR...

but i really would like to understand better the code that @pierremgi made: 

["doNotMess","onEachFrame", { 

        if (player in (airDefences targets [true,300]) && getPlayerUID player in ["321654987","987654321"] ) then {

            airDefences forgetTarget player

       }; 

}] call bis_fnc_addStackedEventHandler;

"doNotMess", i think is the function name.
"onEachFrame", i dont have a clue for what it does
and in the very end:
"call bis_fnc_addStackedEventHandler" what this does?

anyway, thank all of you guys that commented and tried to help =D you are the best!!!!!!

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, RNM-SpaceGhost said:

"doNotMess", i think is the function name.
"onEachFrame", i dont have a clue for what it does
and in the very end:
"call bis_fnc_addStackedEventHandler" what this does?

anyway, thank all of you guys that commented and tried to help =D you are the best!!!!!!

 

Thanks also RNM-SpaceGhost and no question is ever "dump" ! :f:

 

So as i was saying about searching and reading - and just to now i'm also an amateur and not by any profession scripter - ,

you can just copy past them , for example like :

 

onEachFrame arma 3

and this is the result :

https://www.google.com/search?client=firefox-b-ab&ei=2MtMXOStIKvikgWixLSICg&q=onEachFrame+arma+3+&oq=onEachFrame+arma+3+&gs_l=psy-ab.3..0i13i30.84139.94393..95590...0.0..0.134.1090.0j9......0....2j1..gws-wiz.......0i71j0i22i10i30j0i22i30.fBan3aBcCzg

 

I also didn't know when i started that there is everything available with codes and examples ready to use.

 

Happy scriting then !

Share this post


Link to post
Share on other sites
11 minutes ago, RNM-SpaceGhost said:

the only option you have is to play on single player

For proper mission testing environment you can use TADST to set up a local dedicated server to prevent any future surprises.

Once set up it's as easy as exporting your edited mission, start the dedi and launch another client to join it.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

If you like click to follow me , in order to see the posts and i actually do post a lot !

I would advise to do the same with the other members as off course Pierre & Grumpy Old Man , in order to start reading codes !

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×