Jump to content
Sign in to follow this  
Taurus

Re: Playersnumber side

Recommended Posts

Playersnumber side

Posted by bn880 Mar. 05 2003,19:48.

Anyone got this to work as intended in Arma?

It seems it returns the playable units in Arma too, or what am I doing wrong?

playersNumber WEST

Share this post


Link to post
Share on other sites

there are other script based solutions in case it doesn't work

(for example in wgl5 - i guess also in Sickboy's pack smile_o.gif )

Share this post


Link to post
Share on other sites

I've solved this by other means.

But I really wish BIS could fix it.

I posted this because I thought I did it wrongly.

How do I post a request for a fix?

Share this post


Link to post
Share on other sites

it works, as it was used in berzerk map pack.

playersnumber west/east:

Return count of players playing on given side. Works only in multiplayer, in singleplayer always returns 0.

best way is to run it on serverside scripts.

Share this post


Link to post
Share on other sites

Q

Thanks

(lol I actually copy-pasted your name xD )

it works, as it was used in berzerk map pack.

Is this a mod?

playersnumber west/east:

Return count of players playing on given side. Works only in multiplayer, in singleplayer always returns 0.

Ye, I know, but I can't seem to get it to work.

best way is to run it on serverside scripts.

Thats how I was doing it.

Share this post


Link to post
Share on other sites

hi there... try this:

store the gamedatas you need in an array like this:

the first value will be east count, the second west count, and initialize it in init.sqf to [0,0].

For communication between server and client use another variable (a string) and initialize it to with ""; the gamedata will be transmitted via this string.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//init.sqf (for server and client)

gamedata=[0,0];

comstring="";

after that you need 2 loops, one for the clientside to catch up the values and one for the serverside to publish them.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//serverloop publishes array every 8 seconds:

while{true}do{

sleep 8;

gamedata set [0,playersnumber west];

gamedata set [1,playersnumber east];

comstring=str(gamedata);

publicvariable "comstring";

};

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

//clientloop looks for new comstring data every 4 seconds:

while{true}do{

sleep 4;

if(comstring!="")then{

gamedata=call compile comstring;

comstring="";

};

};

what happens is that you convert all your gamedatas inside the array to a string and pass it to clients by the publicvariable.

this isn't the easiest way at all but:

you can add all your data as scores, serverside events (true or false) ... whatever ... to the gamedata array.

on clients the actual datas are stored then in gamedata available to all client scripts, as the clientloop actualizes them all the time.

The Berzerk Map pack is not a mod... its a bundle of capture and hold maps quite similar to BF/MiniBF known from goood old OFP.

you can download the full package here:

The Berzerk Map pack v1.23 for Armed Assault

regards,

zap

Share this post


Link to post
Share on other sites
what Zaphod wrote.

I bow and thank you for your reply Zaphod.

But, I just wanted the server to calculate how many players who joined in the lobby so it could spawn stuff in the mission accordingly using

"condition of presence"

When I wrote I've solved it by using an work around.

I was wrong, because it turned out it didn't work in MP the way I wanted.

I put into my init file

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Plrs = 0;

if(isPlayer(A1)) then{

Plrs=Plrs+1;

};

if(isPlayer(A2)) then{

Plrs=Plrs+1;

};

Where A1 and A2 is set using the name field in the editor ofc.

Then I have an hint going off when the game starts.

Players online: 2

If A1 and A2 are played by humans.

However.

A units and or object "condition of presence"

Plrs>1

Would not work.

How come?

I thought the init-file was executed before the unit/vehicle/object inits?

Btw Zaphod, you don't happen to have Beeblebrox as your last name?

Share this post


Link to post
Share on other sites

hi again..

the init file is executed on briefing screen.

for your needs too early and executed just a single time.

as you want to check player slot conditions you have to start a script in the init file, that continues in a loop running for the whole game in an interval.

by doing this you can check the player conditions for a1,a2 .... all the time (with your solution and with mine as well).

use another temp variable to store the player count during loops , so the script can check for increasing/decreasing player counts comparing the stored value of the last interval with the current value. So in your case it would be easy to fire an additional script on increase and another on decrease.

looking at the playercounts itself might be the easiest way ...

and never forget:

DON'T PANIC!

regards

Zaphod Beeblebrox (President o.t.u.) yay.gif

Share this post


Link to post
Share on other sites

Yepp, but the problem is that I want to use "condition of presence" depending on how many players currently in the game.

And it seems that doesn't work, as the "condition of presence" is loaded before all of this happens.

I've tried with

isPlayer(A1)

in a units "c o p" but it doesn't work.

In this particular case I can not spawn them using createVehicle.

Well I "could" but I'm too lazy to calculate the precise location and direction depending on where that object should be and etc. confused_o.gif

biggrin_o.gif

I do feel like Arthur Dent sometimes when scripting.

Something along the lines of:

Oh, the earth is controlled and run by rats you say?

And its an huge computer manufactured to understand the question "the meaning of life and everything"?

Share this post


Link to post
Share on other sites

i don't understand why you want to do all this in the init script.

just start a script FROM the init script... with a loop! by exec or execvm ... the init script itself ends within the briefing (in normal case) ... but all other scripts with a loop continue running as game starts.

i guess i don't really get what you want.

regards,

zap

the earth was build to find the correct question for the meaning of life.... the answer was calculated by deep ford.

and what do you get if you multiply six by nine? 42

Share this post


Link to post
Share on other sites

I want to make units spawn according to how many players are currently in the game when it starts.

Using "condition of presence" but I can not get that to work.

I'm too lazy to "createVehicle" "createUnit" them because they are put in some odd locations, basic world models added with some other stuff around them.

I wished I could place them in the editor and play around with the Condition of presence*.

[edit]Just realized that be the second time I mention this, sorry[/edit]

If I wanted to count the players for other uses your example would be of great use smile_o.gif

*To bad that would be COP when you, eeeh, well "shorten it"

Yes, thats how I wanted to phrase it, but I couldn't find the english words.

LOL, great book that is, must read it again, to bad the movie missed out so much tho´ sad_o.gif

Share this post


Link to post
Share on other sites

let your units start in a hidden place ..an island for example ... instead of "spawning" it to your start location just move them there with "player setpos xy"... play a camera sequence or show a dialog or just delay it until your scripts got the position to spawn him to. it will feel like spawning.

so there is no need to do it directly on connect ... as there is no possibility to show it up on briefing as well ... its to early as the client scripts/loops don't run at this point.

but on gamestart they will ... receiving the playercounts and maybe the serverscript also calculates the spawn location and submit it to the new client.

and yes ... the movie was worse ... i just watched 15 mins. of it .... a really good alternative is the BBC series from the early 80's ... worth to watch. available as DVD in really nice "Don't Panic" box. 6x30min.

and your english ... not bad, but i don't wissen -> deutsch geht auch immer gut.

regards,

zap

Share this post


Link to post
Share on other sites

Yes it seems I will be having to do something like that, setpos and setpos back.

But then I can just spawn the stuff hmm, maybe there's a way to calculate the stuff relative to itself.

hmm...

Things would be so much easier if the editor object icons reflected "ingame" size instead of something completely different.

I remember there to be an update of the editor in OFP which actually set the proper icon and size.

Anyways, thanks for your help Zaphod!

------

Ye I looked at that BBC tv series, and it was good, somewhat felt like "Dr Who" but it sure was better than the movie nonetheless

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  

×