Jump to content
Sign in to follow this  
Schilly

Global Scripts, Animations, ect...

Recommended Posts

I have been working on a training map for my unit for a while now... Making a firing range, ect.. I have run into a snag or two.

Firstly, the range is started by a script being executed by running an action that is available on a notice board. Afterwhich there is a series of hints.

For example:

- Player starts the range and the following hints happen:

hint "Range starting in 5...";
sleep 1;
hint "Range starting in 4...";
sleep 1;
hint "Range starting in 3...";
sleep 1;
hintSilent "Range starting in 2...";
sleep 1;
hintSilent "Range starting in 1...";
sleep 1;

Then during the range it's self, it has an auto-updating hint for what target you are on out of 30. (1/30, 3/30, ect...)

Then at the end it posts a hint saying "Range over"... ect... Which will also include the final score of targets hit.

Now the problem I am having is getting the hints to display globally across the entire server. As it stands, the hints only show for the person that started the script. Which I am assuming is due to me not scripting it correctly for mutiplayer.

With all that on the table, my first question is: How can I make a script run globally across an entire server?

Now the second issue I am having is, trying to figure out if the target was actually hit. I have done this in the past using a "_obj addEventHandler ["Hit", ...];" However I have found out that this is also a singleplayer thing, and does not function correctly in a multiplayer setting.

With that being said, my section question is: How would I go abouts seeing if a target was knocked over, in a multiplayer setting.

Below I have posted the script I am using for the target's... Random popup, ect... Perhaps I have scripted it incorrectly for global use.

The notice board runs this script: r_start.sqs...

nul=[target] execVM"popup.sqf";

Which runs this script: popup.sqf...

nopop = true;

_targets = [l1t1, l1t2, l1t3, l1t4, l1t5, l1t6, l1t7, l1t8, l1t9, l1t10, l1t11, l1t12, l1t13, l1t14, l1t15, l1t16, l1t17, l1t18, l1t19, l1t20, l1t21, l1t22, l1t23, l1t24, l1t25, l1t26, l1t27, l1t28, l1t29, l1t30];


{_x  animate["terc",1]} forEach _targets;

hint "Range Starting in 5...";
sleep 1;
hint "Range Starting in 4...";
sleep 1;
hint "Range Starting in 3...";
sleep 1;
hintSilent "Range Starting in 2...";
sleep 1;
hintSilent "Range Starting in 1...";
sleep 1;

_foo = 1;
_hc = 0;

while {_foo<31} do {
hintSilent format["Firing Range Active\n-------------------------------------\nCurrent target: %1/30.", _foo];
_rnumber = random 30;
_rtarget = _targets select _rnumber;
_rtarget animate["terc", 0];
sleep 2;
_rtarget animate["terc", 1];
_foo = _foo + 1;

sleep random 5;
};
hint format["Safeties On, Range Inactive!\n-------------------------------------\nFinal Score: %1/30.", _hc];

Any assistance would be greatly appreciated.

Share this post


Link to post
Share on other sites

Noone has any ideas as to how one would go abouts doing this?

Share this post


Link to post
Share on other sites

download this script

http://tajin.evilhosting.de/arma/mp_chat.sqf

put it in your missionfolder and call it with:

nul=["text","hintS"] execVM "mp_chat.sqf";

first parameter is the text you want to display, second parameter is how you want to display it and 3rd/4th parameter is only needed in some cases.

Its not fully tested but it should allow you to send out any kind of textmessage there is to all clients.

globalchat, sidechat, cutText and so on.

Just replace your "hint" commands with the execVM of the script.

Share this post


Link to post
Share on other sites

Works perfectly Tajin.

Have you any ideas about the animationPhase problem I am having?

Share this post


Link to post
Share on other sites

Anyone have any ideas on the issue of seeing if the targets were hit in mutiplayer?

Share this post


Link to post
Share on other sites

How you got that mp_chat.sqf to work? I tried to make it show text trough vehicles init field (nul=["text","vehicle"] execVM "mp_chat.sqf"), and trough trigger, but nothing...

Share this post


Link to post
Share on other sites

I could only get it to work with hint and hintS

Share this post


Link to post
Share on other sites

Its pretty much useles for init-fields anyway, any code in an init-field will be executed on all clients. There is no need for the script in that case.

Other chattypes DO work, however the commands for them are simplyfied in the script.

For example, if you want to use it for "globalchat":

nul=["text","global",someunit] execVM "mp_chat.sqf";

you'll only have to type "global", "side", and so on... not "globalchat".

However all these parameters can be easily found out by looking into the script. It may even help you to understand some basics about scripting. ;)

Edited by Tajin

Share this post


Link to post
Share on other sites

Im not stupid =)

nul=["test","global"] execVM "mp_chat.sqf";

doesn't show anything at all, only hint and hintS works

---------- Post added at 05:10 PM ---------- Previous post was at 05:08 PM ----------

i tried to execute that line in a trigger set to true, 1 second delay,and nothing...

Share this post


Link to post
Share on other sites
Im not stupid =)

Well, not more stupid than I. ^^

For not telling you that "global" ofcourse only works if you tell the script who shall do the talking.

You need a third parameter here.

Share this post


Link to post
Share on other sites

heheh!

Sry, im a bit blind here too, didn't read the code well and make a mistake, works like a charm now =)

Thank you!

Share this post


Link to post
Share on other sites

one more question concerning the MP text script, the cutText part.

I still havent figure out what i need to put to make it work.

Code looks like this (inside the script)

case "cutText":
{
	_init = format["cutText ['%1','%2',%3]",_text,_par1,_par2];	

_text is quite obvious (even for me xD), but i don't know what to do with _par1/2 ? Otherone has to be "plain/plain down etc", but which one and what i need to fill in to the other _par?

Edited by Carpaazi

Share this post


Link to post
Share on other sites
the argument uses format ["text","type",speed] or ["text","type"]. If speed is not given, it's assumed to be one.

_par2 is speed

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  

×