Jump to content
Sign in to follow this  
UNN

Config Init events

Recommended Posts

Hi,

I've been running some test in Multi Player. For addons that launch scripts and functions at the start of a mission. Not being to familiar with MP I thought I would post my test scripts and the result, to see if anyone can confirm the validity of the test and the conclusions I came to.

The test mission comprises of a manned, ungrouped M2 machine gun. So it should be considered local to the server. The server is a remote, dedicated server, run over the internet with just one person connected.

The M2 has the following in it's config.cpp:

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

       {

       init="RKSL_InitEvent=LoadFile ""\RKSL_MPGetInEvent\S\RKSLInitEvent.sqf""; [_This Select 0] Call RKSL_InitEvent";

       };

RKSL_InitEvent.sqf is a function containing the following code:

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

_Vehicle=_This Select 0;

RKSL_INITCALLED=True;

PublicVariable "RKSL_INITCALLED";

RKSL_VEHICLE=_Vehicle;

PublicVariable "RKSL_VEHICLE";

If (Local _Vehicle) Then {RKSL_LOCAL=True; PublicVariable "RKSL_LOCAL"};

If !(Local _Vehicle) Then {RKSL_REMOTE=True; PublicVariable "RKSL_REMOTE"};

If (Player==Player) Then {RKSL_PLAYER=Player; PublicVariable "RKSL_PLAYER"};

If !(IsNull (Group _Vehicle)) Then {RKSL_GROUP=Group _Vehicle; PublicVariable "RKSL_GROUP"};

[_Vehicle] Exec "\RKSL_MPGetInEvent\S\RKSLInitEvent.sqs";

RKSLInitEvent.sqs, which is called at the end of the function contains:

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

~0.001

RKSL_INITCALLED1=True

PublicVariable "RKSL_INITCALLED1"

RKSL_VEHICLE1=_Vehicle

PublicVariable "RKSL_VEHICLE1"

If (Local _Vehicle) Then {RKSL_LOCAL1=True; PublicVariable "RKSL_LOCAL1"}

If !(Local _Vehicle) Then {RKSL_REMOTE1=True; PublicVariable "RKSL_REMOTE1"}

If (Player==Player) Then {RKSL_PLAYER1=Player; PublicVariable "RKSL_PLAYER1"}

If !(IsNull (Group _Vehicle)) Then {RKSL_GROUP1=Group _Vehicle; PublicVariable "RKSL_GROUP1"}

RKSL_INITCALLED and RKSL_VEHICLE where just used to confirm everything was working ok.

Player==Player was used as a condition to confirm the command player and ensure the server side execution of the scripts did not corrupt the results. As player always returns an invalid result on a dedicated server. Player==Player will only ever be true on the client.

The content of the global variables used, were displayed using Radio triggers once the mission had started. Global variables with the post fix of 1, were used to differentiate between the outputs from the function and script. The results were as follows:

RKSL_InitEvent.sqf (Outputs the variables RKSL_INITCALLED,RKSL_VEHICLE...e.t.c):

Quote[/b] ]Vehicle: WEST Charlie Black:1 REMOTE

Init Called: true

Local: true

Remote: scalar bool array string 0xfcffffef

Player: scalar bool array string 0xfcffffef

Group: scalar bool array string 0xfcffffef

RKSLInitEvent.sqs (Outputs the variables RKSL_INITCALLED1,RKSL_VEHICLE1...e.t.c):

Quote[/b] ]Vehicle: WEST Charlie Black:1 REMOTE

Init Called: true

Local: true

Remote: true

Player: WEST Alpha Black:1 (Player)

Group: WEST Charlie Black

From the above results I came to the following conclusions (some of them are obvious but I will state them anyway):

Vehicle:

This is always flagged as REMOTE, even though both scripts were called on the Server and the players machines. All this confirms is the players client is the last one to execute the scripts, so in this case it overwrites the output from the server.

Init Called:

This just confirms the scripts were run.

Local:

This value can only be set by the server, and confirms the scripts were run on server.

Remote:

This was used to see if the Local command works when being called on the client. In theory when the init function is executed by the client, RKSL_REMOTE should have returned a value of True, as the unit was local to the server only. But as you see it returned the scalar bool...error, which indicates the variable was never initialised. So the Local command always returns True, regardless of being called on a server or a client. In other words it's pointless doing a check on locality, within a function called from the init event. I can also assume that the following will also act the same way a function does when called from a config:

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

       {

       init="If !(Local (_This Select 0)) Then {RKSL_REMOTE=True; PublicVariable ""RKSL_REMOTE""}";

       };

This only applies to the function. When called by RKSLInitEvent.sqs, everything worked as expected and the value of RKSL_REMOTE1 was set to True.

Player:

The same applies for the player command. As expected on the server, RKSL_PLAYER is never initialised. But you might have expected it to work on the clients machine. However, when called via a function during mission start-up it doesn't. When called from RKSLInitEvent.sqs, everything worked as expected. The global variable RKSL_PLAYER1, returned the correct value.

Group:

Again, here the RKSL_GROUP variable was never initialised in the function, so it can be assumed the Group command will never return a valid result when called via a function during mission start-up. But does so, when called via the script RKSLInitEvent.sqs, as seen in the output for the variable RKSL_GROUP1.

Just to reiterate the point. This test was conducted during the start of a MP mission. If I had created the unit using the CreateVehicle command, once the mission was underway. I would expect both the function and the script to work properly, and both return the same results. I will try and test this later on, just to make sure.

You can avoid all these problems if you never call sqf functions from an addons init event. However it is useful in some cases to call functions from an init event, so I thought I would post the results here for anyone else who might want to do so. Any comments or suggestions on how to improve this test, errors or oversights on my part. Then please let me know.

Cheers

Share this post


Link to post
Share on other sites

Thanks a lot for testing, I'll check later what we can put into the wiki (if nobody else did it till then) smile_o.gif

Share this post


Link to post
Share on other sites

Thanks raedor, I'm slowly getting to grips with editing the Wiki. I don't want to go diving in, without any idea on how best to maintain a consisent format.

I also wanted to test how the AddEventHandler command works when used in functions from a configs init event. As I can't do a test for locality, I'm worried I might be adding multiple copies of the same event handler. Only, I don't know how to test for this atm. So if anyone has any ideas, please post them here.

Share this post


Link to post
Share on other sites
Thanks raedor, I'm slowly getting to grips with editing the Wiki. I don't want to go diving in, without any idea on how best to maintain a consisent format.

I also wanted to test how the AddEventHandler command works when used in functions from a configs init event. As I can't do a test for locality, I'm worried I might be adding multiple copies of the same event handler. Only, I don't know how to test for this atm. So if anyone has any ideas, please post them here.

Hm, I don't see the problem? Multiple copies on one client (how that)? Or multiple copies as the init EH is executed per vehicle on the map? Or one copy on each client (that's what should happen with init EH)... well, just give me an example and I hope I see the problem then wink_o.gif

Share this post


Link to post
Share on other sites

Perhaps I misread the Wiki desription for:

arguments_global.gif

I thought when you add an EventHandler using AddEventHandler to an Object. It applies it across all the clients and the server?

Or does the:

effects_local.gif

Mean only the computer local to the object that calls the command, AddEventHandler has the event applied?

If that makes sense?

In other words I'm trying to work out if I need to use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If (Local _Object) Then {_Object AddEventHandler ["getin",{}]}

Or can I just use:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Object AddEventHandler ["getin",{}]

Cheers

Share this post


Link to post
Share on other sites

addEventhandler is executed locally, so if you execute it in an init EH you'll add one EH on each client (as addEH will be executed once on each client due to the init EH which is executed globally).

If you're using<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If (Local _Object) Then {_Object AddEventHandler ["getin",{}]}you'll add the EH only on one client, as _object can't be local on more than one client.

In the wiki arguments_global.gif means "global arguments" and effects_local.gif means "local effect" (in the wiki you can also click on the buttons and read the description).

Share this post


Link to post
Share on other sites

I noticed your player == player check, which you said

should indicate if ded server or not.

Quote[/b] ]Player==Player was used as a condition to confirm the command player and ensure the server side execution of the scripts did not corrupt the results. As player always returns an invalid result on a dedicated server. Player==Player will only ever be true on the client.

What were your results about that and did you check this

one really?

I ask because: comparing two equal things should always

return true no matter if it is comparing valid stuff or invalid.

If player returns something like: <obj-null> and you compare

it to player which returns <obj-null> it should even be true

on a dedicated server.

I didn't look the other stuff yet, but if i get more time i will do

so.

~S~ CD

Share this post


Link to post
Share on other sites

It wasn't so much as to check for a dedicated server, although I guess you could use it that way? But to confirm the command Player. Always returns null when called within the scope of a function on a client, from the init event. When you call a function directly from an init event certain commands don't appear to work the same way they would if called from a script.

Player==Player is based on the desription of ObjNull in the wiki:

Quote[/b] ]Non-existent object. This value is not equal to anything, not even to itself.

Perhaps I could also have used:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(IsNull Player) Then {RKSL_ISSERVER=True}

I will check to see if this will return True, as it could just be a case of Player returning the Scalar bool error on a dedicated server? In which case it would always return false, regardless of the "not" condition.

Share this post


Link to post
Share on other sites

I did a check yesterday, alone and in the MP Editor, player returns null and that's why player != player. Just write <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hint format ["%1\n%2", player, player == player] in the initline of the player and test.

player == player with player = <null> is only true if you compare the strings, like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">format ["%1", player] == format ["%1", player]that's the ususal method to check if a variable is undefined (you'll find it in most of the addon init scripts). As UNN said, that's because objNull is not even equal to itself.

It indeed is possible to check a ded server with:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hint format ["%1\n%2", player, player == player] in the initline I've been using it, it works quite fine.

Share this post


Link to post
Share on other sites

initEH in "all" units

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">init = "_this exec{\WGLEvents\WGLinit.sqs};

wglinit.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WGLMPgame={playersNumber _x>0}count[east,west,resistance,civilian]>0

~1

?(player!=player)&&WGLMPgame:WGLdedy=true

notice the name of the gv's wink_o.gif

Share this post


Link to post
Share on other sites
It wasn't so much as to check for a dedicated server, although I guess you could use it that way? But to confirm the command Player. Always returns null when called within the scope of a function on a client, from the init event. When you call a function directly from an init event certain commands don't appear to work the same way they would if called from a script.

Player==Player is based on the desription of ObjNull in the wiki:

Quote[/b] ]Non-existent object. This value is not equal to anything, not even to itself.

Perhaps I could also have used:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(IsNull Player) Then {RKSL_ISSERVER=True}

I will check to see if this will return True, as it could just be a case of Player returning the Scalar bool error on a dedicated server? In which case it would always return false, regardless of the "not" condition.

Well, that makes sense you're right UNN. smile_o.gif

~S~ CD

Share this post


Link to post
Share on other sites
Quote[/b] ]In the wiki means "global arguments" and  means "local effect" (in the wiki you can also click on the buttons and read the description).

I see, thanks. Just out of curiosity, are there commands that require local arguments? I tried doing a search for arguments_local.gif to see if anything linked to the image, but that didn't seem to work.

@Q

Thanks for confirming that. What scenarios do you need to check for just the dedicated server? I'm just starting to delve deeper in the MP side. So I'm sure I will hit this issue at some point.

I did some more testing with the AddEventHandler commands for the Getin events. I know Raedor already stated they were local, but I wanted to see if I could repeat the results with a simple test script. That’s seems to be half the battle with MP, trying to work out how to accurately test these things. I finally devised a suitable test, which confirmed the results, no surprises there. But I did hit upon another issue, that was relevant to what I'm trying to do.

Again it's down to the behaviour of commands within the scope of a function, launched from the init event. What I found was, if you add a getin event handler using a init event function, it's actually called by OFP for manned units placed in the editor. If you add the event from a script, then it isn't called by default.

Ok, so again this is probably not that important to most people. But it helps to gain a better picture of how OFP starts a MP game. At the very instance an MP game is started i.e when players enter the briefing screen. OFP does the following:

Creates all the manned vehicles.

Creates all the crew for the manned vehicles, but does not move them into the their respective vehicles.

Executes all the single line commands and functions in the above units init events.

Allocates any event handlers in the config or those added via functions or directly by the configs init event.

Now at this point, no groups have been allocated, everything is considered local to the server and no player variables have been initialised. In addition, no scripts (*.sqs) have been run either. I can also assume commands such as Driver,Gunner e.t.c won't return any values and probably a few other commands as well as those we already mentioned?

The next stage must then go something like:

Move all the crews into their allocated vehicles.

Assign the groups to each vehicle and units.

Assign the Player variables.

Execute any getin events assigned.

Execute any scripts contained within the init events of the above units, until a ~ is encountered.

Enable commands like Group, Local, Gunner e.t.c

The final stage kicks in when the players leave the briefing screen and enter the game. At this point, any scripts that were paused because of the ~, are allowed to continue.

Most of the above is just speculation on my part, as there is to much for me to test just yet. Also the elements contained in each stage are written in no particular order.

The reason I started all this testing was, I encountered some problems with a getin event allocated in a function, from the init event. The code in the getin events for manned vehicles was actually being executed without me knowing about it. What’s more, commands like Local and Gunner, where not returning valid results, because of the timing of functions and init events. This is stuff that will probably never be used by 99.9% of people scripting OFP. But I thought I would post it for the 0.1% like me, who might be encountering problems without realising why.

Share this post


Link to post
Share on other sites

The getin EHs are executed globally, only addEventhandler is local. I don't know (but I guess that) whether the EH is executed only where the vehicle is local, as if it is executed globally on every client the script would run in multiple instances... hmmh, more to test smile_o.gif

@Init: I think it is quite the way you say, but not exact that order: As we saw that player is unavailable when init lines get executed, it has to be more or less that order:

Execute any scripts contained within the init events of the above units, until a ~ is encountered.

Move all the crews into their allocated vehicles (and enable driver etc).

Assign the groups to each vehicle and units (and enable group command).

Assign the Player variables.

Execute any getin events assigned.

Share this post


Link to post
Share on other sites

@Init

There's another thing i noticed once when trying to create

arrays with subarrays containing units or vehicles from

their init fields or from init.sqs.

- init fields are executed before init.sqs

:well that might not be something new

- init fields get executed in logical order of: first unit being

placed onto the map = first init field being executed

:again - nothing new

- init fields of EAST units become executed before WEST unit's init fields

:that was new to me and i think it is related to alphabetical

order.

I was always in the meaning of first unit placed (no matter

which side) - first init field executed.

East starts with E while West with W and thus it's later in the

alphabet - i must admit i didn't test with Resistance or Civ's

yet which would probably confirm my theory or smash it again. biggrin_o.gif

~S~ CD

Share this post


Link to post
Share on other sites

Probably it's not the alphapetical order, it is more the config value of side (east is 0, west 1 etc.) wink_o.gif

/edit: btw: so far I only knew the first point (init lines before init.sqs). whistle.gif

Share this post


Link to post
Share on other sites
Probably it's not the alphapetical order, it is more the config value of side (east is 0, west 1 etc.) wink_o.gif

/edit: btw: so far I only knew the first point (init lines before init.sqs). whistle.gif

That's a good point Raedor - i'm gonna check it out today

when back home from work. smile_o.gif

~S~ CD

Share this post


Link to post
Share on other sites

OK, done what i've said;

I've tested in which order the init fields and the init.sqs

become executed and here's the result in ascendending

order:

East

West

Resistance

Civilian

Gamelogic

Empty Objects

Init.sqs

Trigger (with condition: true)

~S~ CD

Share this post


Link to post
Share on other sites

And that is exactly the order from the config:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7 smile_o.gif

Share this post


Link to post
Share on other sites

Yep, just thought it's good to check the other remaining

ones aswell like: triggers empty/objects and init.sqs.

~S~ CD

Share this post


Link to post
Share on other sites
Yep, just thought it's good to check the other remaining

ones aswell like: triggers empty/objects and init.sqs.

~S~ CD

Sure, thanks for testing, btw! Just wanted to put the config thing here to show that it is the same wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]@Init: I think it is quite the way you say, but not exact that order: As we saw that player is unavailable when init lines get executed, it has to be more or less that order:

In a way, it probably does not matter that much. But I did a quick change on RKSLInitEvent.sqs:

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

RKSL_INITCALLED1=True

PublicVariable "RKSL_INITCALLED1"

RKSL_VEHICLE1=_Vehicle

PublicVariable "RKSL_VEHICLE1"

If (Local _Vehicle) Then {RKSL_LOCAL1=True; PublicVariable "RKSL_LOCAL1"}

If !(Local _Vehicle) Then {RKSL_REMOTE1=True; PublicVariable "RKSL_REMOTE1"}

If (Player==Player) Then {RKSL_PLAYER1=Player; PublicVariable "RKSL_PLAYER1"}

~0.001

If !(IsNull (Group _Vehicle)) Then {RKSL_GROUP1=Group _Vehicle; PublicVariable "RKSL_GROUP1"}

Moving the ~ did not effect the result of RKSL_PLAYER1, it still returned the correct value. So it looks like it's initialised before any *.sqs's are launched?

@Chris

Thats a handy thing to know. It's a pity that side Tlogic isn't set at 0. That way you could use it to initialise arrays e.t.c

I did some similar tests, to prove the config init events fire off before the init fields and init.sqs. In the past I have had some problems making that assumption. I like to use functions from the init field, sometimes I found them being called before the init events of configs, but that was in the past so I can't be sure I was making some mistake. Only now, have I started to get a better idea of what’s going on. But I was wondering:

If you had say a hundred units all with commands in their init fields and config init events, would all of those commands in the config be executed in the correct order before progressing on to the init fields and finally the init.sqs? The test's I've done so far have always been with one or two units o the same side. How many units did you try?

Edit:

Quote[/b] ]The getin EHs are executed globally, only addEventhandler is local. I don't know (but I guess that) whether the EH is executed only where the vehicle is local, as if it is executed globally on every client the script would run in multiple instances... hmmh, more to test

Yeah thats what worried me. I did some quick tests, and it appeared as though the getin event handler was executed localy. But it's hard for me to say so for sure. As the unit getting into a vehicle is global, the event should be tiggered on all machines. I think I need to devise a test where a unit is created localy with camcreate then moved into a vehicle. But I'm not sure it's possible, like I said accurate tests seem to be half the battle confused_o.gif

Share this post


Link to post
Share on other sites

::edit - to test the locality of the EH you'd maybe better

try to find a second player and test it with him getting in

and you to check wether it was local to him only or global

to you too ::edit end

:edit - yes - i've been testing with more than 100 units now

and it didn't change the outcome of the results :edit end

So i've continued testing and added 5 more events to check.

- script started from init field of a unit

:note - it doesn't matter from which unit's init field,

the result was always the same  in order of when

which type gets executed first.

- script started from init.sqs

- script started by waypoint scripted

:note - wp scripted scripts execute once a unit's next waypoint is the wp type scripted.

Therefore i've made the very first waypoint of a unit

type scripted.

- script started by normal waypoint placed right on top

of the unit.

- the onActivation field of a waypoint

------------------------------------------------------#

Now we got to make a new list again in ascendending order;  smile_o.gif

- East

- West

- Resistance

- Civilian

- Gamelogic

- Empty Object

- Script (started from init field)

- Init.sqs

- Script (started from init.sqs)

- Trigger (condition true)

- Script (started by waypoint scripted)

- OnActivation field of a waypoint (placed on top of unit)

- Script (started from onActivation field of a waypoint)

Now something weird occured too;

Two times the trigger became executed last.

The only thing i can say about it is:

It happened after changing something in editor

e.g: delete a waypoint or a group here and/or add a waypoint

or group there.

I could not recreate the triggers execution at the end by

intension but i can confirm that it was not just a fata morgana

(thought that first), because it happened twice (not twice in a row though).

Now i've also tried to test same type of waypoints on several

groups which ended in the result that: first group being placed, first waypoint being executed.

Well, these were the initialisation test results i got, but then

i started testing something else and now i really got some

headache.  crazy_o.gif

Maybe this is getting a bit off the thread's initial purpose,

if so tell me and i/we can make this somewhere seperate

in mission/editing - but i thought it would fit here, when

we're already at initialisation of everything.

A trigger's list and which unit is located where in that list:

First i must admit i'd be very thankful if someone else hops

onto this train, because at the moment i feel little bit outburned from getting weird results on that one.

I've made a trigger: 550/550 activation: anybody/present

First try:

player (west)

east soldier

resistance soldier

civilian

gamelogic

The result was along the init field rules we found and along

what Raedor said about how it's set in config.

But considering Raedor's post i thought about the unknown,

which is before gamelogic in config defined.

So i added a single east unit and put it out of sight from

player.

result was:

same like above just with the new east unit at the end

Then things went crazy - i thought that maybe it's again because of first placed first counted, and exchanged

the two east units.

result was - in the trigger's list the east units were also exchanged which means that the formerly first unit of the

list was now at the end and the formerly last one at the

beginning of the list.

I later found out that moving units around and changing

positions in relation to the player and/or the trigger's

center everytime has taken some influence on how the

trigger's list was built up.

At the end i couldn't find out why or how the trigger's list

was built up but i will not give up finding out - *hint* here's

the point i mentioned above where maybe somebody else

can jump on the train to find that out too.  help.gif

~S~ CD

Share this post


Link to post
Share on other sites
Quote[/b] ]to test the locality of the EH you'd maybe better

try to find a second player and test it with him getting in

and you to check wether it was local to him only or global

to you too

Yeah, but atm it's easier to test this with the Server.exe running on the same machine I run OFP on. My initial test results were on a proper dedicated server. I feel confident for now, as they both behave the same way. As the results of the initial test were consistent when using both a dedicated server and the local server.exe. I will get the opportunity to try it with more than one player, once I've fixed the addon that instigated all my testing.

Quote[/b] ]Maybe this is getting a bit off the thread's initial purpose,

if so tell me and i/we can make this somewhere seperate

in mission/editing - but i thought it would fit here, when

we're already at initialisation of everything.

I was a bit to specific with the original thread title, as I was leading up to testing the getin event. This is exactly the sort of information I wanted to gather in one place. I never thought to test things like waypoints and triggers.

Quote[/b] ]First i must admit i'd be very thankful if someone else hops

onto this train, because at the moment i feel little bit outburned from getting weird results on that one.

At this point I'm happy just to confirm waypoints and triggers are the last events to be called. I certainly plan on re-visiting this in the future, as I want to analyze things like group waypoints, in real time in an MP environment. Only, I'm also feeling a little swamped by all the possible connotations of MP, so I need to concentrate on fixing the problem I have with init & getin events. If it's possible for you to make your test mission available, I can certainly run it and let you know the results. If that’s any help?

I just wanted to add  that I did try this as a quick experiment for the getin event:

Added to the end of RKSLInitEvent.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If (Local _Vehicle) Then {_Vehicle AddEventHandler ["getin",{If ((_This Select 2)==Player) Then {RKSL_GETINEVENT1=Player; PublicVariable "RKSL_GETINEVENT1"} Else {RKSL_GETINEVENT=True; PublicVariable "RKSL_GETINEVENT"}}]}

The above code should in theory only add the event to the server. When I ran the mission and got in as a player. RKSL_GETINEVENT returned true and RKSL_GETINEVENT1 returned the scalar bool error. So the getin event was never called on the client, just the server.

To confirm this, I reversed the test. Adding the event just to the client:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If !(Local _Vehicle) Then {_Vehicle AddEventHandler ["getin",{If ((_This Select 2)==Player) Then {RKSL_GETINEVENT1=Player; PublicVariable "RKSL_GETINEVENT1"} Else {RKSL_GETINEVENT=True; PublicVariable "RKSL_GETINEVENT"}}]}

As expected, the result were reversed. RKSL_GETINEVENT returned the scalar bool error and RKSL_GETINEVENT1 returned the players info.

Share this post


Link to post
Share on other sites

I see what your getting at, I will have a play around and post anything worthwhile, over there.

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  

×