Jump to content

f2k sel

Member
  • Content Count

    4462
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by f2k sel

  1. Excellent I'll take a look later.
  2. If "ANIMAL" works all well and good, I didn't look at that as they are also being found as "MAN" , it may just be an issue with nesarestobjects that allows it show as "MAN" Also you will need to check if dog still works.
  3. Short answer no but this should work (!isnull _this) I knew they were some sort of animal you may be able to filter them out using typeof like We do for "pastor" somehow. It may be better to search the string for the letters AGENT I did it in the past but I'd rather not as it's quite slow. Just thought aren't they Civillian? Names are not correct just an example of what may work it will need correct filetypes. if (typeof _deadguy in ["sheep","hen","cow","goat","ect"]) exitwith {hint "dead animals"};
  4. Maybe I need to test using that, right now I'm just forcing the script to run as it's quicker than having to shoot the units.
  5. Strange as I don't get that error, the only difference seems to be you dropped setvariable down a line,you also had this error //EDIT: I got this randomly while testing other stuff and killing units in the process: I don't get that either. _finder_free has to be objnull or _deadguy I din't know how your adding the eventhandler I don't have that bit of script. There's another odd line in dogpatrol that makes no sense. {if ((side _perro)getFriend (side _x) <0.6) then {_HumanosVivos = _HumanosVivos + [_x];_perro knowsabout _x; _unidad knowsabout _x;}}forEach _HumanosCerca; Unless I'm missing something they should be reveals as it's should be revealing the human threats to the dog, I need to check that.
  6. I added an extra line so that it will display correctly and an _ to make it a little clearer No it won't find the dog but that's because the Line of sight seems to ignore Dogs for some reason, I also checked Knowsabout and that shows 0 for dogs so that won't work either. You can try adding your eventhandler to the dog just after _perro setVehicleVarName _NombrePerro; _perror addeventhandler ect, and then in findbody between the old script add the bold lines, it will simply send any close unit to the dog, there are no line of sight checks or knowsabout it's just forcing a unit to move to it. _finder_free = _x getvariable ["free",objnull];// check if assigned if (typeof _deadguy == "Pastor" and (isnull _finder_free) and (typeof _x != "pastor")) exitwith {_x setvariable ["free",_deadguy];// assigned to deadguy _x domove _deadguypos;// _deadguypos; _finder = _x; };//exitwith ends loop if (_return and (isnull _finder_free) and (typeof _x != "pastor")) exitWith {
  7. The dog is a little tricky to deal with, you can't really control him as the other script keeps taking over. I can exclude him by using typeof so he doesn't get assigned to _deadguy The dog owner can find the body as is but if you don't want that just add his name to the exclusion array like you did for sleeper_1 I don't seem to get any of the other errors in my testing but I don't have all the other scripts messing things up. I did change detected to _detected as that would be picked up over multiple scripts. if (_return and (isnull _finder_free) and (typeof _x != "pastor")) exitWith { that is were I added the exclusion for the dog, if you use other dog types then you will need to adjust that line. It shouldn't be sending message but it will show in arrays with that funny number, I don't think his naming of the dog is working correctly it should be K9 with a random number .
  8. I can try both maybe have it as an option but a bit pressed for time today. You better post your current findbody script and I'll try and work from that otherwise we'll keep having to convert from mine to yours and run the risk of more errors creeping back in.
  9. How do you want them to function in the code, as _finder or excluded from it. I've not messed with dogs a long time so I need to look at that.
  10. I can only guess about dogs, they won't be picked up by nearestobjects as it using "MAN" they are "ANIMAL" Not sure about the error, if you can find out when it happens, no units or dogs around ect. It's odd because it was defined a line or two before.
  11. Not at PC so nothing tested. _shout1 spawn {sleep 1; terminate _this}; group _finder setVariable ["endscript",true]; To be honest I can't remember why it's being spawned or uses a sleep so try it and see which works best. So when A dies B becomes _finder for A but gets killed when moving and next living unit won't move to either? Is that's correct ?, if so it's probably due to _finder setvariable ["free",objnull];// reset as unassigned not being reset as it depends on _finder being alive. try moving it to just after the sleep 4; if (!isnull _deadguy and alive _finder) then { _finder setunitpos "middle"; _finder disableAI "MOVE"; _finder reveal [player, 1]; //NEW WIP // _finder setvariable ["free",objnull];// reset as unassigned _preAlarm = true; };// changes stance if body found sleep 4; _finder setvariable ["free",objnull];// reset as unassigned or leave as is (don't remove previous setvariable ["free") and just add an alive check Sleep 4; if (!alive _finder) then {_finder setvariable ["free",objnull]};// reset as unassigned That may be better as it won't create unnecessary variables .
  12. Ok looks like I sorted the multiple script problem and it seem to work quite well in my script which lacking a lot of your extras. I've also made this version detect only things the unit can really see although it should be easy to switch that back to knowsabout. This is using cut down version and uses short time delays for testing, also not using agents so no reference in script. Test on blank map or rename if you want to try it, there is a second script (function) that does the line of sight check. make sure you mod the init.sqf by adding i_see = compile preprocessFile "FNC_line.sqf"; save as fnc_line.sqf Tested with vehicles and the script does ignore them and only units that can see a body will be sent to it. If one unit sees two bodies close together it may get sent to both because there are no other units available which looks quite realistic to me. Also changed how the array is built using set is about 10x faster than +[] also moving -[eagle1,eagle2] to the nearesobjects is more efficient.
  13. I agree about the name I don't often use it myself although I thought if you give it a name it uses that instead of default name. What happens if a unit is in a vehicle, does it drive to it or is it ignored by script I haven't checked. I never really got used to Notepad++ I know it's up to date but I've been using ArmaEdit for so long I end up going back to it. I'm still trying to stop multiple scripts from running and selecting the same unit, if that happens the first script stalls out as the unit is redirected to another _deadguy, I think it gets stuck in the waituntil and then just exits when _deadguy is hidden after it times out.
  14. sorry missed that one _finders is an array so it won't work, you could examine the array using foreach)and then display each unit one by one or make an array of names and use that instead of _finders but is it really needed as it all has an impact on speed. it will work in here if (mein_debug>0) then {player globalChat format ["FindBody.sqf - _finder:%1 detected corpse:%2",name _finder,name _deadguy]; }; You could easily add any units you want to an exclusion list and remove it from the _finders array. just make local _agnt no need for global variable.
  15. I'm not at PC right now but there is this https://community.bistudio.com/wiki/canMove Although I don't know off hand if it works with DisableAI, you may also need a health check canstand _x other wise you could assign an injured unit If it does work then you will either have to add it to the the array pre check condition or enableAI "move" before issuing the domove, also bring agnt = []; //test or I think the array will keep expanding every loop while { (!_preAlarm AND !isnull _deadguy) } do { _finders = [];// clear array for refreshing agnt = []; // clear array for refreshing { agnt = agnt + [agent _x] } foreach agents; //test {// foreach nearobjects if (alive _x and canmove _x) then {_finders = _finders + [_x]};// build array of alive units } foreach ( nearestObjects [_deadguypos, ["Man"], 100]);// look through units I'm not really following with the array think but I don't think you can use the actual name to address unit's As it's only really a display issue then doing this should work. if (mein_debug>0) then { player globalChat format ["FindBody.sqf - corpse:%1 _finders:%2",name _deadguy, name _finders]; } it will only look for the default name if it hasn't been named when created.
  16. In my tests agent was being removed form array but if _deadguy was an agent it would still display agent as it isn't checked for. hint str (nearestobject [_deadguy,"man"]);// will let you know if deadguy is an agent Or hint str (name (nearestobject [_deadguy,"man"]));// instead of it showing as agent it will report the default character name. or if (mein_debug>0) then {player globalChat format ["FindBody.sqf - deadguy:%1 in FeruzAbad.", name _deadguy];};
  17. it should be fine. I did notice another issue the following line will never exit if _deadguy is deleted before finder reaches it. if (!isnull _finder or !alive _finder) then {waituntil{sleep 1;!alive _finder or _finder distance _deadguypos <4}};// checks finder status change to if (!isnull _finder or !alive _finder) then {waituntil{sleep 1;!alive _finder or _finder distance _deadguypos <4 or isnull _deadguy}};// checks finder status I've also noticed an issue where the closest unit is sent to a _deadguy but if a secondu unit is killed it will be sent to the second _deadguy ignoring first. I thought about setvariable but it doesn't really work if two units die at about same time setvariable isn't up and running so checking for it doesn't work if that makes sense.
  18. The only problem with the lookat line is it's being executed every four seconds. OK tried it another way fist was to just move the forced look inside the and remove original forced look to stop spamming the code. {// foreach finders // if (random 15 > 10) then {_x lookat _deadguy;hint "looking";sleep 3;_x lookat objnull;_x setformdir random 360};// adjust random to look more or less often another way was to replace knowsabout with an actual line of sight check which seems to be working so units who can't see the dead guy won't be sent to body. You do get less bodies found but it's more realistic but it still needs more testing as I had one error that I can't replicate.
  19. I just tried deleting body and get the same but it's not really an error it's just telling you the state of _deadguy it no longer exists.
  20. I noticed in both scripts the problem is if they don't see the unit die it doesn't register with knowsabout , if all units know less than 0.4 the loop ends. They can't see dead bodies. That's not true they can see it. Maybe units should look at dead body when crows arrive then the script should fire. I threw in this line right after this line _finders = _finders - [eagle1,eagle2,agnt];// remove elements, [_deadguy,_finders] spawn {_deadguy = _this select 0; _finders = _this select 1;sleep 30; {_x lookat _deadguy;sleep 1} foreach _finders };// I see crows Now even a unit who is looking away turns to look at body when crows arrive.
  21. Your forgetting that the current scope is the foreach so it exits back to the while example , this just exits the foreach when _x is greater than 2 the while continues to loop. while {alive player} do { hint str time/60; {player sidechat str _x; sleep 1;if (_x > 2) exitwith {hint "End foreach scope"}} foreach [1,2,3,4,5,6]; sleep 1; };// end while Agents are strange, they report as "men" the only command thing |'ve come up with it to build an array of them. Agents returns an odd array which you can't seem to remove them directly form nearestobjects so I build a new array and remove that also note this bit [agent _x] you need to use the prefix agent agnt = [];{ agnt = agnt + [agent _x] } foreach agents;hint str (nearestObjects [thistrigger,["man"],100] - agnt); //does seem to work so in your code you would use agnt = []; { agnt = agnt + [agent _x] } foreach agents; _finders= _finders - agnt; I'm not sure what happens if deadguy is an agent.
  22. Ok I see. if (!isNil "_shout1") then {terminate _shout1;}; should work did you define it so it will work outside of the scope where it is created. something like _shout1 = nil; at benining of script. The problem may be that some variables will not get rest correctly.
  23. I only wrote it to see if I could tidy it up a little. I just tried creating some agents and the although it finds them the script still seems to work around them without any issues. while { ({alive _x} count units (_unit_group) > 0) && _loop and ((leader (_unit_group) distance _target < 120) OR (leader (_unit_group) distance player < 120)) } do //repeat cycles as long unitis not killed this seems to be the bit that's doing the looping. If the finder moves away from the player > 120 it ends. you could try and mod it like this and see if it helps _loop = true; while { ({alive _x} count units (_unit_group) > 0) && _loop and ((leader (_unit_group) distance _target < 120) OR (leader (_unit_group) distance player < 120)) } do //repeat cycles as long unitis not killed { _loop=false; sleep 1;
  24. I've not had that in any tests, maybe one of your other scripts is creating something example _agent = createAgent ["SoldierWB", position player, [], 0, "FORM"]; I'll have to try it later with some of them around and see what happens. I can't really test shout as I don't have ace but I may be able to find a way to kill it. I did rewrite the whole front end using just one nearestobjects but I'm not sure it will interface correctly with rest of your script and I may have missed something. _deadguy = _this select 0; _killer = _this select 1; _remove = []; _finders = []; _finder = objnull; _prealarm = false; _deadguypos = getpos _deadguy; _deadguy spawn { sleep 3; _Body_Vultures = [_this] execVM "scripts\crows\BodyVultures.sqf";sleep 20;hidebody _this;sleep 4;deletevehicle _this };// default effect if (side _deadguy == side _killer) exitwith {hint "sides same"};// side check while { (!_preAlarm AND !isnull _deadguy) } do { _finders = [];// clear array for refreshing {// foreach nearobjects if (alive _x) then {_finders = _finders + [_x]};// build array of alive units } foreach ( nearestObjects [_deadguypos, ["Man"], 100]);// look through units _finders = _finders - [eagle1,eagle2];// remove elements, {// foreach )finders if (_x knowsAbout vehicle _deadguy > 0.4) exitWith { _x domove _deadguypos; _finder = _x; if (mein_debug>0) then {player globalChat "FindBody.sqf - AI detected body";}; _shout1 = [leader (group _finder), _killer] execVM "scripts\ShoutSound.sqf"; };//exitwith ends loop when finds first guy that knows >0.4 } foreach _finders;// end foreach finders if (!isnull _finder or !alive _finder) then {waituntil{sleep 1;!alive _finder or _finder distance _deadguypos <4}};// checks finder status if (!isnull _deadguy and alive _finder) then { // examine body _finder setunitpos "middle"; _finder disableAI "MOVE"; _finder reveal [player, 1]; //NEW WIP _preAlarm = true };// changes stance if body found sleep 4; };// end while // rest of code
  25. True and triggerActivated trigger1 is equal to WP Target destroyed and trigger1 activated so both need to be true. If you were to use just triggerActivated trigger1 the unit would just wait for the command to turn true. The Destroy waypoint only works when attached to an object other wise it will just default to true.
×