accuracythruvolume 547 Posted January 3, 2017 On 1/1/2017 at 9:36 AM, phronk said: Works fine in my MP mission tested on a dedicated server with spawned civilians (Civ spawning script used: Engima's Civilians) but the only difference was the 'civFlee' function was defined in it's own script containing functions. How did you integrate this into Engima's civs? I use that in my missions and this would be a great addition. Thanks! --ATV Share this post Link to post Share on other sites
phronk 898 Posted January 3, 2017 After the line in the engima civs script which creates the unit, I add the eventHandler to the unit. Share this post Link to post Share on other sites
accuracythruvolume 547 Posted January 4, 2017 so in engima's ServerFunctions.sqf: if (count _pos > 0) then { _group = createGroup _side; _unit = _group createUnit [_unitClasses select floor random count _unitClasses, [0, 0, 100], [], random 360, "FORM"]; **** INSERT eventhandler HERE?? **** <--- ENGIMA_CIVILIANS_INSTANCE_NO = ENGIMA_CIVILIANS_INSTANCE_NO + 1; _unit setVehicleVarName "ENGIMA_CIVILIAN_UNIT_" + str ENGIMA_CIVILIANS_INSTANCE_NO; doStop _unit; _unit setPos _pos; [_unit] spawn _fnc_OnSpawnCallback; }; Have you seen any weird behavior / conflicts with your script and Engima's civs as of yet? Thanks again. Share this post Link to post Share on other sites
davidoss 552 Posted January 4, 2017 Why this? there are already OnSpawnCallback function for unit. You can see it even in your example above. Go to the configuration file ConfigAndStart.sqf Find this line: ["ON_UNIT_SPAWNED_CALLBACK", {}], add your eventhandler there: ["ON_UNIT_SPAWNED_CALLBACK", {_this addeventhandler ..blahblah}], Share this post Link to post Share on other sites
froggyluv 2136 Posted January 4, 2017 Ecstatic these animations were found -they were in Arma 2 I believe. We need these so much and thanks for the script. 1 Share this post Link to post Share on other sites
accuracythruvolume 547 Posted January 4, 2017 13 hours ago, davidoss said: Why this? there are already OnSpawnCallback function for unit. You can see it even in your example above. Go to the configuration file ConfigAndStart.sqf Find this line: ["ON_UNIT_SPAWNED_CALLBACK", {}], add your eventhandler there: ["ON_UNIT_SPAWNED_CALLBACK", {_this addeventhandler ..blahblah}], d'oh I shoulda seen that. Thanks for the clarification! --ATV Share this post Link to post Share on other sites
zagor64bz 1225 Posted January 5, 2017 @phronk AWESOME script. I've been able to get it work with COS, just by adding the whole "init.sqf" to the addscript_Unit.sqf....works like a charm! 2 Share this post Link to post Share on other sites
ddaydawson 3 Posted January 5, 2017 Hey All Sounds like an awesome script! Has anyone tried it with ALiVE? I'm looking forward to trying it. Thanks 1 Share this post Link to post Share on other sites
orcinus 121 Posted January 5, 2017 Hi phronk Brilliant idea, the way vanilla civs wander about during firefights as if they were strolling through a park has always bugged me. Thanks, looing forward to trying it out. Share this post Link to post Share on other sites
froggyluv 2136 Posted January 7, 2017 Anyone gotten this to work with TPW's spawned civs? Ive added the Call into where the civs are spawned but it seems to work in a delayed fashion. Meaning Ill shoot at a crowd and they dont react, but then ill see a lone civ running scared a block away Share this post Link to post Share on other sites
accuracythruvolume 547 Posted January 10, 2017 I didn't have much luck using the callback function in enigma's civ script so I just inserted it directly. Works awesome. Phronk, I also merged the arrays of class names that you have for all the buildings for the declared maps and made just one large array (got rid of duplicates) and got rid of searching for what map is loaded. I don't see any impact behavior so you might just want stick with one array of every enterable building known. That might simplify things a bit and provide maximum map compatibility. --ATV Share this post Link to post Share on other sites
P4T3R_ 11 Posted February 20, 2017 Thank you for this awesome script! But i have no idea how to implement it into the enigma civ script..can anyone give me an example, please? Sorry for my bad english.. Thanks Share this post Link to post Share on other sites
JD Wang 352 Posted March 5, 2017 Hey @phronk thanks for this, it's an awesome script that I think I'll be using in just about every mission going forward. One question though is there some way to take into account suppressors? At the moment the EH just works off the distance to the person firing. Is there some way to adapt it so that range shrinks if the weapon fired has a suppressor? Thanks again for the script, it's great Oh and one more question, is there any way to turn if off on a certain civilian? I wouldn't want my informant running away Share this post Link to post Share on other sites
Haymaker 13 Posted May 28, 2017 Anyone have a Lithium/JBAD buildings houses list? Share this post Link to post Share on other sites
mrsandbox 36 Posted August 25, 2017 Really great Script ! Is there are way to modify the distance they react to? I saw that the firedNear eventhandler just triggers in a distance of maximum 69 meters. Share this post Link to post Share on other sites
Tankbuster 1746 Posted August 25, 2017 I do something similar, but I have them run to the nearestBuilding, rather than choosing one at random. It takes away some randomness, but saves a CPU cycle or two. Share this post Link to post Share on other sites
mrsandbox 36 Posted August 25, 2017 i think you missunderstood. What i wanted to change was the distance they go in panic mode if a shotis fired. Right now civilians which are more then 70 meters away from the shooter dont react. Looks stupid if they have their animations stil standing around. but the eventhandler fired says in the biki, is only until 69 meters. im searching for a way to raise the distance to the gunshot they react. maybe a triggerare where they react would be cool. tried to code somtehing but my skills are not the enough sadly. Share this post Link to post Share on other sites
katipo66 94 Posted August 25, 2017 I just want to say i appreciated your video explaining how it (the code) works. Share this post Link to post Share on other sites
rdme 3 Posted November 16, 2018 On 25/08/2017 at 11:47 AM, Tankbuster said: I do something similar, but I have them run to the nearestBuilding, rather than choosing one at random. It takes away some randomness, but saves a CPU cycle or two. @Tankbuster is this a modification of phronk's script or something different you have put together? either way i'd like to have a look if you're willing to share, always keen on comparing scripts and weighing up efficiency vs effect. Share this post Link to post Share on other sites
Tankbuster 1746 Posted November 16, 2018 Just now, rdme said: @Tankbuster is this a modification of phronk's script or something different you have put together? either way i'd like to have a look if you're willing to share, always keen on comparing scripts and weighing up efficiency vs effect. I don't use @phronk script, to spawn my civilians. I use my own little routine within a large script that populates my primary targets with enemy assets. I'll dig it up and post the relevant bits in my own thread so as not to clutter up this one. *edit* Rather embarrassingly, I don't appear to have written that code, or at least I can't find it. Give me a couple of years to get it done. :) 1 Share this post Link to post Share on other sites
HazJ 1289 Posted November 17, 2018 1 hour ago, Tankbuster said: I don't appear to have written that code, or at least I can't find it. Give me a couple of years to get it done. :) Like most things hehe 1 Share this post Link to post Share on other sites
rkemsley 10 Posted April 9, 2019 I am really new to scripting. Is there a way to make it so that rather than flee to the nearest building. The Civs will flee to a random map marker out of a load which have been placed around the area. Share this post Link to post Share on other sites
empleat100 3 Posted September 27, 2019 Very nice !!! However i have a problem: this overrides civilian presence position. I wanted civilians going to hide in buildings, while it worked previously now they are just running away. Also it would be nice to toggle panic mode on permanently, so i don't need fire near them to active it. Share this post Link to post Share on other sites