Home   Help Search Login Register  

Author Topic: Investigation: Initialisation of units/objects/waypoints/triggers  (Read 4505 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Quote
As for the init.sqs not being executed first, to me that is obvious...
How else would you execute all kinds of list my_trigger etc. things from the init.sqs if it was executed before the trigger and units placed on the map are initialised..

Well by that logic i've seen it also that way, but i couldn't tell before testing, when exactly it
gets executed now could you?  :D

Just for example: the script started from init field of a unit - i've never thought about
that it becomes executed before init.sqs because i didn't know.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
My comment about MP was from personal experience. In the init fields for some east units (that I most first in the editor) I had a couple simple lines to add sidearms, mags, and nvg. On the server, they did often did not get any for at least 60 seconds.  When I instead did this with a script called from the init.sqs, they always got them.  I guess this is similar to what has been stated: their init fields were being processed last. I still think it is best to initialise units from a script  (or better yet, a function) called from the init.sqs.  If you have many units, and have to go back to change the init field for each of them either in the game editor or a text editor, it is quite a nuisance.  It is much easier to change a single script.

I have had long discussions with both CrashDome and UNN about the use of PV near a mission start.  From these discussions I was lead to believe the the init.sqs starts being processed as soon as the briefing screen loads.  If it is very long and complicated and everyone greens up very fast, it may not finish processing before the mission starts. Also, a ~ in the init.sqs will pause it there until the mission starts. A ~ in a script called from the init.sqs will pause that script until the mission starts.

Maybe init fields are the same? The game tries to process them all as soon as the briefing screen loads, but if there are many units and long init fields, they may not all get processed before the game starts?

I won't insert my ramble about the PV command here...  :banghead:
urp!

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
May i?  :)

I've tested what you said and i must say the result was not like you expected it to be;

Code: [Select]
_i = 0

#again

a = a + 1

?a < 500000 : goto "again"

I've put that in init.sqs and then started the map.
After player selection screen there was the usual 'get ready' message then followed
by a few seconds of 'sending data'.
Once i reached the briefing screen i quickly pressed enter to start the game and display 'a'.

It returned: 500000

When testing the same with any event which from my previous results gets executed
after init.sqs, the result was always the value of 'a' which came from the event after init.sqs.


You're right with the ~delay, because when testing this:

Code: [Select]
a = 20

~10

_i = 0

#again

a = a + 1

?a < 500000 : goto "again"

I again quickly started the game after the usual short loading without 'sending data'
and it returned 20.
After 10 seconds the game got frozen for 2 or 3 seconds and then it returned 500000.

Well, when testing with 5000000 i found me back to desktop (even with 2 gigs of ram)  :D

Since this stuff is all running local and doesn't require network traffic, it doesn't matter, how
many clients are connected - result will be everywhere the same.

Init.sqs without a delay will be finished before starting the game in every case.  ;)

To use publicvariable or a delay in init.sqs is something not to recommend or better say
a 'must not' because that's not what init.sqs is for.

btw - there were at least 200 units deployed on the map, so this also doesn't make any
difference on the outcome.

But it's good to include every single thought or suspect into the testings like you did
Mr. Peanut, at least the spectrum of tests gets more wide and one day we really can
have a reference of what happens when (exactly).   :good:

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Quote
one day we really can
have a reference of what happens when (exactly).   

Even if you never quite make it, please make sure you leave whatever you do find out in a nice summary form so that people can use it.  Thanks.
Plenty of reviewed ArmA missions for you to play