GenPattonX 10 Posted September 9, 2013 Hi If u want a long story short just jump to: “So actually the deal is†or “Next is the part which isn’t working†I am trying to build this "search and destroy" mission during night time and i wanted that any enemy patrols guarding the area, specially those isolated would be able to do a little more then just engage the player, for instance try to alert other units or call in for reinforcements. Has i have said on other posts i don’t know how to script and i am still very ignorant on how to do most things through triggers and game logic, i just don’t understand how people know what to put in the conditions fields, activation, etc, so the OFP engine knows what we want. Anyway i am trying to get a patrol to be able to alert other units after spotting the player or enemy units. The first way i know to do this is by using a trigger which covers a large area, or the all mission area and have it detected and activated by the respective unit sides. But i don’t like this because if somehow one unit is not in the trigger area, it just won’t get activated and that is just ridiculous, so i wanted to do it using gamelogic, or maybe find a way to activate my conditions without having to have an area. Obviously i had no idea how to, so what i did was to go look at some of the original campaign missions i have unpbo in the mission editor and try to find any thing i could use. That’s what i usually do, i just look at how the game creators created the missions and try to understand how they used triggers, commands and why they used them for. Also, before the patrol alerts other units i also want it to fire a flare to iluminate the area, and only 8 or 10 seconds later, they can sound the alert or call reinforcements, IF they are alive. So actually the deal is: A patrol spotts an enemy unit. At the moment they engage a grenadier fires a white flare. 8 or 10 seconds later they alert other units, IF they are alive. So this is what i have tried: 1) Trigger activation: none, once, present, countdown (0,0,0) Type: none Text: spotted1 condition: patrol1 knowsabout Player > 1 ««««« (I’m not sure if i should change this value) on activation: busted = true I am not sure if the “knowsabout†command is appropriate here, i am assuming once the patrol spotts the player it activates that other condition: “busted = true†That condition i copied from a trigger used in one of the missions of the Russian campaign, i guess it’s like na alarm, not sure if it’s appropriate too. So after this trigger has met its condition and activated the command, it allows a gamelogic object to activate its waypoints, so they are synchronized. This gamelogic is the one responsible for having the grenadier fire the flare. (Patrol consists of 4 soldiers - group leader is named: patrol1; and the grenadier is named: radiomanpatrol1) – radioman because he is the one suppose to activate the trigger that will activate other units into an alert state, if he is alive. 2) GameLogic waypoint "AND" timeout: (1,1,1) condition: true on activation: patrol1 fire ["GrenadesMuzzle","Flare"]; waypoint "AND" timeout: (20,20,20) condition: true on activation: patrol1 fire ["GrenadesMuzzle","Flare"]; Sometimes the patrol grenadier doesn't fire the flare, instead he just engages like the others, i know this can be solved just by having a flare script to do the job (i donwloaded one), but i really want one of the patrol soldiers to do it, wonder if someone has any idea for this small issue. Next is the part which isn’t working but i don’t understand why, i think the conditions i have placed make perfect sence but i even tested it with a setdammage command for a bmp and it never exploded so i know the trigger wanst working. 3) Trigger activation: none, once, present, countdown (8,8,8) Type: none Text: radio alert patrol1 condition: busted = true and alive radiomanpatrol1 on activation: t1 setdammage 1 plz help and thx anyway Share this post Link to post Share on other sites
nikiller 18 Posted September 9, 2013 hi, I wrote a script that force a group of AI to fire a flare and call for reinforcement if it detects player. init.sqs ;******************************** ;Init Script by Nikiller v0.9b ;contact: nikillerofp@hotmail.fr ;******************************** ;----------------------------------------------------------------------------------------- ; Flare patrol ;----------------------------------------------------------------------------------------- nik_spotted=false [EastGrp1,player] exec "flare_patrol.sqs" exit flare_patrol.sqs ;********************************************* ;Flare Patrol Script by Nikiller v0.9b ;Force AI to throw flare when it detects enemy ;contact: nikillerofp@hotmail.fr ;[groupName, targetName] exec "scriptName.sqs" ;********************************************* _g = _this select 0 _t = _this select 1 _l="l" _e="ende" _d=1 _u=units _g {_x removeMagazine "HandGrenade"} forEach _u; {_x addMagazine "FlareRed"} forEach _u; {_x addWeapon "FlareRed"} forEach _u #l ~_d _le=leader _g ? ({alive _x} count _u)==0 || !(alive _t) || nik_spotted: goto _e if (_g knowsAbout _t>0.105) then {(_u select 0) fire "FlareRed"} else {goto _l} ~_d nik_spotted=true publicVariable "nik_spotted" #ende exit Here's a demo to show how it works: DEMO LINK cya. Nikiller. Share this post Link to post Share on other sites
GenPattonX 10 Posted September 9, 2013 Nikiller thank you for your time, i wasn’t expecting someone to write me a script, but i guess it wasn’t that complicated for you… As much i appreciate your help here is my problem with your script: As soon as i attack the patrolling unit, the reinforcements immediatly come. I wanted to have a time of about 10 secs before any unit could be called in for help, because if i could kill the all patrol in time, that wouldn’t happen. Or instead of killing the all patrol, maybe just one specific soldier, like the “radio manâ€. If u kill him, the unit can’t call for help. I have a few questions about your demo too: how come u don't need to name the units? how the game knows who is suppose to launch the flare and who comes as reinforcements? How u didn’t need to synchronize anything? I don’t get it why the reinforcements don’t simply follow their waypoints since they don’t have to wait for any other unit or trigger. Lastely how the game knows its suppose to execute the script, i don’t see anywhere something saying: exec “scriptname.sqs†I still wonder if i can’t just do it the way i was trying, i would still like to know what is wrong with my 3rd step, that last trigger: condition: busted = true and alive radiomanpatrol1 isn’t this condition correct and enough to do what i want? It’s suppose to trigger other units as reinforcements if the patrols spotted na enemy (busted = true), and if the radioman is alive. Plz help and thx anyway Share this post Link to post Share on other sites
zulu1 145 Posted September 9, 2013 GenPattonX Nikki has been one of the top scripters in the MP community for many years...he lives for it :) First of all the script is launched from the init.sqs file, which runs things at the start of the mission. Second you see the the first two lines of the script? _g = _this select 0 _t = _this select 1 _g & _t are variables and select 0 & 1 come from the arguments in the line of code in the init.sqs file that launches the script. [EastGrp1,player] exec "flare_patrol.sqs" EastGrp1 is select 0 and player is select 1 Those are used in the script as the variables _g & _t. Hope that clears things up... Share this post Link to post Share on other sites
GenPattonX 10 Posted September 9, 2013 yes a little well my ignorance about scripting and triggers and gamelogic commands is all my fault, i actually downloaded from various sites tutorials on how to script for OFP, and stuff about triggers, etc but i just never really had the time for it. The problem is that when i do have time i just try to create missions even though i know i probably will get stuck at some point XD but still plz someone tell me what is wrong with my last trigger: condition: busted = true and alive radiomanpatrol1 Share this post Link to post Share on other sites
nikiller 18 Posted September 9, 2013 hi, but still plz someone tell me what is wrong with my last trigger:condition: busted = true and alive radiomanpatrol1 Your variable busted isn't set to anything at mission start, you must initialize all your variables in an init of any kind but by convention you initialize your stuff in an init.sqs To solve your problem: Create an init.sqs with the notepad, write busted=false and put it in your mission folder and voilà ! Don't forget to set busted to true when the player is spotted. Put in a trigger condition field : if (radioman knowsAbout player>0.105) then {busted=true} That should solve your problem. I suggest you to use scripts instead of triggers it will save you a lot of time and performances. cya. Nikiller. Share this post Link to post Share on other sites
GenPattonX 10 Posted September 9, 2013 (edited) thx for your reply i just learn a few more things from it and i bet it will work if i try it, but i managed to solve it. I guess the last trigger which is the one that is suppose to alert other units just need to respect these conditions: patrol1 knowsabout player > 1 and alive radiomanpatrol1 so if i kill the radioman, the trigger wont activate, and that way i won't have to deal with enemy reinforcements XD i knew this had to be simple, i was getting so frustrated -.- i guess i dont need that "busted = true" for anything thx anyway Edited September 9, 2013 by GenPattonX Share this post Link to post Share on other sites