Jump to content
Sign in to follow this  
Messiah

scripts that cause flashpoint to crash in MP

Recommended Posts

we've been using an addon that uses some scripting to decide some of the uses the gunner of the vehicle has.

recently we've been having flashpoint lock ups and restarts when the gunner of the vehicle gets out, or when he gets out and then starts to shoot people...

its rather bizarre, so i've posted up the scripting to see if its MP friendly at all, and what can be done?

<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

?!alive _vehicle:exit

_rnd = random 100

_type = typeof _vehicle

#start

@!(isnull gunner _vehicle)

~0.1

#gunner

?((gunner _vehicle) hasweapon "ukf_sa80") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_sa80") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_sa80ag36") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_lsw") : goto "lsw"

?((gunner _vehicle) hasweapon "ukf_lmg") : goto "lmg"

?((gunner _vehicle) hasweapon "ukf_lmgsusat") : goto "lmg"

?_rnd < 50 : goto "lsw"

#lmg

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

_vehicle addWeapon "ukf_min_mounted"

_vehicle setObjectTexture [14, "\ukf_snatch\m249acc.pac"]

_vehicle setObjectTexture [15, "\ukf_snatch\m249.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

@((isNull gunner _vehicle)||!(alive (gunner _vehicle))||!(alive _vehicle))

?!alive _vehicle:exit

goto "nogunner"

#lsw

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

_vehicle addWeapon "ukf_lsw_mounted"

_vehicle setObjectTexture [25, "\ukf_ukweps\lsw\l86foregrip.pac"]

_vehicle setObjectTexture [26, "\ukf_ukweps\lsw\lswbipod.pac"]

_vehicle setObjectTexture [27, "\ukf_ukweps\lsw\lswblack.paa"]

_vehicle setObjectTexture [28, "\ukf_ukweps\lsw\lswforegrip2.pac"]

_vehicle setObjectTexture [29, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [30, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [31, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [32, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [33, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [34, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [35, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [36, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

@((isNull gunner _vehicle)||!(alive (gunner _vehicle))||!(alive _vehicle))

?!alive _vehicle:exit

goto "nogunner"

#sa80

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

_vehicle addweapon "UKF_sa80_Mounted"

_vehicle setObjectTexture [16, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [17, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [18, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [19, "\ukf_ukweps\sa80\foregrip.pac"]

_vehicle setObjectTexture [20, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [21, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [22, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [23, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [24, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

@((isNull gunner _vehicle)||!(alive (gunner _vehicle))||!(alive _vehicle))

?!alive _vehicle:exit

#nogunner

_vehicle removeWeapon "ukf_min_mounted"

_vehicle removeweapon "UKF_sa80_Mounted"

_vehicle removeweapon "UKF_lsw_Mounted"

_vehicle setObjectTexture [14, ""]

_vehicle setObjectTexture [15, ""]

_vehicle setObjectTexture [16, ""]

_vehicle setObjectTexture [17, ""]

_vehicle setObjectTexture [18, ""]

_vehicle setObjectTexture [19, ""]

_vehicle setObjectTexture [20, ""]

_vehicle setObjectTexture [21, ""]

_vehicle setObjectTexture [22, ""]

_vehicle setObjectTexture [23, ""]

_vehicle setObjectTexture [24, ""]

_vehicle setObjectTexture [25, ""]

_vehicle setObjectTexture [26, ""]

_vehicle setObjectTexture [27, ""]

_vehicle setObjectTexture [28, ""]

_vehicle setObjectTexture [29, ""]

_vehicle setObjectTexture [30, ""]

_vehicle setObjectTexture [31, ""]

_vehicle setObjectTexture [32, ""]

_vehicle setObjectTexture [33, ""]

_vehicle setObjectTexture [34, ""]

_vehicle setObjectTexture [35, ""]

_vehicle setObjectTexture [36, ""]

_vehicle setObjectTexture [37, ""]

?(isnull gunner _vehicle) : goto "close"

?!(alive _vehicle) : exit

?!(alive (gunner _vehicle)) : goto "deadgunner"

#close

_vehicle setObjectTexture [5, ""]

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [4, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [4, "\UKF_Snatch\softg.pac"]

?alive _vehicle:goto"start"

exit

#deadgunner

@(alive (gunner _vehicle))

goto "start"

none of these errors occur in SP, so im guessing theres problems with the vehicles updating their information for everyone?

help.gif

Share this post


Link to post
Share on other sites

A few things come to mind:

* If this script runs on every machine in MP, it needs to have all addWeapon and removeWeapon calls "padded" one way or another so as to only issue those commands on one machine - the machine that vehicle is local to. I recall nasty crashes from issuing these indiscriminately in a MP situation.

* Now, if the script doesn't run on every machine in MP, it should - setObjectTexture only has an effect on the machine it is issued on.

* The random call will give a different result one every computer in MP, meaning that

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_rnd < 50 : goto "lsw"will have each instance of the script choosing it's own execution path when running.

Share this post


Link to post
Share on other sites

the script should run on each machine - its executed from the start of the vehicle's placement, and waits for a gunner to get in, and then works continually till the vehicle dies. How would i go about 'padding' the script?

the setobject texture actually works perfectly for once - our deployable cam nets on the wmiks dont work in MP (any fix?) because of that issue, but the weapons appearing seemed to work very well in this instance.

so if i get you right, each pc will execute the random part and get its own number? aaach... obviously not good, but that doesnt 'seem' to be the part it crashes on, only when the guy gets out.

you know my ability of scripting fella

banghead.gif

Share this post


Link to post
Share on other sites

some futher testing apparently revealed that most of the crashes occur once the vehicle itself is damaged... but thats not 100% conclusive yet.

in the two last beta's, the wheel damage went up a hell of alot, so anyone who was playing with the wrong version would have crashed us all out when the tyres were shot - is there a limit on tyre 'strength'? Our's are set at 50 compared to the overall vehicle at 100, to simulate run flat tyres.

[edit]

after further testing, it seems the mission was causing the crashes which is bizarre - basically occured whenever a human player was killed.

never-the-less, killswitch, if you think the script could do with some MP streamlining and tidying up, i'd apprecaite any help or guidelines?

Share this post


Link to post
Share on other sites

By "padding" I meant to have each line that issues either removeWeapon or addWeapon have a locality check, eg instead of

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

#nogunner

_vehicle removeWeapon "ukf_min_mounted"

_vehicle removeweapon "UKF_sa80_Mounted"

_vehicle removeweapon "UKF_lsw_Mounted"

...you'd have

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

#nogunner

?local _vehicle: {_vehicle removeWeapon _x} forEach ["ukf_min_mounted","UKF_sa80_Mounted","UKF_lws_Mounted"]

...and similar locality checks elsewhere in the code, where applicable.

On a more general note, I see that this script seems to be a constantly-running monitor script. That's a pre-1.85 CPU wastage offence of the Good OFP Coding Practices Bill and any such scripts should be taken out and shot until it's dead. tounge2.gif

Have you considered using the getin and getout events to trigger whatever it is that the above script does? Saves on precious CPU time, see. That's The Proper Thing To Do.

Doing that won't solve the CTD issue until you've found the reason, but it's more than recommended to refactor the code to use OFP's event handler framework if at all possible.

Share this post


Link to post
Share on other sites

the eventhandler path had occured to me recently, and im implementing it now - thanks for the padding examples.

the CTD are bizarre as we're mightly struggling to work out whats causing them - but it seems to be this addon, and the only thing i can think of would be the intense amount of scripting.

even with the eventhandlers, I'd still have to have one of those 'shoot it till its dead' scripts checking if the gunner's dead, to enact that part of the script... no?

Share this post


Link to post
Share on other sites
even with the eventhandlers, I'd still have to have one of those 'shoot it till its dead' scripts checking if the gunner's dead, to enact that part of the script... no?

Mabye not - one could possibly use a/the getin event handler to add a killed event handler to the gunner to handle that particular case. The problem with that approach, though, is of course that the killed event is "BIS'd"...in other words - the killed event isn't broadcast, but is only issued on the machine where the gunner is local. Oh OFP... banghead.gif

However, the killed event being limited in reach might not matter, in this case. I need to read the code closer...

EDIT 2: Crap...upon gunner croaking, there are a number of setObjectTexture:s to be done (which need to be issued on all machines, not just the one where the gunner is local). Drats.

Really, honestly...was the decision to make the killed event not be broadcast made on a Monday after a particulary tough weekend of bar hopping in Prague? One wonders... Oh OFP... goodnight.gif

Share this post


Link to post
Share on other sites

ok...

one thing i have hit a wall on as i write the new scripts is that of course the get in and out events will be triggered by anyone entering or leaving the vehicle.

now, i've added a condition checking if there's a gunner or not for the start of the script and if there is, it starts doing the process of adding weapons:

<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

?!alive _vehicle:exit

_type = typeof _vehicle

#start

?(isnull gunner _vehicle) : exit

but what if a driver gets into a vehicle already containing a gunner, as the script would then run again - granted it shouldnt make a difference seeing as it will select the same weapin again, but preventing it would be useufl...

are there ways to check whom triggered the get in and where he's now sat?

[edit]

just saw your edit - thing is though, the gun removal works amazingly well in MP even with how badly setobjecttexture works in MP (apparently) - suprisingly this is the one part of the code thats worked really well so far.

Share this post


Link to post
Share on other sites

You could add a dummy-animation to the vehicle, which is set to 1 if a gunner is inside and 0 if not.

Then have the scripts check for the animphase and that should do the trick.

Share this post


Link to post
Share on other sites
are there ways to check whom triggered the get in and where he's now sat?

Oh my yes...that's the beauty of the getin/getout events - the second argument your EH gets is the position:

The getin and getout events hand off the following arguments to an event handler in the "_this" variable:

[ object: vehicle, string: position, object:: unit ]

The second parameter is a string that is one of "driver", "gunner", "commander" or "cargo". Neat, huh? smile_o.gif

PS: On the custom animation suggestion - no go. Reason is that it will not work properly on dedicated servers. Why? The <span style='color:red'>animationState command is broken</span> too - when issued on dedicated servers it will always return the result 0, no matter what actual state the animation is in.

Share this post


Link to post
Share on other sites
You could add a dummy-animation to the vehicle, which is set to 1 if a gunner is inside and 0 if not.

Then have the scripts check for the animphase and that should do the trick.

genius - i've used something similiar on another addon - forgotten about that smile_o.gif

Quote[/b] ]Oh my yes...that's the beauty of the getin/getout events - the second argument your EH gets is the position:

The getin and getout events hand off the following arguments to an event handler in the "_this" variable:

[ object: vehicle, string: position, object:: unit ]

The second parameter is a string that is one of "driver", "gunner", "commander" or "cargo". Neat, huh?

aaah - amazing! Will carry on writing the scripts.

is it possible to then check the second argument against a pre determined one? i.e (really off the top of my head now):

<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

_position = _this select 1

_unit = _this select 2

?(_position == gunner)

or

?(_unit == (gunner _vehicle))

i think the 2nd seems more sensible? Although perhaps my scripting is a little naive in terms of hopeing that it would be so simple?

[edit] damn all these edits - lol

that animationphase thing would explain alot about why another addon's MP dsiableing hasnt worked - lol

on the setobjecttexture - how would one go about making sure it executes on all clients?

Share this post


Link to post
Share on other sites
is it possible to then check the second argument against a pre determined one?
Yes, as the parameter type states (a string), you would do a string comparison:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(_this select 1)=="gunner": hint "Welcome Mr Gunner"

Quote[/b] ]that animationphase thing would explain alot about why another addon's MP dsiableing hasnt worked - lol
Yep. Funky animations as state variables are a neat idea...for SP. Actually, since animations don't "play" unless you look at them (with a few exceptions), they are kind of useless both in MP and SP. That means there's a lot of addons out there that will plain just not ever really work in MP. A shame, since they are so purdy. sad_o.gif
Quote[/b] ]on the setobjecttexture - how would one go about making sure it executes on all clients?
Doing it on either a getin or getout event is fine, since they are (AFAIK) broadcast. The one remaining hurdle is to signal a slew of setObjectTexture:s upon gunner meeting his maker... lemme think...

Share this post


Link to post
Share on other sites
is it possible to then check the second argument against a pre determined one?
Yes, as the parameter type states (a string), you would do a string comparison:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(_this select 1)=="gunner": hint "Welcome Mr Gunner"

Quote[/b] ]that animationphase thing would explain alot about why another addon's MP dsiableing hasnt worked - lol
Yep. Funky animations as state variables are a neat idea...for SP. Utterly useless in MP. That means there's a lot of addons out there that will plain just not ever really work in MP. A shame, since they are so purdy. sad_o.gif
Quote[/b] ]on the setobjecttexture - how would one go about making sure it executes on all clients?
Doing it on either a getin or getout event is fine, since they are (AFAIK) broadcast. The one remaining hurdle is to signal a slew of setObjectTexture:s upon gunner meeting his maker... lemme think...

cheers fella - im still writing the get in one and then the get out one just now - the large amount of setobjecttextures for when he dies/gets out was because it seemed alot easier to me to set all ofthem invisible that to carry on checking what weapon he did have etc.

[edit]

ok, so far this is how it stands without any testing as yet - wasnt as much work as i had imagined to get this turned around. Can you just check i've implemented thos local checks with the add/remove weapon parts:

<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

?!alive _vehicle:exit

_type = typeof _vehicle

#start

?(isnull gunner _vehicle) : exit

?!(_this select 1)=="gunner" : exit

#gunner

?((gunner _vehicle) hasweapon "ukf_sa80") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_sa80") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_sa80ag36") : goto "sa80"

?((gunner _vehicle) hasweapon "ukf_lsw") : goto "lsw"

?((gunner _vehicle) hasweapon "ukf_lmg") : goto "lmg"

?((gunner _vehicle) hasweapon "ukf_lmgsusat") : goto "lmg"

#lmg

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

?local _vehicle: {_vehicle addWeapon _x} forEach ["ukf_min_mounted"]

_vehicle setObjectTexture [14, "\ukf_snatch\m249acc.pac"]

_vehicle setObjectTexture [15, "\ukf_snatch\m249.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#lsw

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

?local _vehicle: {_vehicle addWeapon _x} forEach ["ukf_lsw_mounted"]

_vehicle setObjectTexture [25, "\ukf_ukweps\lsw\l86foregrip.pac"]

_vehicle setObjectTexture [26, "\ukf_ukweps\lsw\lswbipod.pac"]

_vehicle setObjectTexture [27, "\ukf_ukweps\lsw\lswblack.paa"]

_vehicle setObjectTexture [28, "\ukf_ukweps\lsw\lswforegrip2.pac"]

_vehicle setObjectTexture [29, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [30, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [31, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [32, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [33, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [34, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [35, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [36, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#sa80

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

?local _vehicle: {_vehicle addWeapon _x} forEach ["UKF_sa80_Mounted"]

_vehicle setObjectTexture [16, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [17, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [18, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [19, "\ukf_ukweps\sa80\foregrip.pac"]

_vehicle setObjectTexture [20, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [21, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [22, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [23, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [24, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

and the getting out one:

<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

?!alive _vehicle:exit

_type = typeof _vehicle

#start

?!(isnull gunner _vehicle) : exit

?!(_this select 1)=="gunner" : exit

#nogunner

?local _vehicle: {_vehicle removeWeapon _x} forEach ["ukf_min_mounted","UKF_sa80_Mounted","UKF_lsw_Mounted"]

_vehicle setObjectTexture [14, ""]

_vehicle setObjectTexture [15, ""]

_vehicle setObjectTexture [16, ""]

_vehicle setObjectTexture [17, ""]

_vehicle setObjectTexture [18, ""]

_vehicle setObjectTexture [19, ""]

_vehicle setObjectTexture [20, ""]

_vehicle setObjectTexture [21, ""]

_vehicle setObjectTexture [22, ""]

_vehicle setObjectTexture [23, ""]

_vehicle setObjectTexture [24, ""]

_vehicle setObjectTexture [25, ""]

_vehicle setObjectTexture [26, ""]

_vehicle setObjectTexture [27, ""]

_vehicle setObjectTexture [28, ""]

_vehicle setObjectTexture [29, ""]

_vehicle setObjectTexture [30, ""]

_vehicle setObjectTexture [31, ""]

_vehicle setObjectTexture [32, ""]

_vehicle setObjectTexture [33, ""]

_vehicle setObjectTexture [34, ""]

_vehicle setObjectTexture [35, ""]

_vehicle setObjectTexture [36, ""]

_vehicle setObjectTexture [37, ""]

_vehicle setObjectTexture [5, ""]

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [4, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [4, "\UKF_Snatch\softg.pac"]

exit

I realise i've doubled up the check code at the start of both scripts when looking for the gunner and if he was the guy who got in, but no harm making sure? smile_o.gif

Share this post


Link to post
Share on other sites

They look fine. A slightly polished getin handler is below, where I

<ul>[*] use a temporary variable "_gunner" so as to not call "gunner _vehicle" more than once.

[*] don't use forEach in the addWeapon calls since there's just one weapon to add.

[*] do the vehicle type check only once, since it occurs in all three mounted weapons sections.

<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

?!alive _vehicle:exit

_type = typeof _vehicle

#start

?!(_this select 1)=="gunner" : exit

_gunner=gunner _vehicle

?isNull _gunner: exit

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

#gunner

?(_gunner hasWeapon "ukf_sa80") : goto "sa80"

?(_gunner hasWeapon "ukf_sa80") : goto "sa80"

?(_gunner hasWeapon "ukf_sa80ag36") : goto "sa80"

?(_gunner hasWeapon "ukf_lsw") : goto "lsw"

?(_gunner hasWeapon "ukf_lmg") : goto "lmg"

?(_gunner hasWeapon "ukf_lmgsusat") : goto "lmg"

#lmg

?local _vehicle: _vehicle addWeapon "ukf_min_mounted"

_vehicle setObjectTexture [14, "\ukf_snatch\m249acc.pac"]

_vehicle setObjectTexture [15, "\ukf_snatch\m249.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#lsw

?local _vehicle: _vehicle addWeapon "ukf_lsw_mounted"

_vehicle setObjectTexture [25, "\ukf_ukweps\lsw\l86foregrip.pac"]

_vehicle setObjectTexture [26, "\ukf_ukweps\lsw\lswbipod.pac"]

_vehicle setObjectTexture [27, "\ukf_ukweps\lsw\lswblack.paa"]

_vehicle setObjectTexture [28, "\ukf_ukweps\lsw\lswforegrip2.pac"]

_vehicle setObjectTexture [29, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [30, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [31, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [32, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [33, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [34, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [35, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [36, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#sa80

?local _vehicle: _vehicle addWeapon "UKF_sa80_Mounted"

_vehicle setObjectTexture [16, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [17, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [18, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [19, "\ukf_ukweps\sa80\foregrip.pac"]

_vehicle setObjectTexture [20, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [21, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [22, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [23, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [24, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

Quote[/b] ]I realise i've doubled up the check code at the start of both scripts when looking for the gunner and if he was the guy who got in, but no harm making sure? smile_o.gif
No harm at all..

Share this post


Link to post
Share on other sites

thanks smile_o.gif

I was almost there whistle.gif . Will get on implementing this, and then the get out script and make sure it works in SP. Once it does, its just a case of getting those setobjecttextures to work properly in MP.

Share this post


Link to post
Share on other sites
Quote[/b] ]Once it does, its just a case of getting those setobjecttextures to work properly in MP.

If you cant, there is an alternative to setobjecttexture. But sounds like your almost there anyway. So there is probably no need to worry about it.

Share this post


Link to post
Share on other sites

you'd be suprised...

i've had problems with setobject texture before, mainly with a deployable cam net on the land rovers - problem is, that when someone deployed it, it only deployed for him and him only - everyone else didnt see the net, and had the option to deploy it - also the deployment script in SP forces the crew to get booted out, but this didnt work in MP at all.

Share this post


Link to post
Share on other sites

Yeah, I'm going to have to take the plunge at some point. Sounds like half my ideas will fall flat on thier face in MP sad_o.gif

I think the alternative to setbobjecttexture should be ok, although it does worry me if there are problems with moving units in and out of vehicles. I was just going to suggest using cargo proxies to represent the MG currently mounted. Make a game logic showing the correct p3d. That way you just check the wepon of the guy getting in, then move a logic into the reserved cargo position. The cargo position is assigned to the selection for the gun, so it moves with the mounted weapon.

Same idea for your cammo nets, only you need a way of moving units in and out of a vehicle, without running looping scripts on everyones client.

Share this post


Link to post
Share on other sites

The BW mod wolf's have a working MP camo script, might be worth getting in contact with them?

Smiley

Share this post


Link to post
Share on other sites

UNN - thats an interesting possibility - the problem with the cam net option not being removed was an animation problem as far as we can tell - the setobjecttexture may be solved using variables etc... still looking into it.

Smiley - cheers bud, will take a gander.

Share this post


Link to post
Share on other sites
Quote[/b] ]the problem with the cam net option not being removed was an animation problem as far as we can tell

Yeah sounds right, animationphase can be a pain in MP. But there are plenty of alternatives. Perhaps adding and removing a special magazine, when the nets are deployed e.t.c

Share this post


Link to post
Share on other sites

need to dig this back up again... killswitch, any luck with checking if the gunner dies etc?

Share this post


Link to post
Share on other sites
need to dig this back up again... killswitch, any luck with checking if the gunner dies etc?

Well, there's no luck to be had in that matter - since the vehicle needs a set of setObjectTexture commands to be run when a gunner dies, you'll have to run a looping/waiting script on each *client* machine waiting for the gunner to pass on.

In principle, one could work around this, but then you'll need to implement a system similar to the CoC Network Services. That way, it's dead simple to use a killed event handler to signal to all clients that it is time to do a few choice setObjectTexture lines.

For mission makers, the added hurdle would then be to place one instance of a "PUKF utility game logic" to handle this "poor man's CoC NS" system.

However, again, you can do it with the monitor script method too...

Share this post


Link to post
Share on other sites

replied via IM mate... think we can continue this work on the UKF forums now those problems are fixed smile_o.gif

Share this post


Link to post
Share on other sites

ok - had some errors with the script for the gunner:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(_this select 1)=="gunner" |#|: Error ==: Type Bool, expected Number, String, Object, Side, Group

from this script:

<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

?!alive _vehicle:exit

_type = typeof _vehicle

[_vehicle] exec "\ukf_snatch\isgunnerdead.sqs"

#start

?!(_this select 1)=="gunner" : exit

_gunner=gunner _vehicle

?isNull _gunner: exit

?(_type == "UKF_SnatchDES") : _vehicle setObjectTexture [5, "\UKF_Snatch\soft.pac"]

?(_type == "UKF_Snatch") : _vehicle setObjectTexture [5, "\UKF_Snatch\softg.pac"]

_vehicle setObjectTexture [4, ""]

#gunner

?(_gunner hasWeapon "ukf_sa80") : goto "sa80"

?(_gunner hasWeapon "ukf_sa80") : goto "sa80"

?(_gunner hasWeapon "ukf_sa80ag36") : goto "sa80"

?(_gunner hasWeapon "ukf_lsw") : goto "lsw"

?(_gunner hasWeapon "ukf_lmg") : goto "lmg"

?(_gunner hasWeapon "ukf_lmgsusat") : goto "lmg"

#lmg

?local _vehicle: _vehicle addWeapon "ukf_mm"

_vehicle setObjectTexture [14, "\ukf_snatch\m249acc.pac"]

_vehicle setObjectTexture [15, "\ukf_snatch\m249.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#lsw

?local _vehicle: _vehicle addWeapon "ukf_lm"

_vehicle setObjectTexture [25, "\ukf_ukweps\lsw\l86foregrip.pac"]

_vehicle setObjectTexture [26, "\ukf_ukweps\lsw\lswbipod.pac"]

_vehicle setObjectTexture [27, "\ukf_ukweps\lsw\lswblack.paa"]

_vehicle setObjectTexture [28, "\ukf_ukweps\lsw\lswforegrip2.pac"]

_vehicle setObjectTexture [29, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [30, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [31, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [32, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [33, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [34, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [35, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [36, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

#sa80

?local _vehicle: _vehicle addWeapon "UKF_sm"

_vehicle setObjectTexture [16, "\ukf_ukweps\sa80\barreltrig.pac"]

_vehicle setObjectTexture [17, "\ukf_ukweps\sa80\buttplate.pac"]

_vehicle setObjectTexture [18, "\ukf_ukweps\sa80\cheek.pac"]

_vehicle setObjectTexture [19, "\ukf_ukweps\sa80\foregrip.pac"]

_vehicle setObjectTexture [20, "\ukf_ukweps\sa80\pistolgrip.pac"]

_vehicle setObjectTexture [21, "\ukf_ukweps\sa80\sa80_mag.paa"]

_vehicle setObjectTexture [22, "\ukf_ukweps\sa80\sides.pac"]

_vehicle setObjectTexture [23, "\ukf_ukweps\sa80\susat.pac"]

_vehicle setObjectTexture [24, "\ukf_ukweps\sa80\susat2.pac"]

_vehicle setObjectTexture [37, "\Data\black_sum.pac"]

exit

its fired off from a getin eventhandler - otherwise, the scripts seem to work tounge2.gif

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  

×