OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: stuartf on 27 Sep 2005, 21:38:47
-
help plz...
a group of 10 playable men are put in my multiplayer map at start.
i need one of them to groupchat as soon as the mission begins.
BUT i only want one of them to groupchat.
and i need a line of script that makes one of the group - groupchat - any one will do as long as their actually playing - if that makes sense.
basically, if the person chooses to play as man 3 i need man 3 to do the groupchat.
if 2 people play as man 2 and man 5 in the group, i need only one of them to groupchat the message.
hope this makes sense.
filth.
-
_man = man5
if(alive Man1)then{man1 = _man; goto "NEXT"}
if(alive Man2)then{man2 = _man; goto "NEXT"}
if(alive Man3)then{man3 = _man; goto "NEXT"}
if(alive Man4)then{man4 = _man; goto "NEXT"}
if(alive Man5)then{man5 = _man; goto "NEXT"}
#NEXT
_man groupchat "Hello, message is......"
;; continue with rest of code
The above code must be run on all clients
eg ?(local player):[]exec "myscript.sqs"
Reason:
Groupchat is a local command, meaning, it will not be transmitted across a network, therefore you have to run the script that runs the code executed on all clients.
If its for the start of the mission, the Init.sqs is as goods as any, or possibly the Intro script
What the script does:
1) Looks to see if the first name in the list, eg man1 is alive, if so it skips checking the rest and jumps to the "next" label and so on and so forth
-
Pfft, don't make it any more complicated than it needs to be:
init.sqs
(leader GroupName) groupchat "Text"
-
kyle and terox,
thank you for your replies.
brilliant.
will try them out.
thanks again,
filth.
-
terox flipped his variables in the first part of the code so that wouldn't quite work anyway.... ::)
-
terox flipped his variables in the first part of the code so that wouldn't quite work anyway.... ::)
Yep, the equal signs only work one way ;)
-
:-)
Thats what happens when u just write the code on the fly