Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×

soldierXXXX

Member
  • Content Count

    121
  • Joined

  • Last visited

  • Medals

Everything posted by soldierXXXX

  1. There is. Depends on your needs, simple rotation can be obtained by getDir which will return degrees from 0 to <360. Basically the same as if you look at the compass. And if you need advanced rotation, it can be obtained by vectorDirVisual usually used with combination of vectorUpVisual. That will return vector format of the actual object rotation. You can imagine that like a direction from object model center to the nose of the helicopter for vectorDir and for vectorUp direction from model center to the rotor. That you'd use if helicopter landed in a steep hill or something. Another function might be BIS_fnc_getPitchBank, but I'm not sure if that's what you're looking for.
  2. Hi, try to combine the trigger with land or flyInHeight command. Since 2.18 there is also another syntax for landAt command.
  3. soldierXXXX

    Script help please

    Hi, to do that, you might want to select the fireplaces that are inflamed and then compare it to array which include only correct combination. For example: ([F1,F2,F3,F4,F5,F6] select {inflamed _x}) isEqualTo [F1,F3]; Order is important here. If you'd work in the future on something similar, where you would not know the order, sorting array of unknown object might return wrong order. To solve that you would need to compare strings instead of objects Example here: private _arrFull = [F3,F2,F1,F4,F5,F6];//example of random order that would not be detected with above code private _arrCorrect = [F1,F3] apply {str _x}; private _inflamed = (_arrFull select {inflamed _x}) apply {str _x}; _inflamed sort TRUE; _arrCorrect sort TRUE; _inflamed isEqualTo _arrCorrect;
  4. soldierXXXX

    Detect player placed mine in trigger

    Hi, you could put a simple condition into the trigger, that will check if there are active mines inside the trigger zone. You can customize the amount of mines needed to trigger your task as complete. In this example you need 3 active mines to activate the trigger. count (allMines inAreaArray thisTrigger) >= 3;
  5. soldierXXXX

    Player leave Ai group

    Quick tested the code again, this time with initPlayerLocal.sqf and pasted my code from this page inside, launched multiplayer mode from eden and still got no error on my end. So I guess the cause will be really some invisible character that got into your code when you copied it. Try to delete the code and paste it again. Of course I encurage you to check the code for invisible characters as well. As I said, sometimes it happens unintentionally and error message appear with the same "Unexpected number in expression" error. For your other question, I usually recommend youtube channel Feuerex which helped me the most when I learned scripting. The guy provides deep explanation on how scripts and systems in arma 3 works. Of course the source of all knowledge Introduction to Arma Scripting which will teach you the basics. And then, this forum, where you can look at other people's codes and learn from them. There are usually more ways to do stuff and script from person 1 will be different from person 2, so don't learn it like a poem, but rather try to understand what is happening in the script. Scripting is not easy, especially for beginners and it takes time to understand it...a lot of time, so don't give up when things don't work first time. I recommend to start with simple things, like showing a hint ingame when something happens and then slowly do more and more challenging scripts when you feel like you're ready.
  6. soldierXXXX

    Player leave Ai group

    Yes, no major change was done on this part. I cannot reproduce this on my own. When the error happens ? Do you have any steps to reproduce ? Sometimes message from rpt file helps us to understand what's happening. To test that I've tried to spawn new unit with group player createUnit ["B_soldier_UGV_02_Science_F",position player,[], 0, "NONE"]; and no error appeared, action was shown as expected. Try to test the script running alone without other scripts. Also try to check for invisible characters in proper text editor like notepad++. Sometimes when you copy from here some invisible characters are added. You can also test that if you try to put the code here into code block. Red circle indicates where it is.
  7. soldierXXXX

    Player leave Ai group

    Yes, I updated the script and currently works for all AI units that are on player's side, including other player's group AI members. If you need to exclude groups that doesn't include any player I would have to update it again. Well, I have to admit I'm kinda confused by this sentence. Can you explain further, how you expect the script to behave ?
  8. soldierXXXX

    Player leave Ai group

    Ah, right. I overlooked that :-D. Action was added to all units that were available at the mission start (editor placed). I've edited the script, so now it should be added to only units that are on player's side. By your subordinates you mean all friendly units or your group only? If all units that are moving on the map, which I think it's better approach if you want to send them to defend cities, do you need also restriction to not be able to recruit other player's AI units or that is not necessary?
  9. soldierXXXX

    Player leave Ai group

    You can put it into initPlayerLocal.sqf , trigger, separate file, init.sqf...basically anywhere you want. But preferably into initPlayerLocal.sqf
  10. soldierXXXX

    Player leave Ai group

    I gotta ask, have you also tried my script? Seems to me that all issues you have right now are already solved in it.
  11. soldierXXXX

    Player leave Ai group

    So if I'm right, you need to be able to recruit AIs one by one like in your current function, then assign them a task like move here and then be able to left the group, so AIs are all still together and not each AI in it's own group correct ? Well...I tried to put some code together that would allow this behavior. Let us know if that is what you're after 🙂.
  12. soldierXXXX

    Player leave Ai group

    Hi, yes. It is simple, you just have to join to non existent group. Group you'll leave will choose leader automatically, so no need to worry about that. [player] joinSilent grpNull; (group player) deleteGroupWhenEmpty true; Since you joined non-existent group, engine will automatically create new group for you. And thus we have to ensure that when you either die or join other group or so, that newly created group will be deleted once it's empty, otherwise you might reach number of groups limit.
  13. Hi, Your idc for RedeployButton is 2. That is a engine reserved number that simulates "cancel" button. 0-7 are exit codes and 0-2 will always close the dialog/display. What's probably happening is that dialog is closed before buttonclick code. Because control is destroyed, event is automatically destroyed with it, otherwise you'd see your code working or at least returning the hint. So try to change your IDCs to greater number like 1000 or so. Also your script is pointing to display 9500, but in Rsc you defined IDD 9000 and other controls are also different by +500 in the script. That might also be the case.
  14. @avibird 1 May I ask, where did you put the code ? And have you modified it in any way ?
  15. Hi, your code has wrong syntax. Trying to call the code every frame might decrease performance and cause network traffic to be filled with requests. That would certainly cause desynchronization and potentially even game crashes. Try to put this simple code into initServer.sqf [] spawn { scriptName "OxygenSetter"; while {TRUE} do { allUnits apply {_x setOxygenRemaining 1;}; sleep 5; }; };
  16. soldierXXXX

    BIS_fnc_showSubtitle broken?

    Hi, it works on my end. Try to check ingame options if you have subtitles turned on. Options->Game->Subtitles->Enabled. Or run command getSubtitleOptions in the console, that should return [true,true]. If you have it enabled, try to check what is returned by running this script in debug console. _scriptHandle = ["CROSSROAD", "Mission is a go, I repeat, mission is a go, Crossroad, out."] call BIS_fnc_showSubtitle; if (isNull _scriptHandle) exitWith { if (getSubtitleOptions select 0) then {"Function ran into some problem, deeper check needed"} else {"Enable subtitles in game options"};}; "Script ran witout issue";
  17. Hello, the loop speeds up because while loop is still running, even when you delete the sign. You can see this, because you assign global variable of the same name to the new object. Meaning now you have two loops running and overlaping each other. And more signs you spawn, the worse it gets. To prevent this, you should use local variables instead combined with condition that exits the loop when it's no longer needed. I modified your code a little bit, so you can see how can it be done. If the sign is deleted, loop gets to the end and exits when condition is not met.
  18. Hi, if I understand correctly, you only need to check when all artillery units ceased to fire, right ?. You can do it by checking unitReady. Obviously, this should be put after artillery started firing. _artilleries = [arty1,arty2,arty3]; { _x doArtilleryFire [[3000, 120, 1000], "8Rnd_82mm_Mo_shells", 3]; } forEach _artilleries; waitUntil {sleep 3;(_artilleries findIf {!unitReady _x}) == -1}; hint "artilleries ceased to fire"; With eventhandlers...that's not how they work. They cannot be used as replacement for conditionals. Events are fired when specific engine coded script is done. It happens in the background even without you knowing it. Event is called when unit changes animation (animDone), gets hurt (HandleDamage, Hit, Hitpart), reloads weapon (Reloaded) and so on . So to have something practical to explain on, when unit dies, it calls killed event. Then the game checks if any code is added to unit via addEventhandler with "Killed" type and runs all assigned codes. If you add eventhandler it stores the code in some query, or array and when event happens, game runs every code stored in that query. Code is running in unscheduled environment (cannot be paused with sleep/waitUntil). More importantly it's completely new scope, the code is separated and cannot see code above or bellow. Code you wrote will always return false, because it's in the scope that is not direct parent of eventhander scope that means _isShooting in function is not the same variable as _isShooting in event code even when they have the same name. Take a look at this. If you need deeper understanding of that, you can experiment and simulate similar behavior in some of your own function with BIS_fnc_callScriptedEventHandler which will behave like engine scripted code and somewhere else BIS_fnc_addScriptedEventHandler which then simulates addEventHandler behavior. So my quick fun to make idea is try make door opening script and add functionality to be able to call external code with scripted event whenever doors open/closes. I'll understand if it's too complicated. It takes time to fully get what eventhandlers do. Also I made function that checks if some bullet is still flying. Returns TRUE if any bullet is still in air, FALSE if no bullet is flying. Might be useful for someone.
  19. 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..."]];
  20. 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..."]];
  21. 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:
  22. soldierXXXX

    points for healing in MP

    Glad to hear that you got your system working 🙂
  23. 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 😄.
  24. 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 😄.
  25. 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.
×