Jump to content

soldierXXXX

Member
  • Content Count

    100
  • Joined

  • Last visited

  • Medals

Everything posted by soldierXXXX

  1. Oh, right. MapAnimAdd only works during mission, my bad ๐Ÿ˜„. Here is fixed code. player createDiaryRecord ["Diary", ["The Hub"," For the duration of your stay you will based here at <execute expression='player selectDiarySubject ""Map"";if ((findDisplay 37) isNotEqualTo displayNull) then { private _ctrlMap = ((findDisplay 37) displayCtrl 51); _ctrlMap ctrlMapAnimAdd [1, 0.1, getMarkerPos ""theHub""];ctrlMapAnimCommit _ctrlMap;} else {mapAnimAdd [1, 0.1, markerPos ""theHub""];mapAnimCommit;}'>The Hub</execute>,a Joint Operations Centre (JOC) in Mexico.<br/>"+ "<img image='images\theHubsml.jpg' width='329' height='185' title='The Hub' /><br/>"+ "<br/> The..."]];
  2. Hi, it's doable, if you don't mind loosing the blue lines pointing to the marker. You just have to script map animation youself. For that you should use execute tag, which is part of the diary system. player createDiaryRecord ["Diary", ["The Hub"," For the duration of your stay you will based here at <execute expression='player selectDiarySubject ""Map"";mapAnimAdd [1, 0.1, markerPos ""theHub""];mapAnimCommit;'>The Hub</execute>,a Joint Operations Centre (JOC) in Mexico.<br/>"+ "<img image='images\theHubsml.jpg' width='329' height='185' title='The Hub' /><br/>"+ "<br/> The..."]];
  3. soldierXXXX

    What am i doing wrong?

    Hi, and welcome to the forum. So there is a lot of things wrong with this code. Let's get through the code. 1)you're passing only _searchlightman variable to new scope (when you use spawn it creates new scope and all variables needs to be passed or redeclared) 2)_searchlights therefore aren't defined 3)while {alive _searchlightman && alive _searchlights} you're passing whole array of lights there, that should be only one object 4)If you'll use && code will never be run, because while condition exits when condition returns false, you need to change that for || 5)if (!alive _searchlightman || !alive _searchlights) again you're passing whole array of lights there 6)There is no good reason to check the code if searchlight is dead, so you can simplify it to only check searchlight status in a while loop and searchlightman status in if condition 7)_forEachIndex is not defined here, it only exists in forEach loop 8)there is no sleep at the end of the loop which can cause whole game to freeze. While loop is iterated multiple times per frame if there is no sleep inside. Here is good explanation. If I'd followed same logic you wrote it, fixed code should look like this. However I don't really recomment this. If you'll create too many searchlightman units, you might see it on game performance because scheduler will be cluttered with these codes. I suggest to use killed eventhandler for this. It's much easier to use for this situation and also code is called only when searchlightman dies. That means you can have as many units as you want and scheduler is not cluttered. This code should be run only on the server in case it's for multiplayer mission. Either put the code below in initServer.sqf or add condition if(isServer) then {//paste the code here};
  4. soldierXXXX

    points for healing in MP

    For peace of mind, I want to share the code I put together for anyone that might come across this thread in the future. This is actually my first time messing with eventhandlers in the multiplayer script, so I spend about three days observing, adjusting and learning how events behave in multiplayer environment. I really wanted to make the event work since it was the original idea of this thread, and I believe, I managed to make it functional. This event is a bit complicated as it has to run on each client and be updated after unit respawns. Learned quite a lot I have to say as previously I only read about multiplayer scripting in theory. Still it's not my cup of tea, so if someone experienced points out something I forgot about, I'll gladly hear it. Otherwise I consider this thread resolved ๐Ÿ™‚. I tested it with instant respawn, so I hope it works on other types as well. I had one client as player hosted server and other as joined client. Tried both clients in lobby ready to play as well as JIP, and it worked in my tests. Code with debug and description: Cleaner code no debug, no description:
  5. soldierXXXX

    points for healing in MP

    Glad to hear that you got your system working ๐Ÿ™‚
  6. soldierXXXX

    points for healing in MP

    Well, since remoteExec has JIP parameter filled, when player disconnects, his unit is destroyed and becomes objNull unit dies, but JIP command persists and when new player connects he receives basically objNull deadUnit addEventhandler... not sure if that would trow error or not doesn't trow error, but it's not needed anymore, so I think it will be better to remove that request when player disconnects. That would also need some array of JIP IDs managed by the server. I believe, it's connected to the unit, so when unit dies, eventhandler is bound to that dead unit. After testing respawning seems to work even with respawned unit. So it seems to be persistent...huh...so, if I get it right,if addEventHandler is called with object player, eventhandlers are transfered to player every time from dead unit to new unit when he respawns ? I would need someone to explain it to me how it actually works. Hmmm, strange. I would need more informations. When it didn't work, did the first hint show up, how did you healed other player, was the unit same as you connected or new unit (respawned) and so on. Video might help. tested with respawn instant, so it might also work differently with other respawn types. update2: After further testing, it seems that events added on client PC is persistent only for him after respawning (that's why code above still triggers on self heal but nothing else), and for the other clients it's tied to previous unit as events cease to work on new unit. That might be fixed by removing previous event and reexecuting it when new unit spawns. That's why I don't do multiplayer scripting ๐Ÿ˜„.
  7. soldierXXXX

    points for healing in MP

    Right, so I tried the code with local hosted MP from Eden, I've put your code into initPlayerLocal.sqf and had two playable characters, one medic (client 1) and other normal soldier (client 2). I noticed that it indeed didn't show the hints, except when injured player healed himself. That is because how the event is designed. It only triggers on PC where healer is local. But in that case initPlayerLocal only added event on connected PC, that caused only self heal to be registered because addEventHandler has local effect-no other client knows that you should be registered for healing. So when I remoteExecuted addEventHandlers with JIP parameter as TRUE, It started to trigger when I used healing on the second client. That is, because client 1 at the moment client 2 connected received information to register HandleHeal event on client 2 selected character (unit), and client 2 also received information to register client1 unit event. That meant both PC had now registered HandleHeal to each other and might start to run the code properly. Eh...I'm not good at explaining this ๐Ÿ˜„ Here is the code I tried: //initPlayerLocal.sqf [player,["HandleHeal", { _this spawn { params ["_injured", "_healer", "_isMedic", "_atVehicle", "_action"]; [str _this] remoteExec ["hint"]; private _damage = damage _injured; if (_injured isNotEqualTo _healer) then { waitUntil { (damage _injured isEqualTo 0) or (damage _injured isEqualTo 1) }; if (damage _injured isEqualTo 0) then {// give healer points [_healer,1] remoteExec ["addScore",2]; [("giving points to: " + str _healer)] remoteExec ["hint"]; }; }; }; }]] remoteExec ["addEventHandler",0,TRUE]; Also this behaviour might be related to this specific event handler that needs to be registered on all clients (and possibly all the other units if player should get points for healing AIs) that should be able to heal each other. Probably because the local healer condition. Most important information is that healer runs the code on his PC and needs to know the object that he is healing has HandleHeal event registered otherwise script won't trigger. Also, this code has potential to get stucked in program flow on the healer's PC in case that he is not a medic and won't heal injured unit fully. It will wait in scheduler before some other medic heals the injured unit fully or unit dies and only after that it releases. Possibly revarding both healers (intended ?). Problem might be if client heals many units just partially, that will create many waiting scripts on that client PC that might potentially decrease performance of the mission for him. Might be better to have it handled by server as separate function. I also believe that you have to re-register the same event every time a player dies. Transfering the event to new unit. Possibly also remove event from previous unit. Removing should also be done if player disconnects and AI switches in the role. Those are some things to be considered. I'm definitely not sure how your mission is set up, so I just tried what I thought would be best. There are certainly people more experienced with multiplayer scripting than I am ๐Ÿ˜„. Still, I'm gonna hope that I helped you at least a little bit ๐Ÿ™‚. And sorry if this explanation is a bit messy ๐Ÿ˜„.
  8. soldierXXXX

    points for healing in MP

    Hi, just a quick notice, you're using [] spawn {}, but that doesn't have any params itself. Try use _this spawn {} instead. That should pass event parameters and code should run. If not, there might be locality problem. Depends how you execute the script.
  9. Hi, welcome to the forum. When you create object with createVehicle, you can see that it returns object. That means we can save the returned value into variable and we will have reference to that object. For this example I'm gonna use global variable and will refer to it as "wall". when you want to set direction to object, you can use setDir command. so full script then looks like this wall = "Land_W_sharpRock_wallH" createVehicle getMarkerPos "marker0"; wall setDir 45; Assigning variables are basic thing to do in every scripting language. You will use it a lot. You can read this article to better understand how scripting works in general.
  10. soldierXXXX

    help re nearestObjects

    Yep, probably would be better to put it between round brackets I tested it with this, {[_x, 2500] spawn {params ["_unit","_number"];systemChat str ("Unit:" + str _unit + " Number: " + str _number)}} forEach (player nearEntities [["O_Soldier_base_F"],51]); So your code should look like this {[_x, 2500] execVM "fn_taskRush.sqf"} forEach (cap0_1 nearEntities [["O_Soldier_base_F"],51]); Also I noticed that you had there empty characters, which also causing errors. If you're satisfied with @JCataclisma's code (which works), there's no actual need to change that. We're talking about milliseconds here, so regular users won't notice the difference anyway ๐Ÿ™‚.
  11. soldierXXXX

    help re nearestObjects

    Yep, you got this wrong. You can't combine nearestObjects with nearEntities. It's either one or the other. So like this: {[_x, 2500] execVM "fn_taskRush.sqf"} forEach cap0_1 nearEntities [["O_Soldier_base_F"],51]; You can of course change O_Soldier_base_F for SoldierEB,SoldierWB or SoldierGB. O_Soldier_base_F is child of SoldierEB.
  12. soldierXXXX

    help re nearestObjects

    Hi, if you need to return opfor units + opfor vehicles you can filter them with select command nearestObjects [cap0_1,["O_Soldier_base_F","LandVehicle"],51] select {side _x == EAST}; But if you need only on foot units it might be better use nearEntities which is much faster cap0_1 nearEntities [["O_Soldier_base_F"],51];
  13. Hi, as far as I know this change shouldn't affect any script in particular. While scripters use random x with combination floor, round or ceil then the number always returns integer value. In case the script uses pure random, then the autor probably didn't really needed that specific x value to be included. So that means, if you're using ceil for instance with number 5, it might generate any number between 0 and <5 so like 4.73 can be generated and ceil automatically makes it 5. If you seriously need that value to be included you can probably use linearConversion command with clip value true. something like _wantedNum = 5; _randomIncluded = linearConversion [-0.01,_wantedNum,(random (_wantedNum + 1))-0.01,0,_wantedNum,TRUE]; //should theoretically return numbers between 0 and 5 not tested IMO this change might actually help, because when I used for loop with combination of array select _i in older scripts, I always had to account for that particular case that it didn't choose that last number where no value was defined so I had to do like for "_i" from 0 to (floor (random (count _array -0.1))) do {...(Today I'm usually using forEach loop instead) And since 2.18 it could be same thing without -0.1. It's not really good example to show it on but now it will work like in other programming languages. I think that's why they changed it.
  14. Hi, Bendy, handling such system through UIEH would be really hard. Fortunately we have also user eventhandlers that can do all sorts of things. I prepared a quick example code that should be able to do what you need. But multiplayer scripting is not my cup of tea if you understand. Maybe you would also need to add functionality that would handle respawning, adding units to your group and so on. I hope that this code could help you at least a little bit. ๐Ÿ™‚
  15. Hello guys ๐Ÿ™‚, I'm starting this thread in hope, that more people can try out my missions. I'm a guy that creates missions with passion and prefers quality over quantity. Creating a mission usually takes a long time since I have time mostly during the weekends. My missions are so far always singleplayer only and scripts used in game are created from scratch, so I can have full control over what is possible to do in those missions. But enough about me. Here are my currently released missions: ==================== Latest mission: Exhibition of Life and Death This mission is my attempt to create an horror mission in arma 3. Short description: You work as a security guard at Lars Blanken gallery in Amsterdam. Today a new exhibit has been moved in the gallery, and for you and your colleague Frank, this night will become a real nightmare. Features: -Horror themed mission -Highly focused on atmosphere -Fully voiced -Translated in english and czech language -Short linear scary mission -Each item in the gallery has its own history -Optimized scripts and mission to achieve high FPS -No mods or DLCs required Steam workshop page here ==================== My older missions: Silent overwatch Sniper support mission Short description: Fia is hiding weapons in one of their camps on Altis. You were send together with Tango 6. Your task is to protect Tango before they destroy these weapons. Features: -Intro -Fully voiced -Fully localized in EN and CZ language -High FPS -Possible replayability -Compactible with ACE3 -Hidden easter eggs -Different experience if you join Tango 6 -Possibility to take different weapon Requirements: RHSUSAF mod Steam workshop page here Windbreakers Air combat mission with customizable parameters. Short description: NATO launched an airstrike on Altis airfield controlled by CSAT forces. Your task is to secure the airfield. Features: -Mission Parameters system -High replayability potential -More mission endings -ACE3 compactible scripting -Hidden easter eggs -Mission won't end if you crash your jet -Fully localized in EN and CZ language -Fully voiced -Custom music Requirements: Jets DLC or any aircraft mod that is capable to launch from USS Freedom Steam workshop page here ==================== That's it for now ๐Ÿ™‚. Hope you'll like it. I'll gladly read your feedback ๐Ÿ™‚.
  16. Maybe only one thing to improve. If player decides to remove the custom waypoint, remove draw event as well, so the game doesn't have to check the code each frame. When he places new waypoint that event will be always removed anyway, so I see no point in checking that condition further. addMissionEventHandler ["MapSingleClick", { params ["_units", "_pos", "_alt", "_shift"]; if !(_shift) exitWith {}; if !(isNil "MyDraw3DMarkersEH") then {removeMissionEventHandler ["Draw3D",MyDraw3DMarkersEH]}; _EH = addMissionEventHandler ["Draw3D", { drawIcon3D ["\a3\3DEN\Data\CfgWaypoints\Move_ca.paa", [1,0,0,1],_thisArgs select 0, 1, 1, 0, "", 1, 0.05, "TahomaB", "center", true]; //systemChat ("running " + str diag_tickTime);//debug if (customWaypointPosition isEqualTo []) then { removeMissionEventHandler ["Draw3D",MyDraw3DMarkersEH]; //systemChat "Not running";//debug MyDraw3DMarkersEH = nil; }; },[_pos]]; MyDraw3DMarkersEH = _EH; }];
  17. Nice one @pierremgi You solved it quicker than I had a chance to get to my PC ๐Ÿ˜„. I actually like this solution a lot more than the one I had in mind. I wasn't aware that we have a command that retrieves that position, so that makes things a lot simpler ๐Ÿ˜Š.
  18. Alright, I'll see what I can do ๐Ÿ˜‰.
  19. Hi, we can't change the color directly. There is no access command and the function to create that waypoint marker runs internally. The only way you can achieve something similar is to create function that will draw over it. You can customize it by your needs. Paste the code to initPlayerLocal.sqf or else where the code would run locally. addMissionEventHandler ["MapSingleClick", { params ["_units", "_pos", "_alt", "_shift"]; if !(_shift) exitWith {}; if !(isNil "MyDraw3DMarkersEH") then {removeMissionEventHandler ["Draw3D",MyDraw3DMarkersEH]}; _EH = addMissionEventHandler ["Draw3D", { drawIcon3D ["\a3\3DEN\Data\CfgWaypoints\Move_ca.paa", [1,0,0,1],_thisArgs select 0, 1, 1, 0, "", 1, 0.05, "TahomaB", "center", true]; },[_pos]]; MyDraw3DMarkersEH = _EH; }]; Also, this is just example how can it be done. Don't expect fully working code. For instance the icon will persist if you delete the custom waypoint.
  20. Hi, your syntax is wrong. Script you wrote sometimes converts to [MainSupplyBox,[true]] call BIS_fnc_addVirtualWeaponCargo; istead and that will add %All into the arsenal which is not class and that is throwing an error. Correct syntax is : [MainSupplyBox,selectRandom ["CUP_arifle_L85A2","CUP_srifle_M107_Base"], true, true] call BIS_fnc_addVirtualWeaponCargo; Also BIS_fnc_selectRandom is not recommended to use since we have selectRandom command which is about 3-6x faster.
  21. Yes I'm aware that the code runs runs on client, but somehow when in multiplayer environment internal map function seems to act differently when you write that code. I don't really see how it might interfere like that, and if even is possible to write the code differently. You demonstrated it enough, and the best thing to do now is report it to feedback tracker. Seriously can't wrap my head around how can such simple code broke default function like that, makes no sense.
  22. Hmmmm. That actually seems like a bug honestly. This code should not actually do anything like that. If I would be you, I would report it to feedback tracker. Seems like on dedicated server internal function that should return the map to player's position doesn't run. It's weird that it does that only when you write that code. Great video, that should help even developers to understand what's going on. I'm afraid i can't help you more, as I cannot see what's happening inside the engine. But definitely report it.
  23. The code should run locally to each machine separately so if you already didn't, put the latest code to initPlayerLocal.sqf. Doubt it, Draw eventhandler is there just to update the position where you are looking before closing the map. It updates each time the map is rendered (so basically each frame). What actually causes the map to move is Map eventhandler, especially this part of the code: mapAnimAdd [0,missionNamespace getVariable ["MapCurrentZoom",ctrlMapScale _map],missionNamespace getVariable ["MapCurrentPos",_map ctrlMapScreenToWorld [0.5, 0.5]]]; mapAnimCommit; That won't help at all. Actually this is the most efficient way i cound've come with. Putting variable updating like in each frame event would do basically the same thing except then the code would run even if map wouldn't be opened, so you would need to check each frame if map is opened or not. Creating separate function that would run in scheduler would take resources from other scripts and would also not be as efficient. Please try my latest code and put it into initPlayerLocal.sqf, if the problem still persists please make a video of the issue, so we can see what is actually happening. Be aware that map zoom remains the same with or without the function running. Best case to test how it works is Altis map. Move the map to completely different area. When function is running it will return there, if not map returns near the player (never centers directly on the player).
  24. Hi again. You were right. When I looked at the code, and tested it now (a few months later) I noticed, when you wanted to switch the map on and off it behaved just as you described even in singleplayer. Originally I wrote the code for just one execution so it would be consistent during whole mission. I noticed draw eventhandler began to stack as it was created everytime map opened what must've created some performance issues later in the game. I tought when map would be closed, the event will stop firing, because control event is destroyed when display is closed and control returns "No control" (or controlNull which is the same). But ((uiNamespace getVariable "RscDiary") displayCtrl 51); still returns control so I guess RscDiary is not destroyed but instead is hidden and that caused the eventhandler to be added again and again to the same control. I guess map display is still opened but hidden through whole mission, and only shown when map key is pressed. Creating and destroying whole map display would not make sense from optimization perspective and that's completely understandable. So you were right, it was not neccessary to add it everytime and it SHOULD be added just one time. I rewrote the code so now it should behave correctly. I separated the code to two functions Add and Remove. I believe now the code should behave as you originally wanted. Let me know if you need further help.
  25. Sadly, that's not possible without creating a little mod. Characters are created on the engine side and are put together by config. Only commands available are setFace + setIdentity and they both works only with cfgFaces. It's a bit sad we can't do it in other way. Only characters you can fully customize with setObjectTexture are VR men. For normal characters only their clothing can be textured.
ร—