Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: no
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-09-29 14:01        
     
Hi.

Working on a MP suicide mission where the bomber is the target for the mission.
I want the mission to end fail if the bomber is able to blow himself up.
And i want the mission to end #1 if the bomber is killed before he is able to detonate.

I cant make it work with triggers.
Does anyone have an ide of how to make this work?


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#2 Posted at 2016-10-01 22:22        
     
You could try by an event handler in the init.sqf file:

say kamikaze is the unit's name:
if (isServer) then {
  kamikaze addEventHandler ["killed", {
    params ["_victim","_killer"];
    if (_killer == _victim) then {
     "LOSER" call bis_fnc_EndMission
    } else {
     "END1" call bis_fnc_endMission
    }
  }]
};
NB : this also trigger a mission failed if the unit kills himself in a car accident... Caution!

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Advertisement


Author Message


Posts: 3
Rank:


Level: Member

Country: no
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-10-02 15:11        
     
Awesome. Will try it later.
I really hope it workes..

Added 4 hours 41 minutes later:

the missions succeded meesage works if i kill him, but if he explodes. the mission is also succeded.
Know why?

This post was edited by silwee (2016-10-02 19:53, 683 days ago)


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#4 Posted at 2016-10-03 05:31        
     
Perhaps the way the unit detonate the bomb. If there is no "killer", I mean no unit assumed to kill himself here, the condition _killer == _victim has no sense.
So, you have to identify what the code is returning as "killer". If any or null, as I guess, you must find another way.

Try this new code with 2 changes:
- note what is hint when kamikaze is killed;
- If kamikaze is an AI and if killed by a player is an acceptable alternative for success, this should work.

   if (isServer) then {
      kamikaze addEventHandler ["killed", {
        params ["_victim","_killer"];

        (format [" victim: %1 killer: %2", _victim,_killer]) remoteExec ["hint"];

        if (isPlayer _killer) then {
         "END1" call bis_fnc_EndMission
        } else {
         "LOSER" call bis_fnc_endMission
        }
      }]
    };

This post was edited by Pierre MGI (2016-10-05 09:08, 680 days ago)

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS

Author Message


Posts: 3
Rank:


Level: Member

Country: no
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2016-10-03 19:09        
     
sorry, but still dosen't work. Now i got an error in line 5. but im really noob programmer so have no clue whats actually wrong.
Either way I kill him or he blow himself up the error appers. No mission ending.


Author Message


Posts: 1589
Rank:


Level: Member

Country: pf
Location: Tahiti
Occupation: too many Arma
Age: 58
In-game name: Kobayashi Maru

 
#6 Posted at 2016-10-03 23:04        
     
Sorry my bad i forgot the square braces. Read ...remoteExec ["hint"] instead of ...remoteExec "hint" .

PLEASE CONTACT ME ON BI FORUMS FOR ANY SCRIPT / MOD QUESTION. TKS