Jump to content
Sign in to follow this  
PSC

Sidechat question

Recommended Posts

I've got a question. I'd like one player of the team to say something in teamchat if a trigger is activated. Usually it would go like this:

"on activation" line of trigger:

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

s1 sideChat "Bla bla bla";

<span id='postcolor'>

"s1" is the playername in this case.

The problem is, "s1" is one of the choosable playerspots, but what if nobody chooses the "s1" slot. Nothing would happen then. So how do I make it if "s1" is not taken, that "s2", or, if "s2" is not taken as well, "s3" says "Bla bla bla"?

Maybe something like:

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

if "s1" is alive, say "Bla". Else "s2" say "Bla", etc.

<span id='postcolor'>

Regards and thanks in advance, PSC

Share this post


Link to post
Share on other sites

Oh well, it's always like that. You ask something and then you find the solution yourself. Looks like I did not read carefully enought through the search results. But at a second time I found this:

http://www.flashpoint1985.com/cgi-bin....idechat

I'm not 100% sure if this is what I'm searching for, but it looks like it is.

Thx anyways, PSC

Share this post


Link to post
Share on other sites
Guest jacobaby

You could make it so the first unit in thr group array said the chat I suppose...or is that what the thread is about?

TJ

Share this post


Link to post
Share on other sites

I hope something like this will work:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">(leader) sidechat "blah"<span id='postcolor'>

PSC

Share this post


Link to post
Share on other sites

Ok, it still doesn't work. So I'll try to specify the question:

I have 12 playerslots. They are named like this: Player01, Player02... Player12.

In the initline of Player01 I wrote:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">PlayerGroup = group this;<span id='postcolor'>

So if I write this into a trigger, and the leader (Player01) slot is taken by a human or AI, it works:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">leader PlayerGroup sidechat "It works!"<span id='postcolor'>

But if the Player01 slot is empty and the first slot taken by a human is Player03 for instance, it doesn't. Nothing will happen then. I guess the reason is that the people will not be grouped into PlayerGroup if there is no Player01.

Is there a way to group the playable slots in a different way? Something that I could write into the init.sqs file for instance. Maybe like this:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">PlayerGroup = [Player01, Player02... Player12];<span id='postcolor'>

Regards, PSC

Share this post


Link to post
Share on other sites

put playergroup = group this into every players init

then no matter how many people are playing/ not there wil lalways be a group.

Also use

(units playergroup select 0) instead of leader because apparently the leader one is only the leader at start (IE if he dies hes still leader)

Share this post


Link to post
Share on other sites

Thanks Baron Hurlothrumbo IIX, it works.

Share this post


Link to post
Share on other sites

You could use the CoC network services:

http://www.thechainofcommand.net/cgi-bin....17;t=25

When the network services are started then you'll have an array with the server and all payers in it. This array then exists on every client and the server.

So for your sidechat problem you wouldn't have to rely on the named playerslots, you would have the actual players right at your hand for your sidechat.

In MP scripting the network services make things much more easy.

Share this post


Link to post
Share on other sites

Oh well, seems like a good idea on the long run. But for the mission I'm working on right now I'm happy with the solution I found.

Regards, PSC

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  

×