Jump to content

Recommended Posts

Hello, I have seen numerous post about this issue, but can't seem to find a solution that actually works. So here is my problem.

I have a classic sector game which I play alone or with a friend, against or with each other. Each side (Bluefor and Opfor) have a squad a player can take over and control. Rest of the forces come from an AI spawn module. It all works perfectly except all the ai's spawned from the modules doesn't bleed any tickets on both sides when they are killed in action. 

It is only players and ai squad members that I know how to use bleed tickets with. But the Ai's from the module does not work, so it is sort of unbalanced. Please do anyone knows how to bleed tickets form ai spawn module? 

Script I use for the ai squad mebmers in unit init:

this addEventHandler ["killed",{[_this select 0,-1,true] call bis_fnc_respawnTickets;}];

  • Like 1

Share this post


Link to post
Share on other sites

Your script is placed in init field of the unit(s). It's weird because you run the script on each client, so I guess you're bleeding tickets along with the number of clients (players). Furthermore, all new spawned units are not taken into account.

 

Change for:

 

if (isServer) then {
  addMissionEventHandler ["entityKilled", {
    if ((_this select 0) isKindOf "CAManBase") then {
      [_this select 0,-1,true] call bis_fnc_respawnTickets;
    }
  }];
};

 

This MEH will check for any entities, even recently spawned. If you need to exclude some of them, add some conditions.

It must be run once, the bis_fnc_respawnTickets is Effect Global.

So add it in init.sqf or in a trigger set to true, or in a game logic...

 

 

Share this post


Link to post
Share on other sites

Thanks! I also found a solution similar that works very well too! It is actually very simple,  Kylania and Pognivet on another BIS forum found a similar solution. So in the expression field of the Spawn AI module you write this command:

{_x addEventHandler ["killed",{[_this select 0,-1,true] call bis_fnc_respawnTickets;}];} foreach units (_this select 0)

Share this post


Link to post
Share on other sites
24 minutes ago, Rasmus Geertsen said:

Thanks! I also found a solution similar that works very well too! It is actually very simple,  Kylania and Pognivet on another BIS forum found a similar solution. So in the expression field of the Spawn AI module you write this command:

{_x addEventHandler ["killed",{[_this select 0,-1,true] call bis_fnc_respawnTickets;}];} foreach units (_this select 0)

 

As you want. Two solutions are better than one.

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

×