EBass 0 Posted February 13, 2011 Hey again guys I know I just posted a question but I figured I'd get this on the board overnight because its the last thing I don't know how to do, after that I'm golden. Anyway, the essential concept of the Coop mission is that you have to raid a lightly defended oilfield and blow up the derricks and then get out before the cavalry (Apaches, Abrams etc) arrives. At the present all I'd know how to do is have an objective completed when certain derricks have been destroyed. What I'd like to do is for each derrick destroyed that gives you a completion percentage. After say 50% a trigger fires for success but one could keep playing for the bonus objective of having all derricks destroyed. Good way of adding replayability and that. But the essential problem is at my present knowledge I'd only know how to make something fire when SPECIFIC derricks are destroyed or a group of them using a game logic "And" waypoint. I have no idea how to fire something based on a number destroyed of any random derricks. Hope I explained that well enough, cheers in advance. Share this post Link to post Share on other sites
RKDmitriyev 0 Posted February 14, 2011 (edited) Try something like this. In init.sqf file, completionpoints = 0; Trigger 1 Condition: getdammage mainDerrick > 0.95 On Act.: completionpoints = completionpoints + 100 Trigger 2 Condition: getdammage lessImportantDerrick2 > 0.95 On Act.: completionpoints = completionpoints + 75 Trigger 3 Condition: getdammage lessImportantDerrick3 > 0.95 On Act.: completionpoints = completionpoints + 75 [etc. with more objectives as needed] Trigger 4 Condition: completionpoints >= 150 On Act.: hint "You've done enough damage if you want to return home" Trigger 5 Condition: completionpoints >= 200 On Act.: hint "Hell yeah! Those bastards have gotten thrashed like they'll never forgot. RTB and we'll put some beer on ice for ya." See what I mean? I just made up the numbers, of course. Modify them to suit your mission. Edited February 14, 2011 by RKDmitriyev oops, it's >= not => Share this post Link to post Share on other sites
demonized 20 Posted February 14, 2011 (edited) asume you have der1, 2, 3, 4, and 5 in init.sqf or a trigger have : EndmissionValue = 0 And a end trigger with condition of 50% or whatever you like EndmissionValue == 50 runs this script on mission start. // create a array: _myobjectives = [der1, der2, der3, der4, der5] // run a loop every 5 seconds checking if any is dead, if so add 10 points to value and remove object from check list. while {true} do { {if (!(alive _x) then {EndmissionValue = EndmissionValue + 10; _myobjectives = _myobjectives - [_x]} foreach _myobjectives; sleep 5; }; If all is dead the value will be a total of 50 triggering the end trigger. Edit: RKDmitriyev beat me to it :) Edited February 14, 2011 by Demonized Share this post Link to post Share on other sites
EBass 0 Posted February 14, 2011 (edited) Thanks for the help guys RKDimitrivs method seems simpler but unfortunatly doesen't seem to work. If i type "completionpoints => 150" into the condition of a trigger it comes up with "invalid number in expression", if I remove the ">" I don't get such an error, so I've got "completionpoints = 100" (Yes, I do have completionpoints = 0; in the init.) But I have a trigger that fires with "completionpoints = completionpoints + 100" in the init line and this seems to not fire the trigger with "completionpoints = 100". As for the second method I understand it, but the derricks on the map are already placed and thus not ones I can "name". Would it be possible to rework that script so that instead of an !Alive check it checks if a trigger as fired, seeing as I already have triggers on all the derricks to create fire and smoke when they are destroyed. Er don't just say yes, because I wouldn't know how to do such a thing. In addition what would I put in the condition of a trigger? "EndmissionValue = X"? Thanks for the help guys. Oh also how would I fire the script just "ExecVM "Derrickscript.sqf"" or such in the init line of anything? Edited February 14, 2011 by EBass Share this post Link to post Share on other sites
f2k sel 164 Posted February 14, 2011 completionpoints >= 150 the equal sign was in the wrong place that should work. if you want o check if it's equal to something in a trigger it's completionpoints == 100; not completionpoints = 100 Share this post Link to post Share on other sites
EBass 0 Posted February 14, 2011 (edited) Ok figured out the problem, its something to do with my init line. If I delete everything else and just put "completionpoints = 0;" in my init the trigger fires so somethings wrong with my init. Anyone mind telling me what? //begin init.sqf //Initialise revive script (this next line is needed for revive script) server execVM "revive_init.sqf"; //Mission parameters skiptime (paramsArray select 0); sleep 5; [] execVM "briefing.sqf"; if(true) exitWith {}; //(vehicle player) addAction ["start camera", "NORRN_spectate\init_specCam.sqf", "", 0, false, true]; check3d = false; // BIS_fnc_burn = compile preprocessFile "\ca\Data\ParticleEffects\Scripts\Destruction\burn.sqf"; // completionpoints = 0; // Edited February 14, 2011 by EBass Share this post Link to post Share on other sites
f2k sel 164 Posted February 14, 2011 (edited) It works fine at my end are you sure you have completionpoints = 0 in an init? I just re read your last post , There is no init line in a trigger.. cond, on act and on dea is all there is. completionpoints = completionpoints +2 that would have to go in the on act box Scrub that you can have it in the condition, You never stop learning with this game. Edited February 14, 2011 by F2k Sel Share this post Link to post Share on other sites
EBass 0 Posted February 14, 2011 Yes sorry I understand that, I say init for Onact because, well I just do, I'll try to stop that for clarities sake. The problem is with my init.sqf file posted above, don't know what though. Doesen't seem to recognise the "completionpoints = 0;" part. ---------- Post added at 03:41 AM ---------- Previous post was at 03:38 AM ---------- Yea I say again theres nothing wrong with the triggers, they work fine. Its the init.sqf that doesen't seem to work. Like I said, posted above, whats wrong with it? Share this post Link to post Share on other sites
f2k sel 164 Posted February 14, 2011 Try putting completionpoints = 0 in a units init and see if that works, that's how I tested it. Share this post Link to post Share on other sites
EBass 0 Posted February 14, 2011 Seems to work thanks! Still confused as to whats wrong with my init.sqf though. Share this post Link to post Share on other sites
f2k sel 164 Posted February 14, 2011 (edited) Seems to work thanks! Still confused as to whats wrong with my init.sqf though. I think I know. You will see this init.sqf but it's actually saved it as init.sqf.txt you can't see the last bit. You may need to untick Hide extentions for known file types in Windows other wise it won't be saving them as sqf files but txt files that you can't see. Try looking in Tools , folder options and then view, it should be there. Edited February 14, 2011 by F2k Sel Share this post Link to post Share on other sites
EBass 0 Posted February 14, 2011 Nah it can't be that because the init file is firing up the briefing and the revive script I use fine. Urgh where the hell is tools in windows 7, I hate this interface. Share this post Link to post Share on other sites
demonized 20 Posted February 14, 2011 this is whats wrong with your init.sqf. if(true) exitWith {}; all below will not be run because init.sqf will exit at that line. Share this post Link to post Share on other sites