Home   Help Search Login Register  

Author Topic: Addon Init Events & Mission start  (Read 1349 times)

0 Members and 1 Guest are viewing this topic.

UNN

  • Guest
Addon Init Events & Mission start
« on: 31 May 2005, 19:59:18 »
Hi,

I trying out some MP scripting using a dedicated server runing on the same machine as OFP.

When I start the mission for the first time, it appears to execute some of my scripts (addon init events) while I'm waiting in the breifing screen. Then for a second time when I start the mission for real?

I'm guessing that any logic that test for global variables not being defined, will not work. But are there any other side effects. If I create a unit at the very start of a mission while still in the breifing, will that be deleted and created for a second time?

Or do I have it all wrong?

Cheers

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Addon Init Events & Mission start
« Reply #1 on: 31 May 2005, 20:27:35 »
???

I'm not quite tracking with everything you are asking about, but I do have some insight ("guesses") that might help you.

It might be that addon 'init' EHs work just like init.sqs. Init.sqs is called on the map briefing screen, just before the mission starts, and it will proceed until it reaches any sort of a delay.

The same might be happening with your addons-- their init scripts are running on the map screen, right up until they hit a delay. At which point it stops, waits until the briefing is over, and then keeps on going.

As for conditions not working properly: You need to be pretty careful when using conditions at the very start of the game (before any delays). It would all depend on what your condition is, but OFP might be running into the condition before certain variables/units are initialized. I know there is one huge PITA bug when it comes to when OFP initializes arrays.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

UNN

  • Guest
Re:Addon Init Events & Mission start
« Reply #2 on: 01 Jun 2005, 05:59:36 »
Quote
Init.sqs is called on the map briefing screen, just before the mission starts, and it will proceed until it reaches any sort of a delay.

Yep thats sounds like it could be the problem, I'm using the @ to wait for some conditions, so I probably need to find the best spot for a delay. But I won't solve the thread just yet as there might be other things that cause the first script to end or won't execute until the second time it's run.

I'm thinking this should be used to make sure all the clients are initalise properly before the mission starts, but is it best to create any heavy net work traffic with PublicVariable, before or after?

Gah...Mutli Player...I can think of half a dozen other potential problems, and I have not even got as far as starting a mission :)

Thanks for your help. Along with trying to use the Local command in a function called from an init event, I was getting into all kinds of trouble.




Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Addon Init Events & Mission start
« Reply #3 on: 01 Jun 2005, 14:24:49 »
Quote
I'm thinking this should be used to make sure all the clients are initalise properly before the mission starts, but is it best to create any heavy net work traffic with PublicVariable, before or after?
Hmm... I would think it best to do this AFTER mission start, since there is already a bunch of traffic between the server with everyone downloading the map and all. Also, some MP maps might have their own network traffic running on startup. If possible, I think it would be best to wait a few seconds after mission start.

Quote
Along with trying to use the Local command in a function called from an init event, I was getting into all kinds of trouble.
??? Hmm? Not sure I've run into this before, or even know what the problem would be.

Quote
Gah...Mutli Player...I can think of half a dozen other potential problems, and I have not even got as far as starting a mission

Lol!  :P C'mon, you know it's more 'fun' to script for mp...

Hey, I'd really suggest you use the CoC's Network Services. It makes MP editing just about 100000000000000000.1% easier. If this is for an addon, then you would just need to make your addon require that NS is used in the mission.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

UNN

  • Guest
Re:Addon Init Events & Mission start
« Reply #4 on: 01 Jun 2005, 15:54:00 »
Quote
Hmm... I would think it best to do this AFTER mission start, since there is already a bunch of traffic between the server with everyone downloading the map and all. Also, some MP maps might have their own network traffic running on startup.

Good point, it does work as you said. The ~ will pause the addons init scripts until mission start.

Quote
Hmm? Not sure I've run into this before, or even know what the problem would be.

It's a bit like the Group command, you cant run that from a function called from Init either. It's fine when called from a script.

Quote
C'mon, you know it's more 'fun' to script for mp...

True :)

Quote
Hey, I'd really suggest you use the CoC's Network Services. It makes MP editing just about 100000000000000000.1% easier. If this is for an addon, then you would just need to make your addon require that NS is used in the mission.

I will if I run into anything specific, but I would probably rip out the bits I need (with suitable credits). I have my own requierments for my MP stuff, for example I use AddRating for a couple of things including syncing across a network. That was part of my problem before, because AddRating only kicks in, once the mission has started.

Cheers