Jump to content
Sign in to follow this  
Bullz_eye_on_my_back

Initialization sequence in start up....

Recommended Posts

I'm making a set of addons that are dependent upon the other...

I have set up through the confige file to have event handlers...for

Initialization and "killed" events

I've made the intitialization script where it can set up an array to name all of this type of addon placed into the editor. At the same time it "createvehicle"s all of the dependent addons and names them into an array.

By doing it this way I can make the "killed" event script where it will only affect the addons that are created with it.

My problem is, is that on the initialization line in the editor I set the height of the first addon. I don't know when the embedded script begins because it doesn't createvehicle any of the dependent addons at the right height but at the original height of the addon before it was "setpos" upwards.

here is the script thats inbeded into the addon... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_objindep = _this select 0

_x= getpos _objindep select 0

_y= getpos _objindep select 1

_z= getpos _objindep select 2

_objindep setpos [_x,_y,(_z)]

If  (format ["%1", MyServeurArrayOfobjindep ] == "scalar bool array string 0xfcffffef")  then { MyServeurArrayOfobjindep = [] }

MyServeurArrayOfobjindep = MyServeurArrayOfobjindep + [_objindep  ]

_IDofobjindep = (count MyServeurArrayOfobjindep ) - 1

PubArrayofobjindepIndex = count MyServeurArrayOfobjindep;publicvariable "PubArrayofobjindepIndex"

Call format [ "PubArrayofobjindep%1 = _objindep  ; publicvariable {PubArrayofobjindep%1}",_IDofobjindep ]

_objdepend1 = "objdepend1" createvehicle [_x, _y,(_z)-126]

_objdepend1 setpos [_x, _y,(_z)-126]

If  (format ["%1", MyServeurArrayOfobjdepend1 ] == "scalar bool array string 0xfcffffef")  then { MyServeurArrayOfobjdepend1 = [] }

MyServeurArrayOfobjdepend1 = MyServeurArrayOfobjdepend1 + [_objdepend1  ]

_IDofobjdepend1 = (count MyServeurArrayOfobjdepend1 ) - 1

PubArrayofobjdepend1Index = count MyServeurArrayOfobjdepend1;publicvariable "PubArrayofobjdepend1Index"

Call format [ "PubArrayofobjdepend1%1 = _objdepend1  ; publicvariable {PubArrayofobjdepend1%1}",_IDofobjdepend1 ]

_objdepend2 = "winch" createvehicle [getpos _objindep select 0, getpos _objindep select 1,(getpos _objindep select 2)]

_objdepend2 setpos [_x, _y,(_z)]

If  (format ["%1", MyServeurArrayOfobjdepend2 ] == "scalar bool array string 0xfcffffef")  then { MyServeurArrayOfobjdepend2 = [] }

MyServeurArrayOfobjdepend2 = MyServeurArrayOfobjdepend2 + [_objdepend2  ]

_IDofobjdepend2 = (count MyServeurArrayOfobjdepend2 ) - 1

PubArrayofobjdepend2Index = count MyServeurArrayOfobjdepend2;publicvariable "PubArrayofobjdepend2Index"

Call format [ "PubArrayofobjdepend2%1 = _objdepend2  ; publicvariable {PubArrayofobjdepend2%1}",_IDofobjdepend2 ]

exit

In the init.sqs in the mission folder i do this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

obj setpos [ getpos obj select 0, getpos obj select 1, (getpos obj select 2) +15]

It will set the height of the object up 15 meters, but the "Createvehicle"-ed objects only get placed at the objects height before its moved upwards...

I'm trying to make it all automatic so that a mission maker won't have to take all of their time by setting up scripts for event handlers and naming them all.

Does anyone know of a better way to do this??

Share this post


Link to post
Share on other sites

Woah..

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If  (format ["%1", MyServeurArrayOfobjdepend2 ] == "scalar bool array string 0xfcffffef")  then { MyServeurArrayOfobjdepend2 = [] }

This works???  You can't check for an uninitialized value I thought?

Doolittle

Share this post


Link to post
Share on other sites

Well I figured out my problem, but found a really wierd problem...

To fix my problem all I had to do is set up a delay into the beginning of the script. It gives it enough time to catch the height changes set up in the other "init.sqs" script.

I have found a different problem though. I have imbedded some scripts to move the objindep up and down by user actions at its base. With about 20 of these objects in the game. I can go up to nearly all of them and select up- it will go up. Then about 4 of them in one area....they will go down instead of up. wink_o.gif

Share this post


Link to post
Share on other sites

Figured out what is causing my second problem, but I don't know how to fix it.

The objects that are placed on the side of a "hill" or slanted terrain cause the problem for some reason. When the action for it to be lifted up, it goes down instead. But all of the objects that are placed on areas that are basically flat, it works perfectly. crazy_o.gif

I'm not sure what to think on this one....I've tried raising it up and everything else where it is not on the ground, but it still does the same thing...

have I encountered a strange and unfound bug??

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  

×