Home   Help Search Login Register  

Author Topic: Skumball's airstrike script In MP missions  (Read 4783 times)

0 Members and 1 Guest are viewing this topic.

Offline Alan34

  • Members
  • *
  • Praise the Lord and pass the Carl Gustav
    • Red Devils
Skumball's airstrike script In MP missions
« on: 30 Nov 2002, 17:32:56 »
Has anyone had trouble using Skumballs airstrike script in a MP mission?  Seems that on the host (server) can use the script. When a client machine player trys to call the airstrike, the plan never comes in.  I remember an old issue with scripts on host vs client machines that was fixed in a patch a long time back.  We are using Resistance 1.90 and maybe this problem is back.

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Skumball's airstrike script In MP missions
« Reply #1 on: 12 Dec 2002, 23:53:43 »
I was thinking of writing a tutorial on this, because it took awhile to figure out.

Suppose you have a dedicated server, right?. A client activates the radio command for an airstrike, and then clicks on the map.

The map click is registered on the client computer, and the server doesn't know anything about it. You need to let the server know that a map click has occurred.

Rather than the radio trigger calling airstrike.sqs, make it call a new script called 'triggerstrike.sqs' and in that script have something like the following:

Code: [Select]
; the event handler thingy is here (can't remember it exactly)
onmapclick{}

_pos = _this select 0
var_x = _pos select 0
var_y = _pos select 1
var_triggerstrike = true

publicvariable "var_x"
publicvariable "var_y"
publicvariable "var_triggerstrike"

now, make another file called 'server_loop.sqs', and in that file put:

Code: [Select]
? !(local Server) : exit

var_triggerstrike = false

#loop

? !var_triggerstrike : goto "nostrike"

; a call for an airstrike has been received
[[var_x,var_y]] exec "airstrike.sqs"

; this will activate the trigger (on all machines) that will launch the airstrike on the clients
var_doairstrike = true
publicvariable "var_doairstrike"

var_triggerstrike = false

#nostrike

~0.1

goto "loop"

Call server_loop.sqs from init.sqs (so it starts running right at the start of the mission). Also make a game logic unit in the mission editor and name it 'Server'. server_loop.sqs will only run on the server computer.

now make another trigger in the actual mission, and make it activate on 'var_doairstrike'. In the on activation field put:

Code: [Select]
var_doairstrike = false; [[var_x,var_y]] exec "airstrike.sqs"
Finally, you need to edit airstrike.sqs. We need to do this so that the server does not run the airstrike script twice (once in server_loop.sqs and once thanks to the above trigger).

Put the following at the very top:

Code: [Select]
? var_airstrike_done : exit
var_airstrike_done = true

So, to summarise:

  • Two triggers, one that calls triggerstrike.sqs when the map is clicked and another that calls airstrike.sqs when var_doairstrike == true.
  • Three new/modified scripts, triggerstrike.sqs (sends global variables containing details of the strike to the server), server_loop.sqs (called from init.sqs and detects the global variables and triggers the strike on the server, and then triggers the strike on all clients), and airstrike.sqs (slightly modified so it can't be executed twice).
  • One gamelogic unit named 'Server' to be used by server_loop.sqs.


This is all written from memory, but i can put together an example mission this weekend if you would like.

Two points to remember:

  • You should only be creating new vehicles on the server (with the createVehicle command, not camCreate as is used in the airstrike script).
  • Events (like the map click event) happen only on a single client computer, you need to use publicvariable somehow to make the server aware of what is going on.


It doesn't hurt to run airstike.sqs on all clients however because that way everyone sees the sideChat messages.

I got the napalm version working in multiplayer also, but that was a little more complicated (the napalm has to be created on the the clients for some reason, but the clients need to track the bombs created on the server to know when to launch the napalm. messy). :-X

Like I said, this is all off-the-cuff, but i'll post an example mission with both MP LGB's and napalm in the next few days (when I get a chance).

Clear as mud? :-\

ps you'll need to add some more variables and checks if you want the airstrike to work multiple times in MP - what i have put here will only work once (if at all given it is all from memory). :P
« Last Edit: 12 Dec 2002, 23:56:22 by snYpir »
Bohemia Interactive Simulations

Offline Alan34

  • Members
  • *
  • Praise the Lord and pass the Carl Gustav
    • Red Devils
Re:Skumball's airstrike script In MP missions
« Reply #2 on: 13 Dec 2002, 01:45:49 »
Hey, thanks a ton for the detailed explanation and solution.  I did a quick test and when the strike is called it does everything right away, all sidechats and the bombs dropped before any Mapclick to designate where the bombs should go.  I will check/test some more in case I messed up making the modifications.  Look forward to seeing your sample mission when you have time.  Thanks again:)

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Skumball's airstrike script In MP missions
« Reply #3 on: 13 Dec 2002, 08:17:20 »
hmmm - issues.

are you sure you have the unit named strikePilot on your map somewhere?

remember also that there will be two triggers.

1) The original trigger (with the onmapclick event), that calls triggerstrike.sqs, and

2) The new trigger that activates on 'var_doairstrike'.

Like I said, I am still cuffing this because I don't have access to my game PC until next Monday.

I struggled with it for awhile, but eventually found a method that works. It's been two weeks since your original post anyway, so i guess another couple of days won't matter too much ;D

rest assured it can be done, because I use it in my latest 'nam team DM mission and it works.

until next monday,

snYpir :-*
Bohemia Interactive Simulations

Offline Alan34

  • Members
  • *
  • Praise the Lord and pass the Carl Gustav
    • Red Devils
Re:Skumball's airstrike script In MP missions
« Reply #4 on: 14 Dec 2002, 03:00:17 »
Ok, my bad.  I had set up one of the triggers wrong.  Works fine in the editor now.  Will test in MP next.  Thanks again:)

Commando

  • Guest
Re:Skumball's airstrike script In MP missions
« Reply #5 on: 20 Dec 2002, 01:12:56 »
I noticed your topic and got a few questions.
Where do I get that airstrike script and isn't there a chance that the fuel will run out for the pilot? And can I place out a plane and pilot on a airfield where he would start from? :P

Offline Alan34

  • Members
  • *
  • Praise the Lord and pass the Carl Gustav
    • Red Devils
Re:Skumball's airstrike script In MP missions
« Reply #6 on: 20 Dec 2002, 01:47:01 »
Hey Commando, the script should be in the code snipets section.  No worry as to fuel because the A10 is camcreated when u call the strike.  If u run into any other problems, let me know.  One thing, u may need to play around with the starting height value of the script as the A10 needs a minimum startiing altitude (depending on the terrain) or it will crash soon after it is created.

Commando

  • Guest
Re:Skumball's airstrike script In MP missions
« Reply #7 on: 20 Dec 2002, 13:46:55 »
nice thanks

Offline Allie

  • Members
  • *
  • I'm a llama!
Re:Skumball's airstrike script In MP missions
« Reply #8 on: 23 Dec 2002, 14:52:32 »
here i am again :)

i'm still working on the Scumball airstike to get it to work in multiplayer !!!

>>>the radio commands has something to do with assigning  variables(still not figured out )
>>>use CreateVehicle insted of CamCreate !!!(this will make them show up for all players !!!
>>>after 1 airstrike still not able to call again

Hope some more of u guys start wondering about this

dont be afraid i wont give up :)

Greetings Allie :)

ps.we need to open up this editor stuff for multiplay pls pls !!!
« Last Edit: 24 Dec 2002, 02:17:12 by Allie »

Commando

  • Guest
Re:Skumball's airstrike script In MP missions
« Reply #9 on: 23 Dec 2002, 16:19:59 »
Nice to know  :D

Offline KeyCat

  • Members
  • *
Re:Skumball's airstrike script In MP missions
« Reply #10 on: 25 Dec 2002, 04:33:05 »
I'm also very interested in this topic since I've put airstrike support on hold in my mission until I can get it to work in MP.

I have one small request to all great script wizards... It would be nice if something was written in the comments of the acctual script if it was written/tested for SP, MP or maybe both.

/Christer (a.k.a KeyCat)

- The journey is the reward!

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Skumball's airstrike script In MP missions
« Reply #11 on: 25 Dec 2002, 09:37:24 »
I hear u all - the script works in multiplayer with minor modification.

i am at home the christmas break with only a laptop, and no multiplayer capability.

i do have the mission here though, and i'll post it here tomorrow morning (have to extract only the relevant triggers and re-save).

rest assured that it CAN be used in multiplayer, and works fine. You just have to set the triggers up correctly.

until tomorrow... ;)
Bohemia Interactive Simulations

Offline KeyCat

  • Members
  • *
Re:Skumball's airstrike script In MP missions
« Reply #12 on: 25 Dec 2002, 10:38:36 »
Thanks for offering your extended help snYpir and Merry Christmas to all!

/Christer (a.k.a KeyCat)

- The journey is the reward!

Offline snYpir

  • BIS Team
  • ****
  • OFPEC Jedi Master
    • OFPEC
Re:Skumball's airstrike script In MP missions
« Reply #13 on: 26 Dec 2002, 00:55:22 »
Attached is an example mission showing how to use the airstrike script (LGB and napalm) in MP.

This is still under testing, I have only tested it in a server - client environment so far.

The trick is to make the server control the strike, but to still allow the clients to follow what is happening.

All of the scripts in this example mission are required for an airstrike in MP, including message_loop.sqs (ensures messages are displayed on all computers) and server_loop.sqs (allows the server to monitor for a map click event).

Napalm.pbo (in the attached zip) needs to go to your Res/Addons directory for the napalm strike to work (this is the same addon as is available in the editors depot in LCD's script).

Getting complicated scripts to work in MP is a matter of trial and error. I am interested to know if this MP version works in an environment with multiple clients.

Bugs/limitations:

  • The attached version will only work for a single strike. I have not got around to implementing multiple strikes, but i will eventually. It shouldn't be hard - u would simply need to reset radio messages on all computers and re-init variables.

  • The 'request strike at coords' message will always look as though it was sent by the local player. This is because I don't know a way to detect which unit triggered the map click event.


I will have trouble fixing bugs at the moment because i only have my damn slow laptop and no multiplayer capability.

Questions?
Bohemia Interactive Simulations

Offline Allie

  • Members
  • *
  • I'm a llama!
Re:Skumball's airstrike script In MP missions
« Reply #14 on: 27 Dec 2002, 01:16:26 »
Merry X-mas to you all :)

thank you very much MR.snYper, for fixxing us the mission on this short notice :)