Jump to content
Sign in to follow this  
cychou

Adding scoring and message when player destroy an opposite team mhq vehicle.

Recommended Posts

Hello, i would need help to add extra scoring system for Domination mission (two teams) :

basically i would like to add score points to a player who succeed to destroy MHQ of the opposite team.

for example:

if a Blufor player (X) destroy a Opfor MHQ (BTR90_HQ) he gets several points (Y). with this message in the global chat :

"Player X destroyed a OPFOR MHQ, he gets Y points."


if the player team kill his own MHQ he lost Y points : 'Player X destroyed a Blufor MHQ he lost Y Points.


same thing for OPFOR.

Share this post


Link to post
Share on other sites

The Xeno's Dominations are making the units via script "CreateVehicle". So those units are unnamed. It's hard to make one for this purpose.

Share this post


Link to post
Share on other sites

that seems to be a kind of simple thing to do. but I don't handle the c++ language.

Share this post


Link to post
Share on other sites

As i said before the Enemy units under a Xeno's Domination are created using script ,not using an editor. So it's more difficult than starting from Zero [0].

 

I know how you could get 5 extra points (or more) by destroying an Enemy MHQ. I'm working on how to use it inside a Domination but not sure if i'll get.

But meanwhile use this for your convenience if you are thinking of adding more units via 2D/3D Editor and say us if it fits you.

 

Init.sqf:

waitUntil{(isNil "BIS_MPF_InitDone")};  // Don't add if you are already using a Xeno's Domination Mission !.

if (isServer) then {
"Paddscore" addPublicVariableEventHandler {((_this select 1) select 0) addScore ((_this select 1) select 1)}; };

Init Field of Unit (MHQ ... or not.... Different ways):

null = this addEventHandler ["killed", {nul = [_this select 0, _this select 1] execVM "ExtraPoints.sqf"}];

ExtraPoints.sqf:

// Script to add 5 Extra points destroying an enemy MHQ (Enemies = OPFOR)
// Kind of Enemy MHQs
_Vehicles = ["BTR90","BTR90_HQ","BTR60_TK_EP1", "BRDM2_HQ_TK_GUE_EP1", "BMP2_HQ_TK_EP1", "BMP2_HQ_INS"];

_BTR = _this select 0;   // Enemy MHQ
_BLUFOR = _this select 1;    // Player


// Checking if BLUFOR is AI or player (BLUFOR or OPFOR)

if (!isplayer _BLUFOR && side _BLUFOR == west) exitWith {Hint "AI has destroyed an enemy MHQ!"};

if (isplayer _BLUFOR && side _BLUFOR != west && ((typeOf _BTR) in _Vehicles)) exitwith {
[nil,_BLUFOR,"loc",rHINT,composeText [parsetext format["<t size='1.1' align='center' color='#ff6a33'>You have destroyed a MHQ of your same faction!: 10 Points less!.<br/>"]]] call RE;

sleep 1;

// Negative points

    if (isServer) then {

    _BLUFOR addScore -10;     // Points for HOST
 
    } else {

    Paddscore = [_BLUFOR, -15]; publicVariable "Paddscore";     // Points for Dedicated
    };


};


// Check the conditions
    
    if (isPlayer _BLUFOR && side _BLUFOR == west && ((typeOf _BTR) in _Vehicles)) then {

[nil,_BLUFOR,"loc",rHINT,composeText [parsetext format["<t size='1.1' align='center' color='#adff2f'>+5 Extra Points for destroying an enemy Mobile HQ.<br/>"]]] call RE;

sleep 1;


// Adding points
    
    if (isServer) then {

    _BLUFOR addScore 5;     // Points for HOST
 
    } else {

    Paddscore = [_BLUFOR, 5]; publicVariable "Paddscore";     // Points for Dedicated
    };
 

// Starting the Global Message.

    _message = format ["Soldier %1 destroyed an enemy MHQ", name _BLUFOR];
    [[west,"HQ"],nil,rSIDECHAT,_message] call RE;


// Deleting MHQ for improving fps and lag.

sleep 5;
deleteVehicle _BTR;

    // No Conditions done then...

    } else {

[nil,_BLUFOR,"loc",rHINT,"That wasn't an enemy HQ."] call RE;    // DEBUG ON. Better turn off this part.

};          // END

Sample Mission (Host / Dedicated / Editor / MP Compatible):

http://www.filedropper.com/extrapointsdeserte

Edited by Spunkmeyer

Share this post


Link to post
Share on other sites

By some reason these "HINTS" aren't working on Dedicated Server. I missed something.

 

* Fixed. Now it's working in Dedicated aswell. Sample Mission updated.

Share this post


Link to post
Share on other sites

Wait. Domination Two Teams?. So MHQs are spawning with names. I don't remember but ...are they Xvec1, Xvec2 for BLUFOR?

 

 

So you only need to make those TEAM MHQs to work using this part (for BLUFOR vs OPFOR):

 

Init Field of OPFOR MHQs:

 

Quote

null = this addEventHandler ["killed", {nul = [_this select 0, _this select 1] execVM "ExtraPoints.sqf"}];

 

 

 

For OPFOR vs BLUFOR you only need to make another copy of the script and rename it (example >> ExtraPoints2.sqf) and:

 

1) Change the type of MHQ to:

 

_Vehicles = ["BMP2_HQ_CDF", "BRDM2_HQ_Gue", "LAV25", "LAV25_HQ", "M1133_MEV_EP1"];

** Don't know if they are correct but LAV25_HQ (Chernarus) and M1133_MEV_EP1 (Takistan).

 

2) Swap sides from WEST to EAST and EAST to WEST.

 

3) Use this in the init field of BluFor MHQs:

 

Init Field of BLUFOR MHQs:

null = this addEventHandler ["killed", {nul = [_this select 0, _this select 1] execVM "ExtraPoints2.sqf"}];

Share this post


Link to post
Share on other sites

thanks for the replies.

yes i'm playing on Domination ACE Two teams server (uralserver66.ru)

 

i'm gonna try your procedure.  thanks a lot.

Share this post


Link to post
Share on other sites

 

 

 

Wait. Domination Two Teams?. So MHQs are spawning with names. I don't remember but ...are they Xvec1, Xvec2 for BLUFOR?

 

 

exact, the MHQs are already present in the mission

.sqm at the misison start. and they have Xvec1 & Xvec 2 names.

 

Share this post


Link to post
Share on other sites

I knew those names from WEST side but not the EAST. If you can provide me the EAST side names i could make you the exact script for both sides.

 

By the way i 'd prefer this first kind of script. So you could change the kind of HQ if you wish customize your HQs and it's working better.

Share this post


Link to post
Share on other sites

Your script works fine when I disable ACE.  but once ACE is enabled it doesn't work anymore. does it has to do with how the damages are handled ?

 

is it possible to completely delete (no need) the hint message (top right pop-up hint) and to make the message currently displayed in the chat message from side channel to global channel. ?

 

 

also this bonus scoring and message must also be triggered when the mhq vehicle is empty.

Share this post


Link to post
Share on other sites

That message is by destroying a NON MHQ vehicle.

It's strange. it worked for me. I put some OPFOR mhq at the left side and BLUFOR at the right. Maybe you should try destroy another unit.

There are 3 ways :

1. Enemy MHQ destroyed (points)

2. Same side destroyed (lose points)

3. That wasn't a MHQ. (No points)

Share this post


Link to post
Share on other sites

Hint is a kind of message. Global chat is another kind.

By the way i said that message "That wasn't an enemy HQ." was only for a debug. You 'd prefer not to have this message every time someone destroyes a vehicle...

Share this post


Link to post
Share on other sites

But if you wish try :

[nil, nil, rTITLETEXT, "That wasn't an enemy HQ." , "PLAIN", 0] call RE; // Text on the middle of the screen (GLOBAL)

OR :

[_BLUFOR,nil,rSIDECHAT,"That wasn't an enemy HQ."] call RE; // Global Chat (SIDE version)


INSTEAD OF : 


[nil,_BLUFOR,"loc",rHINT,"That wasn't an enemy HQ."] call RE; // Hint for local player who destroyes


I 'd prefer to delete that part because that's not pretty useful:

}; // END OF SCRIPT

INSTEAD OF :

    } else {

[nil,_BLUFOR,"loc",rHINT,"That wasn't an enemy HQ."] call RE;
}; // END OF SCRIPT

Share this post


Link to post
Share on other sites

the scoring is working fine without ACE as long as there is enemy inside the MHQ.  the extra scoring is not triggered when destroying an empty MHQ (empty vehicle compatibility is important when playing Domination, since the MHQ are empty when deployed).

 

with ACE the scoring is not working at all.

 

For the displayed message, I don't need Hint messages (these in the little pop-up) , only global message (white channel, visble by all) in the chat box.

 

- message : "Player (X) destroyed A Blufor (Opfor) MHQ, he gets (loses) 5 points."  according to legit or friendly fire.

Share this post


Link to post
Share on other sites

i'm a bit lost how to remove hint messages styles , and how to only keep global chat messages (using the message i posted just above).

Share this post


Link to post
Share on other sites

You must be wrong. I put you a global message using side chat channel (blue chat).

That white channel you say it's spatial channel. It's simply a local msg which is only read by players close the sender.

Share this post


Link to post
Share on other sites

so even if it's blue color (side channel), opposite team will see it too ?

 

ideally the message   "player (x) destroyed a Blufor MHQ, he gets 5 points"   should have the same form and color (white color, simple message) than the standard kill confirmation :

 

"player (x) killed player (y)".

Share this post


Link to post
Share on other sites

Do you mean GLOBAL CHANNEL or SIDE CHANNEL?

 

* Global is for everything connected.

* Side is just for its own faction.

let's resume :

 

1) the messages I want to display must be visible for everybody connected.

this is why I suggested global channel instead of chat channel. but maybe it's also possible to display global message without the need to use chatbox.

 

2) these are the 4 exact messages to show, according to the action :

 

(X) being a Blufor player, and (Y) being a Opfor player :

 

 

"Player (X) destroyed a OPFOR MHQ, he gets 5 points."

"Player (X) destroyed a BLUFOR MHQ, he loses 5 points."

"Player (Y) destroyed a BLUFOR MHQ, he gets 5 points."

"Player (Y) destroyed a OPFOR MHQ, he loses 5 points."

 

 

3)  the points are added (+5) or removed (-5) of the scoreboard accordingly.

4) destroying empty MHQs vehicles (BTR90_HQ) & (LAV25_HQ) must also trigger the messages and the scoreboard .

Share this post


Link to post
Share on other sites

forget ACE compatibility.  simply having it working on normal arma 2 will be enough.

 

if the 4 possibles messages I mentionned could be displayed in the global chat (visible by all). that would be perfect for me.

Share this post


Link to post
Share on other sites

* System Chat: Grey Colour (Local). Actually not used. It's not a great message:

SystemChat "Bla bla bla";.... // Ex 1
SystemChat format ["Welcome, %1.",name player]; // Ex 2

* GlobalChat: Light Blue (Global) Everyone in the server can read this message (Opfor, Blufor, Civilian, Resistance, Rabbits, EVERYBODY)

[player,nil,rGLOBALCHAT,"Starwars Galaxies rocks"] call RE; // ex 1
[player, nil, rGLOBALCHAT, format["got killed by «%1»",name _killer]] call RE; // ex 2

* SideChat: Blue Color (Side channel). Everyboy on your same faction will see this message.


[[West,"HQ"],nil,rSIDECHAT,"Don't die great heroes!"] call RE; // Ex 1
[[west,"HQ"],nil,rSIDECHAT,format ["You all are our heroes! And %1 is the best!", name player]] call RE; // Ex 2

* CommandChat (Yellow chat for commanders. Side channel)

 

* TitleText : Text in the middle of the screen (or below). TitleText is local but you can make it global using:

[nil, nil, rTITLETEXT, "StarWars Galaxies rocks!" , "PLAIN", 0] call RE; // ex Text in the MIDDLE


_message = "That which does not kill us makes us stronger. (Friedrich Nietzsche)";
[nil, nil, rTITLETEXT, _message , "PLAIN DOWN", 0] call RE; // ex Text DOWN

// Example 3:
_badPlayer = CursorTarget;
_spm = format["You're being a gadfly, %1.", name _badPlayer];
[nil, nil, rTITLETEXT, _spm , "PLAIN", 5] call RE;

I don't know if i miss some.

Share this post


Link to post
Share on other sites

All:

 

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

driver vehicle player sideChat "sideChat";

driver vehicle player globalChat "globalChat";

driver vehicle player groupChat "groupChat";

vehicle player vehicleChat "vehicleChat";

driver vehicle player commandChat "commandChat";

driver vehicle player customChat [1, "customChat"];

systemChat "systemChat";

But they need to modify to get them in MP.

Share this post


Link to post
Share on other sites

Thanks, i got it working for vanila version.  need to find a way to make it working when using ACE 2 mod.

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
Sign in to follow this  

×