Home   Help Search Login Register  

Author Topic: Question about particleeffects in multiplayer missions.  (Read 2079 times)

0 Members and 1 Guest are viewing this topic.

Offline SpaceMace

  • Members
  • *
  • God d**n the torpedoes...
Hey.

I need some help to make a smoke-"drop" effect show up to all players in a multiplayergame.

I know the script needs to be run on the server for the effect to be visible for all players, but i cant figure out how a player activated script can be made to run on the server.

Thankful for any help.
« Last Edit: 28 Mar 2003, 15:07:34 by SpaceMace »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Question about particleeffects in multiplayer missions.
« Reply #1 on: 28 Mar 2003, 23:40:20 »
Hmm... I pretty sure that running the script on only the server will mean that none of the clients see the effects.

I think you'll need to run the script locally on every client in order for everyone to see the effects...

I suggest using a trigger to activate your particle script ;)

Rubble_Maker

  • Guest
Re:Question about particleeffects in multiplayer missions.
« Reply #2 on: 29 Mar 2003, 10:46:09 »
Yes, drop is a local command, i.e. running on the local machine only. I suggest you call your drop scripts from the init.sqs, then they will run on all machines, or use a trigger like Sui suggests.

Offline SpaceMace

  • Members
  • *
  • God d**n the torpedoes...
Re:Question about particleeffects in multiplayer missions.
« Reply #3 on: 29 Mar 2003, 15:55:24 »

Thank you gentlemen.

I got it to work with triggers and publicvariables.
Could not have done it without you.

Problem solved..

Pimmelorus

  • Guest
Re:Question about particleeffects in multiplayer missions.
« Reply #4 on: 01 Apr 2003, 08:32:49 »
SpaceMace, would you be so kind to make public (or to me alone) how you did this? I am encountering the same problem. I want to include the helicopter-dust-script and the tank-dust-script into my multiplayer maps and I dont know how.

Thnx in advance,

Pimmelorus
[ZEUS addon server]
« Last Edit: 01 Apr 2003, 08:33:31 by Pimmelorus »

Offline SpaceMace

  • Members
  • *
  • God d**n the torpedoes...
Re:Question about particleeffects in multiplayer missions.
« Reply #5 on: 01 Apr 2003, 12:01:35 »
Make a trigger activated by anybody cover the whole island.
Have your dust script exec from there.

If there is a condition for the trigger that is activated from a script, make sure you make that variable public with: PublicVariable"variablename"

That should do it.
« Last Edit: 01 Apr 2003, 12:59:39 by SpaceMace »

Pimmelorus

  • Guest
Re:Question about particleeffects in multiplayer missions.
« Reply #6 on: 01 Apr 2003, 17:06:13 »
Hmmm, sounds promissing...triggers are always public isn't it? So that would work..

But what I want now is that if these conditions are met:

1] Vehicle is tank
2] The main gun is fired

the tank_dust_script is activated on all clients. Dunno how to do that with this trigger?

Understand my problem, SpaceMace?

Thnx,

PS. In this thread
http://www.flashpoint1985.com/cgi-bin/ikonboard301/ikonboard.cgi?s=3e89a4296ebfffff;act=ST;f=7;t=28123
of the official forums I presume a very important thing is mentione, although I got not enough experience to fully oversee the implications

« Last Edit: 01 Apr 2003, 17:09:04 by Pimmelorus »

Tactician

  • Guest
Re:Question about particleeffects in multiplayer missions.
« Reply #7 on: 01 Apr 2003, 23:50:00 »
You could skip the trigger and exec it from init.sqs.  Or did you try that first?

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Question about particleeffects in multiplayer missions.
« Reply #8 on: 02 Apr 2003, 02:44:25 »
Right, for a start bear in mind that I don't really specialise in the area of MP missions... but here's a cunning trick I use in single player missions, to execute commands from a script using a trigger.

So what, you say?
Well, you can execute any command from a single trigger. Some commands are unreliable in scripts, and 'inserting' them into a trigger fixes this.

Anyway, the trigger looks something like this:

Trigger

Radius: 0,0
Condition: none (repeatedly)
Condition Field: orderstring != ""
OnActivatio Field: call format ["" + orderstring ]; orderstring = ""

So for instance in my Scene script I want to change the behaviour of a unit (for some reason, their behaviour doesn't change when I give them a setbehaviour command in the script). So I use the line:

orderstring = "unit setbehaviour ""safe"""

(Note the necessity of the double quotes, as you have to pass the whole line as a string). The orderstring variable changes from "", and the trigger trips, executing that command from it's onactivation line.

If I was going to do this in MP, I'd imagine it would look something like this:

orderstring = "unit setbehaviour ""safe"""
Publicvariable "orderstring"

It doesn't stop there... provided you understand how to take care of the quotes (ie. when double and triple quotes are necessary... I'd also investigate using {} ) you can use it to pass orders to whole arrays, eg.

orderstring = """_x dofollow abrams"" foreach [apac, bapc, capc]"

Anyway, as I said I haven't used that in MP, but have a muck around and see if you can get it going ;)

Tactician

  • Guest
Re:Question about particleeffects in multiplayer missions.
« Reply #9 on: 02 Apr 2003, 06:37:41 »
Quote
publicVariable varName

Operand types:
varName: String
Type of returned value:
Nothing
Description:
Broadcast variable value to all computers. Only type Number is supported in 1.33 and before. Following types are supported since 1.34: Number, Boolean, Object, Group.

Unfortunately, strings and arrays can not be broadcast via publicVariable.  Such a function would be infinitely useful, but alas, it is not so.

With a little hacking you can create an array of limited size from public variables like this:

init.sqs snippet:
Code: [Select]
;; example of dynamic public array with max 5 elements
publicArraySize = 0
publicArrayMaxSize = 5
publicArray1 = 0
publicArray2 = 0
publicArray3 = 0
publicArray4 = 0
publicArray5 = 0
;; this execs the "capture" script for all clients
[] exec "pubArrayCapture.sqs"

pubArrayCapture.sqs:
Code: [Select]
#start
@publicArraySize != 0
?(publicArraySize > publicArrayMaxSize): publicArraySize = publicArrayMaxSize
_publicArray = [publicArray1, publicArray2, publicArray3, publicArray4, publicArray5]
_publicArray resize publicArraySize
result = _publicArray
publicArraySize = 0
goto "start"

broadcastArray.sqs (executed only by server):
Code: [Select]
;; passes all parameters to the public
;; assumes at least 1 parameter, no more than publicArrayMaxSize parameters
;; if only 1 parameter, should still be in form of array (e.g. [this])
_array = _this
publicArray1 = _array select 0; publicVariable "publicArray1"
?!(isNull (_array select 1)): publicArray2 = _array select 1; publicVariable "publicArray2"
?!(isNull (_array select 2)): publicArray3 = _array select 2; publicVariable "publicArray3"
?!(isNull (_array select 3)): publicArray4 = _array select 3; publicVariable "publicArray4"
?!(isNull (_array select 4)): publicArray5 = _array select 4; publicVariable "publicArray5"
publicArraySize = (count _array); publicVariable "publicArraySize"

Notes:

- This is untested and unwarrantied.
- Only publicVariablable variables may be passed to broadcastArray.sqs.
- Works on same concept as the publicVariable events in the Server-side Loops and Messages tutorial.
- If the above works I will add it to the depot, as a method of broadcasting arrays is useful indeed.
- Why didn't I think of this before?
« Last Edit: 02 Apr 2003, 06:43:58 by Tactician »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Question about particleeffects in multiplayer missions.
« Reply #10 on: 03 Apr 2003, 02:08:40 »
Hmm... well, I guess that pretty much torpedoed my theory ;D

Still, it'll be good work if you can get the above going :)