Jump to content

engima

Member
  • Content Count

    548
  • Joined

  • Last visited

  • Medals

Everything posted by engima

  1. 1) There is no difference in where you put the scripts. The difference is how you script. In MP you need to keep track of on which machine each script is running. You also need to know how each command impacts the machines in the network. For example, if command createVehicle is executed on one machine, a vehicle will be created on all machines. So scripts that creates vehicles may be a good practice to run only on the server. As an opposite example, if the command createTrigger is executed, a trigger will only be created on the machine that executes the command (and the other machines will not have that particular trigger at all). 2) Best way i guess is to get another copy of the game. Or maybe borrow a license key from a friend for test purposes only. To test server client code execution you ca set up and join a dedicated server on your developer machine. Check out Tophe's TADST for Arma 3. 3) It will fire local to the player that has the trigger. However, if the trigger is added in editor, it is not actually "one trigger". It is "one trigger per each machine in the network". If you place a trigger in editor that creates a vehicle using command createVehicle when the leader of the group comes near, there will be as many vehicles created as machines in the network. That's because the trigger fires on all machines at the same time and createVehicle has "network global" impact. If the same trigger (or actually triggers) instead shows a hint (script command "hint") which has "network local" impact, it is shown once for all connected players. If you think of a trigger created by a script instead of placed in the editor, and that trigger is created on only one machine, it may be a little easier to understand. Then it is more obvious that the script is fired on the current machine only. One more thing, in an editor placed trigger, if you enter condition "isServer", then the trigger will exist on all machines, but there is only one machine that it fires on, and that is the server. 4) Personally I think of four kinds of "locality categories": 1. Obvious global commands, 2. Local commands that should be obvious global commands, 3. Commands that you don't know are local or global, 4. Obvious local commands. An obvious global command (1) is the familiar example "createVehicle". It simply makes no sense that a tank would exist on one machine but not on another. The mission would be broken, so BI has designed the command for global impact. Local commands that should be global (2) are commands that BI in my opinion need to fix. In more previous versions of Arma one and the same soldier could look east on one machine and west on another. That is one thing that they have fixed. In Arma 2 OA (I don't know about Arma 3) i had a friend that I could see just walk through the walls of a house. It appeared that the house on his machine was razed, but on my machine it was not. A command that is local but you don't know (3) may be the "setRain" command. How come it sometimes rains for me but not for my friend sitting two meters from me in the game? However if the map is 10 km wide it is certanly possible that it rains in one end of the map but not in the other. So this is up to the mission developer to have the correct weather behavour. An obvious local command (4) is "hint". If hint is executed on one machine, why should the same message show to others, and who would that be? Players in the same group? On the same side? Everyone? You may wonder, how do I know about the locality for commands? Here are your available scripting commands: http://community.bistudio.com/wiki/Category:Scripting_Commands_ArmA2 http://community.bistudio.com/wiki/Category:Arma_3:_New_Scripting_Commands_List Most of the commands have documentation regarding MP scripting. For example, look at command "setVariable" on the following link, and note the Additional Information section and the header Multiplayer. http://community.bistudio.com/wiki/setVariable Regarding your helicopter script. I would solve it by letting the server, and only the server, control the helicopter with a script. Where I execute the script, I would test using command isServer, to make sure that the script is not run on any other machine than a dedicated or hosted server. The script can then pick a random time to the helicopter to "be hit". I would assume that commands "setHit" and "setDamage" has "network global" impact (the above category 1) since it makes no sense to have a burning heli for one player but not all. The assumption is correct then it will work, and the helicopter will fall apart for all players at the same time. If the assumpsion is wrong and the commands are in the category 2 above, I need to fix it myself in some way. Luckily category 2 is not so common any more, and since the documentation says nothing about Multiplayer (http://community.bistudio.com/wiki/setDamage) it will probably work as expected (i.e. setDamage is in category 1). But if in category 2, I need to have communication between the machines (command publicVariable) to somehow make it happen on all machines at the same time. Another hint on the locality subject and script execution. Your init.sqf file runs automatically on all machines when mission starts (or for a JIP when he/she enters). Use the following code to separate server and client code already from start. This code will have the file ServerInit.sqf execute only on the server (hosted or dedicated). And the script ClientInit.sqf will execute on alla machines that are a client (including a hosted server which is also a client). Maybe ServerInit.sqf is a good file to have your helicopter script executed in? if (isServer) then { execVM "ServerInit.sqf"; }; if (!isDedicated) then { execVM "ClientInit.sqf"; };
  2. Are jefe1, jefe2 or jefe3 maybe null or nill?
  3. In addition to your code, use command simulWeatherSync skipTime -24; 86400 setOvercast 0.75; skipTime 24; simulWeatherSync; http://community.bistudio.com/wiki/simulWeatherSync
  4. Hi! Why doesn't the Close button work on this dialog? I don't think it's disabled, but the action does not fire when pressed. #define true 1 #define false 0 class MyHelloWorldDialog { idd = -1; // set to -1, because we don't require a unique ID movingEnable = false; // the dialog can be moved with the mouse (see "moving" below) enableSimulation = true; // freeze the game controlsBackground[] = { }; // no background controls needed objects[] = { }; // no objects needed controls[] = { MyHelloText, CloseButton }; // our "Hello world" text as seen below: class MyHelloText { idc = -1; // set to -1, unneeded moving = 0; // left click (and hold) this control to move the dialog // (requires "movingEnabled" to be 1, see above) type = CT_STATIC; // constant style = ST_LEFT; // constant text = "Hello world"; font = "LucidaConsoleB"; sizeEx = 0.023; colorBackground[] = { 1, 1, 1, 0.3 }; colorText[] = { 0, 0, 0, 1 }; x = 0.1; y = 0.1; w = 0.2; h = 0.1; }; class CloseButton { idc = 2; type = CT_BUTTON; style = ST_LEFT; default = false; font = FontM; sizeEx = 0.03; colorText[] = { 0, 0, 0, 1 }; colorFocused[] = { 1, 0, 0, 1 }; // border color for focused state colorDisabled[] = { 0, 0, 1, 0.7 }; // text color for disabled state colorBackground[] = { 1, 1, 1, 0.8 }; colorBackgroundDisabled[] = { 1, 1, 1, 0.5 }; // background color for disabled state colorBackgroundActive[] = { 1, 1, 1, 1 }; // background color for active state offsetX = 0.003; offsetY = 0.003; offsetPressedX = 0.002; offsetPressedY = 0.002; colorShadow[] = { 0, 0, 0, 0.5 }; colorBorder[] = { 0, 0, 0, 1 }; borderSize = 0; soundEnter[] = { "", 0, 1 }; // no sound soundPush[] = { "buttonpushed.ogg", 0.1, 1 }; soundClick[] = { "", 0, 1 }; // no sound soundEscape[] = { "", 0, 1 }; // no sound x = 0.7; y = 0.9; w = 0.2; h = 0.1; text = "Close"; action = "closeDialog 0; hint ""Dialog closed. You are good to go now!"""; }; };
  5. Yes! That was exactly what I had missed! Thanks!
  6. Ok, they still show up, but the button still behaves as a text control - unclickable. Another question: What should be in the objects[] array? Btw, here is the defines that I forgot to post: // Static styles #define ST_POS 0x0F #define ST_HPOS 0x03 #define ST_VPOS 0x0C #define ST_LEFT 0x00 #define ST_RIGHT 0x01 #define ST_CENTER 0x02 #define ST_DOWN 0x04 #define ST_UP 0x08 #define ST_VCENTER 0x0c #define ST_TYPE 0xF0 #define ST_SINGLE 0 #define ST_MULTI 16 #define ST_TITLE_BAR 32 #define ST_PICTURE 48 #define ST_FRAME 64 #define ST_BACKGROUND 80 #define ST_GROUP_BOX 96 #define ST_GROUP_BOX2 112 #define ST_HUD_BACKGROUND 128 #define ST_TILE_PICTURE 144 #define ST_WITH_RECT 160 #define ST_LINE 176 #define ST_SHADOW 0x100 #define ST_NO_RECT 0x200 // this style works for CT_STATIC in conjunction with ST_MULTI #define ST_KEEP_ASPECT_RATIO 0x800 #define ST_TITLE ST_TITLE_BAR + ST_CENTER // Slider styles #define SL_DIR 0x400 #define SL_VERT 0 #define SL_HORZ 0x400 #define SL_TEXTURES 0x10 // Listbox styles #define LB_TEXTURES 0x10 #define LB_MULTI 0x20 #define FontM "Zeppelin32"
  7. Has anyone else noticed that the "fuel" command seems broken? I cannot do the following: hint str fuel mytruck; I get the error "Missing ;" If i instead write: hint str (fuel mytruck); I get the error "Missing )". Does anyone know anything about this?
  8. Ok, i found it. I had accidently given a vehicle the name "fuel".
  9. As I'm testing there seem to be a few tricky parts left. Weather has become so much more complicated in Arma 3. My first goal is to release the DynamicWeatherEffects scripts for Arma 3 and have it work at least like the one for Arma 2. Then I will consider new Arma 3 stuff like waves and lightning etc in future releases. My guess is that BI has some weather updates on their TODO list too... Thanks for all the helpful info in this thread btw! Hope to be back with a working weather script in a few days!
  10. New status update: I have remade the script to work in Arma 3. It is ready, and I need a little more testing until release. Hope to release it in a few days.
  11. engima

    Group ID and Hunt

    An example. One thing you missed is to send variables into the spawned thread. What spawn does is to start a new executing thread, and your reference to _hunted may be lost. In my example the abc_chasingLeader is the vehicle variable name set in the editor and the player is the one to be hunted. (Haven't tried this, so there might be a semicolon missing or similar). private ["_chaserGroup", "_huntedGroup"]; _chaserGroup = group abc_chasingLeader; _huntedGroup = group player; _null = [_chaserGroup, _huntedGroup] spawn { private [_chaserGroup, "_huntedGroup"]; _chaserGroup = _this select 0; _huntedGroup = _this select 1; while {true} do { _chaserGroup domove getpos _huntedGroup; sleep 10; }; };
  12. Hi! Is it possible to change unit class of a player in mission? Let's say that you can only select Riflemen in the lobby, so you spawn as a rifleman, but later in game you want to let players "convert" to other roles, like into a pilot. I have seen some threads about the selectPlayer command, but they seem to say that it's just possible to change unit class into *another unit already in mission*. Is it so? I would like to be able to convert a player into a pilot in a mission where no pilots exist.
  13. The fun thing about Arma is: Everything is possible! :) What about a simple script function (abc_IsAreaClear) returning true or false, and takes a unit (the leader) and the enemy side as parameters. This one checks for enemy units within 300 meters from the leader. abc_IsAreaClear = { private ["_leader", "_enemySide", "_enemyUnitsCount", "_areaIsClear"]; _leader = _this select 0; _enemySide = _this select 1; _areaIsClear = false; _enemyUnitsCount = 0; { if (side _x == _enemySide && _leader distance _x < 300) then { _enemyUnitsCount = _enemyUnitsCount + 1; }; } foreach allUnits; if (_enemyUnitsCount == 0) then { _areaIsClear = true; }; // (SQF return statement, write it with no semi-colon) _areaIsClear }; The following code makes a call to the function. Run it maybe once every 5th second: _areaIsClear = [leader group player, east] call abc_IsAreaClear;
  14. That's very interesting. Thanks!
  15. I'd do the following in the init.sqf: abc_taggedUnits = []; abc_taggedUnits set [count abc_taggedUnits, p1] abc_taggedUnits set [count abc_taggedUnits, abc_myTruck] abc_taggedUnits set [count abc_taggedUnits, abc_myMotorbike] Then you will need to set a name for each object (p1, abc_myTruck, abc_myMotorbike), and in the init.sqf you create the array that you can use for the rest of your mission development. Then as a condition in an end trigger (or any trigger) you could write something like this: (Fires when all units are dead) ({ alive _x } count abc_taggedUnits) == 0; Btw, always use your personal prefix when writing globals. In this exampel "abc_".
  16. Hi there! Current status report: Arma 3 is released, and I'm trying to get this script to work. However, some weather commands seem to be broken in Arma 3 (like setOvercast), so I have now decided to wait until they are fixed by BIS. Hope to be back soon! Engima
  17. There is always one server. Think of a trigger (created in the editor) as it is created on all machines in the network. If a trigger is activated with a hint when a unit comes in range, it is actually activated on all machines at once. The unit comes in range on all machines, and therefore all those triggers activate on all machines (and for all players). However, if a script is running on just one machine, the hint will only execute on that very machine, and not for other players.
  18. Thank you for the bug reports and the links to the ports! I've added them to first post! Please send med more links, if there are ports that I don't know about!
  19. Yes, locality. And always keep track of all code lines in all of your scripts, and know on which machine they are running. Try to centralize as much as possible to the server.
  20. Hi Mordeton! It's not the mission file that is generated. It's not possible to generate custom files in Arma2, so the generator generates code using the diag_log command. The output is in the arma2oa.rtf file (on Windows 7 located in C:\Users\[username]\AppData\Local\ArmA 2 OA). Remove the file before you run the generator, then it is recreated and contains the output. The output is in double brackets (""), so replace all these with a single bracket, put the output in a file with the name you mention. Good luck! ---------- Post added at 10:08 ---------- Previous post was at 10:06 ---------- The guard is created somewhere in the end in the file InitServer.sqf. Search for "createUnit" or "guard" and you will find it. ---------- Post added at 10:16 ---------- Previous post was at 10:08 ---------- Hi AWookey! I've not encountered this anytime, byt the problem may be that you use Arma 2 and not Operation Arrowhead. You need Arma 2 Combined Operations to run Escape Chernarus. Armaholic.com says you only need Arma 2, but that is not correct. Seems like I provided the wrong information. Here's a post discussing your problem: http://forums.bistudio.com/showthread.php?142721-Can-run-costum-mission-in-CO-but-not-in-standard-ArmA-2
  21. Yes, it's possible. Use the nearTargets command and loop through all targets for the quad member. When you find yourself in the list, he has detected you.
  22. Maybe something like this: { isPlayer _x } count allUnits >= 3
  23. Yes, a JIP client will have the last publicVariabled value from start. Just make sure that you don't reset it in the init.sqf. Be careful to use only values that can be publicVariabled: http://community.bistudio.com/wiki/publicVariable ---------- Post added at 13:33 ---------- Previous post was at 12:50 ---------- Thanks for your feedback, Sickboy! I'll look into your suggestions! Since it seems to work quite good right now I wanted to release it, but there are of course optimizations and things to improve. Actually it is intended, and I'm aware of the cost to synchronize these values for JIP players. I have tried to spread the load on the PVEHs. Maybe I underestimate the Arma script engine here, I don't know, but at the same time I would guess that the initial synchronization of variables when JIP connects is quite superable. This is actually how the function that executes on a given client works. You can use the vehicle variable name for any object, it must not be a player unit object. I've had problems with waitUntil command in PVEHs, and I think that's why I did like this. This was a long time ago, so I will look into it again. What do you mean? Is it not working?
  24. ASCOM Framework 1.0 by Engima of Östgöta Ops (Download at Armaholic) Description The Arma Script Communication (ASCOM) Framework is a framework that greatly simplifies SQF script communication between machines in a multiplayer mission. The ASCOM framework makes it possible to “call a function on another machine†in the same way that you call a function on the local machine. You can also return values to the caller in a usual manner, even when the caller is on another machine. These calls can be made in a script on any machine on the network. It is efficient, robust and does not require much bandwidth or CPU. Within the ASCOM framework, these functions are called “Network Functionsâ€. A network function is actually just like any other function. The ASCOM framework (which comes with an editor) then generates code that handles communication between machines on the network, which enables you to execute your functions on machines of your choice at each call. Examples Assume you have a function named "ShowMessage" that shows a message on its client. With the ASCOM Framework you can run that function on all clients with the following call: [“Mission completed!â€] call ShowMessageClients; As an another example, assume you have an MP mission, and when a JIP player connects its client needs to get the current tasks and their status from the server. In the init.sqf for the client you can make the following call to execute the function GetCurrentTaskStates on the server and have it return the task states across the network: _taskStateList = call GetCurrentTaskStatesServer; As a third example, assume that you want the server to set state "SUCCEEDED" on the task "FreeHostage" on all machines: ["FreeHostage", "SUCCEEDED"] call SetTaskStateAll; Installation No installation. Simply execute the file "ASCOM Editor.exe". Other Works for Arma 2 and Arma 3. Media This video shows an older version of the editor. One function name has been changed, but principles are the same. Content Package contains: The ASCOM Editor (.NET 4.0 executable). The ASCOM Manual (.PDF) Demo mission for Arma 3. Demo mission for Arma 2. Requirements .NET framework 4.0.
  25. I cannot se the call to lampCreateNewTaskClient anywhere in your code. Anyway, by the comment "Executed on the server" right above your lampCreateTask function my guess is that you have simply not selected the option in the editor that tells the framework to generate the necessary code for executing a function on a given client. Can it be so? Also, if you simply want to "set a variable value" on clients or the server, you better use the publicVariable command. Then the current variable value is set from start on JIPs.
×