Jump to content
Sign in to follow this  
s13ep

Player, Player 2

Recommended Posts

How would I go about affecting each individual player ( out of a possible 3 )?

I have tried calling the units:

player 1

player 2

player 3

Then adding

player 1 addAction [...]

player 2 addAction [...]

But it comes to no avail.

Does this only work when using "player"?

How do I effect player 2 if not?

Share this post


Link to post
Share on other sites

Don't put spaces in their names

player1

player2

player3

player1 addAction [...]

Share this post


Link to post
Share on other sites
Don't put spaces in their names

player1

player2

player3

player1 addAction [...]

Fortunately that mistake was only in that example, even without the spaces it doesn't work...

Share this post


Link to post
Share on other sites

You need to name the units in the editor as well.

However, I don't know what exactly you are trying to do, but having rigid system like that is not very elegant, and not exactly MP-proof. If all the slots are playable, what happens if one is an AI, JIP, or doesn't exists at all?

Are you trying to add same action to all playable units?

Share this post


Link to post
Share on other sites
player1 setRank "PRIVATE";
player2 setRank "PRIVATE";
player3 setRank "PRIVATE";
player4 setRank "PRIVATE";
player5 setRank "PRIVATE";
player6 setRank "PRIVATE";
player7 setRank "PRIVATE";
player8 setRank "PRIVATE";
player9 setRank "PRIVATE";
player10 setRank "PRIVATE";

if player1 score = 100000 then player1 setRank "COLONEL";

player1 addScore 15000;
player2 addScore 15000;
player3 addScore 15000;
player4 addScore 15000;
player5 addScore 15000;
player6 addScore 15000;
player7 addScore 15000;
player8 addScore 15000;
player9 addScore 15000;
player10 addScore 15000;

player1 addAction ["Check Fund", hint format("Funds: $ %1", player1 score);
player2 addAction ["Check Fund", hint format("Funds: $ %1", player2 score);

Edited by s13ep

Share this post


Link to post
Share on other sites
You need to name the units in the editor as well.

However, I don't know what exactly you are trying to do, but having rigid system like that is not very elegant, and not exactly MP-proof. If all the slots are playable, what happens if one is an AI, JIP, or doesn't exists at all?

Are you trying to add same action to all playable units?

My mission is as follows as of Today, because I'm not advanced enough to create such an in-depth mission. There is a side-wide fund made easily; this should work out because it's a 10 man mission, everyone only has one life, and it's meant to be for hardcore players because it may take a few hours to complete. You gain money by completing missions,

With money you can buy weapons, vehicles, special missions with a higher payout...

You can switch on supports, etc.

There is an enemy HQ which can be assaulted at any time, but it's very hard without more advanced gear and supports.

Basically, all I (was) trying to do was have a separate fund for each player.

Share this post


Link to post
Share on other sites

I've shortened the first part of your script and also corrected some errors.

_allPlayer = ["player1","player2","player3","player4","player5","player6","player7","player8","player9","player10"];

{_x setRank "PRIVATE";} forEach _allPlayer;

if ([color="#FF0000"]score player1[/color] [color="#FF0000"]>[/color]= 100000) then //score player1 instead of player1 score //also don't use "=" to check the score use ">=" otherwise the player won't rank up if his score is higher.
{
player1 setRank "COLONEL";
};

Not sure about the following part. Do you want to add scores to all player equally ? 
player1 addScore 15000;
player2 addScore 15000;
player3 addScore 15000;
player4 addScore 15000;
player5 addScore 15000;
player6 addScore 15000;
player7 addScore 15000;
player8 addScore 15000;
player9 addScore 15000;
player10 addScore 15000;

{_x addAction ["Check Fund", hint format["Funds: $ %1", score player];} forEach _allPlayer;//To add the addAction to all 10 player you can simply do it like this. The addAction is always local to the player who calls it, to you can refer to the player score by using "score player"; instead of "score playerX"

Edited by R3vo

Share this post


Link to post
Share on other sites
I've shortened the first part of your script and also corrected some errors.

_allPlayer = ["player1","player2","player3","player4","player5","player6","player7","player8","player9","player10"];

{_x setRank "PRIVATE";} forEach _allPlayer;

if ([color="#FF0000"]score player1[/color] [color="#FF0000"]>[/color]= 100000) then //score player1 instead of player1 score //also don't use "=" to check the score use ">=" otherwise the player won't rank up if his score is higher.
{
player1 setRank "COLONEL";
};

Not sure about the following part. Do you want to add scores to all player equally ? 
player1 addScore 15000;
player2 addScore 15000;
player3 addScore 15000;
player4 addScore 15000;
player5 addScore 15000;
player6 addScore 15000;
player7 addScore 15000;
player8 addScore 15000;
player9 addScore 15000;
player10 addScore 15000;

{_x addAction ["Check Fund", hint format["Funds: $ %1", score player];} forEach _allPlayer;//To add the addAction to all 10 player you can simply do it like this. The addAction is always local to the player who calls it, to you can refer to the player score by using "score player"; instead of "score playerX"

Thank you for that shortcut.

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  

×