Home   Help Search Login Register  

Author Topic: Problems with Scripts on dedicated server  (Read 3239 times)

0 Members and 1 Guest are viewing this topic.

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Problems with Scripts on dedicated server
« on: 18 Mar 2008, 14:15:52 »
Hi All I am hoping someone can hep me:

Hae the following script which is activated by a trigger.

(!isServer): exit
#LOOP
?!alive IT1 : goto "DEAD"
[IT1,"MAP_ITA_UN",5,5,60,1] spawn MAP_MiscTargetSpawn
~70
goto "LOOP"
#DEAD
exiT

The idea is to have invisible targets spawn around a player on a loop every 70 second until he is dead at this point the script exits and the next trigger enables the a script for the next alive player. I have tested succesfully on 1.09 an a hosted server however I have then loaded the mission onto our 1.08 dedicated and the script just wont run I have inserted hints etc... to try and debug the script but it just doesnt run can someone please assist:

I hope to hear your suggestions.

Regards
GSTQ
[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Problems with Scripts on dedicated server
« Reply #1 on: 18 Mar 2008, 15:02:40 »
If it doesnt run, then it might be because the trigger is not triggered and not because the script itself has any bug.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Problems with Scripts on dedicated server
« Reply #2 on: 18 Mar 2008, 15:13:04 »
On a hosted server you are not really testing MP, since both player and server are the same machine, just as if you playing in SP mode. On a dedicated server, whatever the version, the server and client are dedicated machines, so that MP communications are required. Since the script only runs on the server, you'd never see hints anyway on a dedicated server since you aren't on the same machine, unlike when you are hosting. As Mandoble said, it could also be an issue with the trigger.

Also, since we have no idea what exactly the function, MAP_MiscTargetSpawn, actually does, it is impossible to know if it is that which is causing your problems (probably best to ask the MAP people themselves about their functions, rather than us). It might be that the function makes use of 1.09-specific functionality, but I'm sure that the author would have made that clear if it was the case.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Re: Problems with Scripts on dedicated server
« Reply #3 on: 19 Mar 2008, 01:40:16 »
Thanks for your assistance.

The trigger itself initiates without any problems both in the editor and also hosted mode when hosted by someone else. I also removed the hint and put in a unit on the Map called art and inserted a globalchat commend as per the below and still no joy.

(!isServer): exit
#LOOP
art globalchat "Start Loop"
?!alive IT1 : goto "DEAD"
[IT1,"MAP_ITA_UN",5,5,60,1] spawn MAP_MiscTargetSpawn
~70
art globalchat "End Loop"
goto "LOOP"
#DEAD
exiT



The command doesnt appear which would indicate the script isnt even reaching the first loop label.

Your thoughts ?

 
[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Problems with Scripts on dedicated server
« Reply #4 on: 19 Mar 2008, 02:16:32 »
globalChat, in spite of the name, is actually a local command displaying information only on the local client, just like hint. Since it is being performed only on the server, then it won't be seen on any dedicated client, so not seeing it is no indication that the script isn't being run. You might find our new MP ArmA Tutorial helpful in understanding how this all works. It also might give you some ideas on how to make globally visible messages for MP debugging.

It is still possible that a specific function that is provided by, and documented by, MAP is at fault (either that it does not work in MP, is being called incorrectly or, more likely, that you are expecting something else than it has been designed to do or that you aren't correctly detecting that it is operating correctly). Anyway, I suggest you try spawning "MAP_ITA_DT" instead during testing, which is the "visible" version of the invisible target designed for testing purposes. If you can't see them in SP or MP, then nothing is being created.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline RM Snipe

  • Members
  • *
  • RM kicks butt!
Re: Problems with Scripts on dedicated server
« Reply #5 on: 20 Mar 2008, 14:24:06 »
Looks like a handy tut.  :good:
EMSI UAV Management System has the same problem it works fine till on dedi server.

 

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Re: Problems with Scripts on dedicated server
« Reply #6 on: 21 Mar 2008, 13:24:39 »
Right ok tested that script and its actually working fine, I do however have another one.

One of the old OFP scripts we use is Reaper's Artillery Script v1.1. Unfortunately this used to work on OFP in server mode but not in ARMA because none of the commands or setradiomsg commands are working when on dedi server. I  was hoping someone may be also to help.... The script fails as soon as it hits the goto "RADIO1" command as it does not update the radio commands. Unfortunately if you run the scritp in client mode all the clients run the script and then you get multiple instances of the ARTY firing.

Code: [Select]
?(!isServer): exit
; First Check if arty is available:
?!alive arty_unit : goto "ARTY_DEAD"

;------------------------------
;----------Begin Menu----------
;------------------------------
_radio = _this select 0

?menu == 0 : goto "MENU0"
?menu == 1 : goto "MENU1"
?menu == 2 : goto "MENU2"
?menu == 3 : goto "MENU3"
?menu == 4 : goto "MENU4"



;----------Default Menu----------
#MENU0
?_radio == "A" : goto "SET_TARGET"
exit

#RADIO0
1 setRadioMsg "Set Target"
2 setRadioMsg " "
3 setRadioMsg " "
4 setRadioMsg " "
5 setRadioMsg " "
6 setRadioMsg " "
menu = 0
exit



;----------Target Move----------
#MENU1
?_radio == "A" : goto "NORTH"
?_radio == "B" : goto "SOUTH"
?_radio == "C" : goto "EAST"
?_radio == "D" : goto "WEST"
?_radio == "E" : goto "RADIO2"
?_radio == "F" : goto "CLEAR"
exit

#RADIO1
1 setRadioMsg "Move North"
2 setRadioMsg "Move South"
3 setRadioMsg "Move East"
4 setRadioMsg "Move West"
5 setRadioMsg "Apply Target"
6 setRadioMsg "Clear Target"
menu = 1
exit



;----------Fire Menu----------
#MENU2
?_radio == "A" : goto "FIRE_SINGLE"
?_radio == "B" : goto "OPEN_FIRE"
?_radio == "C" : goto ""
?_radio == "D" : goto ""
?_radio == "E" : goto "RADIO4"
?_radio == "F" : goto "RADIO1"
exit

#RADIO2
1 setRadioMsg "Single Salvo"
2 setRadioMsg "Continuous Fire"
3 setRadioMsg ""
4 setRadioMsg ""
5 setRadioMsg "Change Ammo"
6 setRadioMsg "Change Target"
menu = 2
exit



;----------Cease Fire Menu----------
#MENU3
?_radio == "A" : goto "RADIO3"
exit

#RADIO3
1 setRadioMsg "Single Salvo"
2 setRadioMsg "Continuous Fire"
3 setRadioMsg ""
4 setRadioMsg ""
5 setRadioMsg "Change Ammo"
6 setRadioMsg "Change Target"
menu = 2
goto "CEASE_FIRE"



;----------Ammo Menu----------
#MENU4
?_radio == "A" : shell_type = "80mm Mortars"
;?_radio == "B" : shell_type = "AT"
goto "RADIO2"

#RADIO4
1 setRadioMsg "80mm Mortars"
2 setRadioMsg " "
3 setRadioMsg " "
4 setRadioMsg " "
5 setRadioMsg " "
6 setRadioMsg " "
menu = 4
exit

;----------------------------
;----------END MENU----------
;----------------------------



;----------Set Target----------
#SET_TARGET
arty_target setmarkerpos getpos arty_spotter
arty_target setmarkertype "Destroy"
goto "RADIO1"



;----------Clear Target----------
#CLEAR
arty_target setmarkertype "empty"
goto "RADIO0"


;----------Adjust North----------
#NORTH
_x = getmarkerpos arty_target select 0
_y = getmarkerpos arty_target select 1

arty_target setmarkerpos [_x,_y + arty_adjust]

exit



;----------Adjust South----------
#SOUTH
_x = getmarkerpos arty_target select 0
_y = getmarkerpos arty_target select 1

arty_target setmarkerpos [_x,_y - arty_adjust]

exit



;----------Adjust East----------
#EAST
_x = getmarkerpos arty_target select 0
_y = getmarkerpos arty_target select 1

arty_target setmarkerpos [_x + arty_adjust,_y]

exit



;----------Adjust West----------
#WEST
_x = getmarkerpos arty_target select 0
_y = getmarkerpos arty_target select 1

arty_target setmarkerpos [_x - arty_adjust,_y]

exit



;----------Fire Single Salvo----------
#FIRE_SINGLE
?fireing : goto "IN_USE"
fireing = true

?shell_type == "HE" : _goto_fire = "FIRE_HE"
?shell_type == "AT" : _goto_fire = "FIRE_AT"

_mx = getmarkerpos arty_target select 0
_my = getmarkerpos arty_target select 1

_return = "READY_SINGLE"
goto "CHECK_AMMO"

#READY_SINGLE
~random shell_load

arty_unit sidechat "Roger - single round on way..."

_return = "END_SINGLE"

~shell_delay
goto _goto_fire

#END_SINGLE
fireing = false
exit



;----------Open Fire----------
#OPEN_FIRE
?fireing : goto "IN_USE"
fireing = true

?shell_type == "HE" : _goto_fire = "FIRE_HE"
?shell_type == "AT" : _goto_fire = "FIRE_AT"

_mx = getmarkerpos arty_target select 0
_my = getmarkerpos arty_target select 1

1 setRadioMsg "Cease Fire"
2 setRadioMsg " "
3 setRadioMsg " "
4 setRadioMsg " "
5 setRadioMsg " "
6 setRadioMsg " "
menu = 3

_return = "READY_OPEN"
goto "CHECK_AMMO"

#READY_OPEN
order_fire = true
~random shell_load

arty_unit sidechat "Roger - continous rounds on way..."

_return = "ARTY_LOOP"
~shell_delay

#ARTY_LOOP
~random shell_load
?!order_fire : goto "END_ARTY_LOOP"
goto _goto_fire

#END_ARTY_LOOP
fireing = false
exit



;----------Cease Fire----------
#CEASE_FIRE
~random shell_load
arty_unit sidechat "Ceasing fire..."

~shell_delay
order_fire = false

exit



;----------Check Ammo----------
#CHECK_AMMO
?shell_type == "HE" : goto "CHECK_HE"
?shell_type == "AT" : goto "CHECK_AT"
exit

#CHECK_HE
?count_he < 1 : goto "NO_HE"
goto _return

#CHECK_AT
?count_at < 1 : goto "NO_AT"
goto _return



;----------Fire HE Salvo----------
#FIRE_HE
_gun = arty_salvo

#HE_LOOP

_randx = random radius_he
_randy = random radius_he
_z = 0

_randz = random 2
?_randz >= 1 : _x = _mx + _randx
?_randz < 1 : _x = _mx - _randx

_randz = random 2
?_randz >= 1 : _y = _my + _randy
?_randz < 1 : _y = _my - _randy

_fire = shell_he CreateVehicle [_x,_y,_z]

count_he = count_he - 1
?count_he < 1 : goto "NO_HE"

~random 1
_gun = _gun -1
?_gun > 0 : goto "HE_LOOP"

goto _return



;----------Fire AT Salvo----------
#FIRE_AT
_gun = arty_salvo

#AT_LOOP

_randx = random radius_at
_randy = random radius_at
_z = 0

_randz = random 2
?_randz >= 1 : _x = _mx + _randx
?_randz < 1 : _x = _mx - _randx

_randz = random 2
?_randz >= 1 : _y = _my + _randy
?_randz < 1 : _y = _my - _randy

_fire = shell_at CreateVehicle [_x,_y,_z]

count_at = count_at - 1
?count_at < 1 : goto "NO_AT"

~random 1
_gun = _gun -1
?_gun > 0 : goto "AT_LOOP"

goto _return



;----------Fire Smoke----------
#FIRE_SMOKE
?fireing : goto "IN_USE"
fireing = true

?count_smoke < 1 : goto "NO_SMOKE"

_mx = getmarkerpos arty_target select 0
_my = getmarkerpos arty_target select 1

_randx = random radius_he
_randy = random radius_he
_z = 100

_randz = random 2
?_randz >= 1 : _x = _mx + _randx
?_randz < 1 : _x = _mx - _randx

_randz = random 2
?_randz >= 1 : _y = _my + _randy
?_randz < 1 : _y = _my - _randy

~random shell_load
arty_unit sidechat "Firing smoke..."

~shell_delay
_fire = smoke_type CreateVehicle [_x,_y,_z]
count_smoke = count_smoke - 1

fireing = false

exit



;----------Fire Flare----------
#FIRE_FLARE
?fireing : goto "IN_USE"
fireing = true

?count_flare < 1 : goto "NO_FLARE"

_mx = getmarkerpos arty_target select 0
_my = getmarkerpos arty_target select 1

_randx = random radius_he
_randy = random radius_he
_z = 150

_randz = random 2
?_randz >= 1 : _x = _mx + _randx
?_randz < 1 : _x = _mx - _randx

_randz = random 2
?_randz >= 1 : _y = _my + _randy
?_randz < 1 : _y = _my - _randy

~random shell_load
arty_unit sidechat "Firing flare..."

~shell_delay
_fire = flare_type CreateVehicle [_x,_y,_z]
count_flare = count_flare - 1

fireing = false

exit


;----------Gun in Use----------
#IN_USE
~random shell_load
arty_unit sidechat "Negative, firing in progress ..."
exit

;----------Out of HE Ammo----------
#NO_HE
~random shell_load
arty_unit sidechat "We're out of mortar rounds!"
fireing = false
exit

;----------Out of AT Ammo----------
#NO_AT
~random shell_load
arty_unit sidechat "We're out of AT shells!"
fireing = false
exit

;----------Out of Smoke----------
#NO_SMOKE
~random shell_load
arty_unit sidechat "Negative, no smoke left..."
fireing = false
exit

;----------Out of Flare----------
#NO_FLARE
~random shell_load
arty_unit sidechat "Negative, no flares left..."
fireing = false
exit

;----------Arty is Dead----------
#ARTY_DEAD
1 setRadioMsg " "
2 setRadioMsg " "
3 setRadioMsg " "
4 setRadioMsg " "
5 setRadioMsg " "
6 setRadioMsg " "
exit

« Last Edit: 21 Mar 2008, 21:00:24 by h- »
[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Problems with Scripts on dedicated server
« Reply #7 on: 21 Mar 2008, 14:23:49 »
I don't know what you did to fix that original script, but if you think that what you did could possibly be useful to anyone else, then share it with the people who will probably struggle with it in the future.

If you are going to add such a large script to a post, you might as well attach it as a file (or a link to the original file if it is released), but it doesn't matter too much. The obvious thing is that the script only runs on the server, but then tries to alter the radio messages and do other local things which will never be seen by anyone. Are you sure it isn't supposed to be "? isServer : exit" at the start so it only runs on the clients? You've also neglected to tell us how the script should be used; what, for example, is the _radio parameter that needs to be sent to it to start it? As far as the code goes, it is a nest of gotos which is very hard to follow, though it is obvious what it is generally trying to do  (this always happens when SQS is used for anything but simple scripts; SQS promotes a style of programming that no-one has used for over a quarter of a century ;P).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Re: Problems with Scripts on dedicated server
« Reply #8 on: 22 Mar 2008, 02:22:37 »
Cheers for taking the time to look at this Spooner. What I meant was I had done what you suggested for the initial script and used the debug targets an found that the script is actually working on the dedi server, dont know why I didnt do that already probably cos was getting abit frustrated.

I have done as you have requested and added the script files associated with the artillery script. On the map you need to place radio triggers  A through to F with as per the below extract from the sqm for A. The idea is that you execute using the radio a call for arty using the radio commands you then position the target and then select your ordinance.

{
         position[]={6439.061523,91.509956,4590.675781};
         a=10.000000;
         b=10.000000;
         activationBy="ALPHA";
         repeating=1;
         interruptable=1;
         age="UNKNOWN";
         expActiv="[""A""] exec ""arty.sqs""";
         class Effects
         {
         };
      };
 
As explained the reason why I dont want this to run on the client side is that you would end up if we get 16 in map that the script executes 16 times so you get 16 times the artillery shells falling. I hope this makes more sense.

Regards
[RM]C-Sgt GSTQ[40ACoy]


[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Problems with Scripts on dedicated server
« Reply #9 on: 22 Mar 2008, 12:57:08 »
Yes, by limiting the script to run on the server only, you would prevent there being one bomb dropped per machine (since radio triggers run on every machine at once, even when only one person uses the radio). The problem, however, is that the menu system created using the artillery script is client-side so it won't be seen unless it is run client-side.

The way to deal with this in ArmA is to manually create each of the radio triggers in a script, since script-created triggers only "fire" for the local machine when the player uses them. This way, you keep the artillery entirely client-side, but since it is only run on one client at a time, that solves your issues. Incidentally, "isServer and (isNull player)" is true only on the dedicated server, so that the rest of the script still runs in SP or on a hosted MP server, which makes testing a lot easier.
Code: (init.sqs) [Select]
; Create each of the 6 required triggers manually on each client machine so that they only "fire" locally.
? (isServer and (isNull player)) : exit
_trigger = createTrigger ["EmptyDetector", [0, 0, 0]];
_trigger setTriggerActivation ["ALPHA", "PRESENT", true];
_trigger setTriggerStatements ["this", "[""A""] exec ""arty.sqs""", ""];

; Create the other 5 triggers too...but I can't be bothered typing ;P
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Re: Problems with Scripts on dedicated server
« Reply #10 on: 22 Mar 2008, 13:04:52 »
Cheers mate I will give that a go and see what happens..... :)

Much appreciated
Q
[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline RMGSTQ

  • Members
  • *
    • 40 Commando Royal Marines ArmA Brigade
Re: Problems with Scripts on dedicated server
« Reply #11 on: 23 Mar 2008, 14:37:16 »
Hi Spooner looks like we are getting closer. Please find attached a copy of the initi file. When i remove the "?(isServer and (isNull player)) : exit" command and preview the file in the editor the triggers are created no problems however when I reinsert the above command and then run the mision in the dedicated server I get the following error;

...init.sqf";
[] exec "arty_options.sqs";
  • ?(isServer and (isNull player)) : exit...'

Error Invalid Number in Expression

PS before ?(isServer and (isNull player)) : exit...' above is a hash sign in brackets

Could you please have a look at the file and let me know what I am doing wrong.

Cheers
Q
 
« Last Edit: 23 Mar 2008, 14:41:49 by RMGSTQ »
[RM]C-Sgt GSTQ[40ACoy]
40 Commando Royal Marines ArmA Brigade
99.9% need not apply

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Problems with Scripts on dedicated server
« Reply #12 on: 25 Mar 2008, 17:48:31 »
I think that the problem is that you are trying to use an SQS structure in an SQF file (init.sqf). Just change to using:
Code: [Select]
if (isServer and (isNull player)) exitWith { };

which is the equivalent code in SQF. Alternatively, you could just rename the file as init.sqs, since everything in there is good for SQS or both. I'd advise moving to SQF though, because I think SQS should go the way of the dodo ;P
« Last Edit: 25 Mar 2008, 17:50:30 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)