-
Posts
376 -
Joined
-
Last visited
-
Days Won
3
Content Type
Profiles
Forums
Events
Everything posted by piXel496
-
About forwarding the number into a flagname and based on the example above. And although I am really lost if it is related to other script embedded constructions and I do not even know if a flag is a name or a number. Maybe something like: flagIwantToGiveAnumber = _index flagIwantToGiveAname = string.format("someText".._index) -- concatenate text with number into new text .
-
something like this? -- generate 3 times a random number and do something with the result function flagRandomIndex(_cycle) local _index = math.random(1, 17) local _cycles = _cycle + 1 if _cycles <= 3 then trigger.action.outTextForCoalition(coalition.side.BLUE, string.format("Generate 3 times a random number in the range 1-17.\nOccurance: "..cycles.." random number: ".._index), 5) timer.scheduleFunction(flagRandomIndex, _cycles, timer.getTime() + 10) else trigger.action.outTextForCoalition(coalition.side.BLUE, string.format("The flagRandomIndex counter has ended."), 10) end end -- start this construction timer.scheduleFunction(flagRandomIndex, 0, timer.getTime() + 5) [edit]: I understand now you want to keep track of generated numbers. Maybe something like this? --the table of happened flags indexHistory = {} -- keep track of times to generate flag cycles = 0 -- generate 3 times a random number and do something with the result function flagRandomIndex() local _index = math.random(1, 17) local _indexFound = false for i = 1, #indexHistory do if indexHistory[i] == _index then _indexFound = true end end if _indexFound then flagRandomIndex() elseif _indexFound == false and cycles <= 2 then flagRandomIndex[#flagRandomIndex + 1] = _index cycles = cycles + 1 trigger.action.outTextForCoalition(coalition.side.BLUE, string.format("Generate 3 times a random number in the range 1-17. Random number: ".._index), 5) timer.scheduleFunction(flagRandomIndex, nil, timer.getTime() + 10) end end -- start this construction timer.scheduleFunction(flagRandomIndex, nil, timer.getTime() + 5) .
-
Is missionCommands.removeItem on the bug tracking list? Since it is mentioned before by ED testers on thread: http://forums.eagle.ru/showthread.php?t=124546 and http://forums.eagle.ru/showthread.php?t=116389 I still experience the same bug in the latest 1.28. With: missionCommands.removeItemForGroup(_plrGroupId, "menuItemName") Thanks, .
-
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
Because I like solutions from others. So the least I can do is post my own doings. An example of a JIP script created with S_EVENT_BIRTH because S_EVENT_PLAYER_ENTER_UNIT currently does not work properly in MP. --player table to save values playerData {} --JIP eventhandler (this triggers on the event of a new object entering the DCS world) JIPevHandler = {} function JIPevHandler:onEvent(_newObject) if _newObject.id == world.event.S_EVENT_BIRTH and timer.getAbsTime() > 1 then local _eventObject = (_newObject.initiator) timer.scheduleFunction(JIP, _eventObject, timer.getTime() + 3) end end world.addEventHandler(JIPevHandler) --filter JIP player (now we want to syncronize only if the new object is a player) function JIP(_eventObject) local _plrName = _eventObject:getPlayerName() if _plrName ~= nil then local _unknownPlayer = true for i = 1, #playerData do if playerData[i].playerName == _plrName then --we found a player already registered in the player table "playerData" _unknownPlayer = false end end local _clientGroupId = Group.getID(Unit.getGroup(_eventObject)) if _unknownPlayer then -- This is what you could do with a new player, throw him in the table and fire some code local _clientId = _eventObject:getID() local _clientName = _eventObject:getPlayerName() local _clientUnitName = _eventObject:getName() local _clientType = _eventObject:getTypeName() playerData[#playerData + 1] = { playerId = _clientId, playerGroupId = _clientGroupId, playerName = _clientName, playerUnitName = _clientUnitName, playerType = _clientType, --### here you could place the code that updates the player that entered for the first time end --### here you could place code that updates the player and it fires every time as a player becomes a unit even if its found in the player table "playerData" end end --this is a looping procedure that checks every second if a player exists otherwise it wil be deleted from the player table (this needs some fine tuning to determine if player disconnected...!) function checkPlayerExistence() local _j = 1 while _j <= #playerData do local _plr = Unit.getByName(playerData[_j].playerUnitName) if _plr == nil then table.remove(playerData, _j) else _j = _j + 1 end end timer.scheduleFunction(checkPlayerExistence, nil, timer.getTime() + 1) end --initial start of the player check loop timer.scheduleFunction(checkPlayerExistence, nil, timer.getTime() + 5) If you have any comments or smart adjustments please post. . -
The reason why Mp is different from SP is that a player in SP does not have to be syncronized with the mission since it entered from the start of the mission. In a MP mission, players join a mission that already started. To make a MP mission work you need to update the players with "critical" data from the mission before he entered. Otherwise some functions are not available for the new player. If you syncronize players that join a mission in progress. Then in theory all should be fine. [edit]: Might aswell create an example when saying these things. here .
-
Tutorial: Introduction to Lua scripting
piXel496 replied to Yurgon's topic in Scripting Tips, Tricks & Issues
If I was an eventHandler I did not want to be called again to say the same. . -
Tutorial: Introduction to Lua scripting
piXel496 replied to Yurgon's topic in Scripting Tips, Tricks & Issues
Hi Joyride, If I understand the idea you want to script. I think you have to keep your eventhandler global, since it wil fire on that level in in the ED-world. And you have to create the dynamic requirement to make your script behave the way you like within the eventhandler. you could make a filter within your eventhandler that distiquishes for instance "if unitSet_1 then" and "if unitSet_2 then" or "if with_as_much_flavours_as_you_like then". To make it readable you could even send each if, to there own function outside the eventhandler. . -
Converge your unhappiness into MP mission making, then we could all benefit from your non-arcadish mission concept and understand what you do like. Now to unrude myself. What you should try is fly online with a small group and do mission planning before takeoff, otherwise it is always arcadish. Maybe find a squad of like-minded. PS: DCS has by far the best immersion especially when flying ASM planes. So I understand online open free flight perfectly fine. .
-
attached mission eventHandlerTest.miz
-
I hope I am not to late. :) But I wanted to test it more thoroughly. The eventhandler S_EVENT_PLAYER_ENTER_UNIT only fires for server-player not for client-player. It could be the best eventhandler for making MP scenarios. So it would be nice if it worked for both. -----------example---------------------------------------------- JIPevHandler = {} function JIPevHandler:onEvent(newClient) if newClient.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then trigger.action.outTextForCoalition(coalition.side.BLUE, string.format("###DEBUG### PLAYER_ENTER_UNIT event triggered"), 10) end end world.addEventHandler(JIPevHandler) ----------------------------------------------------------------- Thanks, .
-
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
@ ajax How do you use S_EVENT_BIRTH? Because it fires for every unit spawning in the mission. AIunits aswell? I still think S_EVENT_PLAYER_ENTER_UNIT is the function that should do the trick... if it worked in MP. . -
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
:smartass: Then it's probably most helpful if I try to explain my reason. First of all i am only interested in MP. Then most important is that every player experience the (A) same world at the (B) same moment. A. The same world for every player is actualy a multitude of copies of worlds with the original on the server. To make it work data needs to be syncronized. DCS Example: object with radio beacon spawns. Thats nice now the existing players can track the object. Pitty for the new joining player. Although he receives the object from the server. The radio beacon functionality he never receives. Unless the server tracks the new joining player event and updates the "beacon task" now all the worlds are in sync again. B. The same moment is just as important, no need to explain. To get close to the ideal situation. You could try to script elegant and efficient but functional. I do it by reducing loops and limiting recalculations of the same sum. Although not 100% sure I think an eventhandler is a fast, efficient and low cost triggered construction. Called from somewhere in the base code. So I prefere it above a selfbuild multitriggered loop construction. . -
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
I think it is preferable if you put it in your initialization script. That is an option at the botom of triggers in the ME. I am a notepad type of scripter and just initialize my script. I only use the ME for some object and triggerMarkers. I get easily confused if I want to embed my ideas using the trigger actions of the ME or with the use of others library script constructions. But thats just my limitation. So maybe what you propose is possible but I don't know. :huh: . -
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
An eventhandler is very usefull for tracking and participating on an event during the mission. In my case I am interested in a joining player. To track the event and participate with an action I use the below concept. Just Place it in the Global part of your script and it will fire. ------------------------------------------------------- JIPevHandler = {} function JIPevHandler:onEvent(newClient) if newClient.id == world.event.S_EVENT_BIRTH then --code you want to fire when a client joins (I plan to use it to sync objects with fresh players, it might need some filters. Because it fires everytime the players enters/reenters a plane) end end ------------------------------------------------------- [edit] Warning: fires for allunits that spawn in the mission also AIunits Cheers, . -
It is trouble in a way, embark\disembark functionality (helicopters) It is not possible or unknown how to trace with a script if a passenger embarked. Scripticaly the unit seems invisibly frozen on coordinate where it embarked. In other words the embarked unit has al the properties of the unembarked unit. One small word of the developer, one giant leap for the scripterskind .
-
Synchronise Joining In Progress MP client with an eventHandler?
piXel496 replied to piXel496's topic in Mission Editor
It works, thx Ajax! Somewhere I read that this only worked for server-player but that was an old post I guess. +1 on the way :) . -
Hi, The eventHandler: S_EVENT_PLAYER_ENTER_UNIT works perfect in single play. But does not execute if I join as a client in my server. Is this normal, because the EH seems a perfect solution to sync joining players? Or is there maybe an other EH I could use to sync my MP scenario with players that join the mission in progress. Thanks, .
-
That is a lot of work.:thumbup: I do not know how you formulated your static objects. And I quess you are the host-player aswell as the client-player in your examples. My tip would be open dcs.log from client-player after the connect /disconnect to see if some gfx where not succesfully loaded and hopfully see why. A wild guess would be there is a maximum you surpassed and all is not loaded. You could try (just for debugging reason what happens if you use 600 ifStillNotThen 300 items) .
-
If I sync the client by starting the server_mission when the client is in the mission. The F7 embark menu works for the client. Only gfx smoke marker behaves erratic. The server did not crash during 15 minute test. .
-
Hi BaD CrC, When I host it does not crash when I use the F7 menu. I spawn and delete the units with there intended functionality with a script. However, your comment made me test it on a stand alone server and login as a client. Then I noticed F7 was not available. So I guess embarking is a single player feature? Thanks for bringing it up. It would be grand if someone from ED or Belsimtek could give some examples or explanation how to execute the passenger functionality in MP or even tell something about the current limitations. But I fear the DCS policy of: silence the questions about WIP to death. :);) [edit] Suddenly I realize that most of the functionalities that make a decent Helicopter MP scenario is object action dependent. Like a homing beacon and sound or embarking. This has to be syncronized with players that are joining an in progress game...... .
-
Because it is fully helicopter scriptcode related I ask my question here. It is about the added ED features cargo and embark/disembark. Cargo is quirky because. If lifted, the object; cargo is nil. (if someone knows a robust method to script-connect the cargo object with a unit. Please tell. Currently I asume nearest unit as a workaround) Embarking passengers are strange because they seem to become invisible and freeze on the spot where they embark. Meaning they are not nil, active and have a static position on the map where they left. The question: What characteristic of the passenger can I use so I can identify it in my script as embarked or not there? To be honest I don't know if, there is a manual that explains the above or that it is all WIP and we are not suppost to ask anything about it or it's very simple but still to difficult for me. But what I do know, it will help me and prob. others too if someone could shine some light on the matter. Many thanks, .
-
I understand some of your frustration. 1. Simulators always ask much resources and expensive hardware helps no doubt. But my experience is that I wasted a lot of money on the most expensive controllers and that my cheapest controller did a better job. 2. Since you post in the huey forum and with regards to missions. Don't go just yet. (shameless plug) I am making a MP mission with open free flight operations and player scores. To have some online flying fun with others. I hope you like it too. 3. I do believe they create and fix more than they break. So unfortunately I don't agree on that. Communication about what happens when is a lesser developed skill. Just to not let you go. It is also about a mature community and mastering the "high grade planes" like A10, Huey and P51 you never find anywhere else. Hope to meet you online soon! :) .
-
Wow. Tres chic, Skull :thumbup: .
-
@Buznee Your wish is my command. It already became an option. :) .
-
@SiThSpAwN In the beginning I had issues because I have many interfaces connected together thrue usb. Windows sometimes after restarting or other fague reason took initial off center settings from the registry. So maybe this will help you too, they worked on my x55. clean registry settings for your saitek joystick. [edit] Just in case, for unknown reasons usb2 ports behave more consistent then usb3 on my rig. .