Jump to content
sizraide

Make AI shoot at player if wearing a specific item.

Recommended Posts

Hello, im fairly new to scripting and only got basic knowledge. So, if you're gonna explain it to me please dumb it down for me.

 

I want a script where BLUFOR will shoot the player if the player is wearing something specific.

For example, I want to create a list where BLUFOR will shoot the player if the player is wearing Takistan uniform, pilot helmet, or alice pack.

 

Any ideas?
 

Share this post


Link to post
Share on other sites

Your player is BLUFOR?
You can add in init field of the player:
0 = this spawn {
    waitUntil {uniform _this in  ["UniformClass1Here","UniformClass2Here",...] or headGear _this in ["helmetClass1Here","helmetClass1Here",..] or backPack _this in ["backpackClass1Here","backpackClass1Here",...]};
   player addRating (rating player - 3000);

};

 

That's a basic solution for non-detailed question.

the classes are to be existent in your game, and they are case sensitive here.

  
 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Your player is BLUFOR?
You can add in init field of the player:
0 = this spawn {
    waitUntil {uniform _this in  ["UniformClass1Here","UniformClass2Here",...] or headGear _this in ["helmetClass1Here","helmetClass1Here",..] or backPack _this in ["backpackClass1Here","backpackClass1Here",...]};
   player addRating (rating player - 3000);

};

 

That's a basic solution for non-detailed question.

the classes are to be existent in your game, and they are case sensitive here.

  
 


Yes, my players are BLUFOR, basically I have a mission where they went through an OPFOR base wearing OPFOR uniform.

And I want them to take it off before meeting their BLUEFOR AI squad so they won't get shot. 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

Your player is BLUFOR?
You can add in init field of the player:
0 = this spawn {
    waitUntil {uniform _this in  ["UniformClass1Here","UniformClass2Here",...] or headGear _this in ["helmetClass1Here","helmetClass1Here",..] or backPack _this in ["backpackClass1Here","backpackClass1Here",...]};
   player addRating (rating player - 3000);

};

 

That's a basic solution for non-detailed question.

the classes are to be existent in your game, and they are case sensitive here.

  
 



So this works, but the BLUFOR AI shoots me regardless of what I wear now, even if i'm not wearing anything.

Share this post


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

What is your code?

Quote

0 = this spawn { 
    waitUntil {uniform _this in  ["CUP_U_O_TK_Green"] or headGear _this in ["CUP_H_TK_Helmet"] or backPack _this in ["CUP_B_CivPack_WDL"]}; 
   player addRating (rating player - 3000); 
 
};


Here it is, it's in the player Init.

Share this post


Link to post
Share on other sites

So, if you don't wear anything or that, the player is not renegade. Once he grabs this kind of gear, he is the public enemy number one. (If you're wearing one or more of these gears, you are renegade and any unit will shoot at you).

 

As said, that's a solution for your demand. If you want more, you should elaborate:

"I'm scripting for a single player scenario,... my player is blufor... I'd like to make him shot by.... when....  reversible or not..."

Share this post


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

So, if you don't wear anything or that, the player is not renegade. Once he grabs this kind of gear, he is the public enemy number one. (If you're wearing one or more of these gears, you are renegade and any unit will shoot at you).

 

As said, that's a solution for your demand. If you want more, you should elaborate:

"I'm scripting for a single player scenario,... my player is blufor... I'd like to make him shot by.... when....  reversible or not..."


Okay, sorry about that ill clarify more clearer.

Im scripting for a COOP mission.

Basically, I have a script already that makes OPFOR not attack the player when they're wearing Takistan uniform (Takistan are the OPFOR)
The task I set for the players is that they're going through a heavily hostile area filled with OPFOR AI and they must meet their squad at the end.

I want the players to actually get shot when they encounter any BLUFOR AI wearing the Takistan uniform to make it seem like the the AI mistaken the players for being OPFOR when they're not.

Share this post


Link to post
Share on other sites

One sure thing, players can shot when they want, who they want, but AIs have the same logic: another unit is enemy or not, depending on the sides.

 

After that, it's up to you for the switch to another side. anyway, you'll lost the group. Renegade is solo. That's the way I wrote. If you want to regroup in initial group, you'll need extra lines.

 

For now, in initPlayerLocal.sqf
 

0 = this spawn {
  while {true} do {
    waitUntil {sleep 1; uniform _this in  ["CUP_U_O_TK_Green"] or headGear _this in ["CUP_H_TK_Helmet"] or backPack _this in ["CUP_B_CivPack_WDL"]}; 
    player addRating (rating player - 3000);
    waitUntil {sleep 1; !(uniform _this in  ["CUP_U_O_TK_Green"] or headGear _this in ["CUP_H_TK_Helmet"] or backPack _this in ["CUP_B_CivPack_WDL"])};
    player addRating 0;
  };
};

 

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

×