tophe 69 Posted March 2, 2007 I want to make a trigger that ends the mission when about 5% of the enemy units are left in a city. So that you won't have to chase down that last unit hiding in the bushes. Maybe I could make them give up and lay down their weapons when that certain percentage is met. The mission is dynamic and there is never the same amount of units in the city so I need a trigger that puts all units inside the trigger in a list. Then I need to count the amount of units in the list. Then I need to start the ending trigger with something like ? amount == (originalamount * 0.05) I don't know the syntax for adding units to lists and how to count them. And how should I get the end trigger to start? Should I, after counting the units, put the amount in one variable and then the percentage in another? Like this: x = the lists amount y = (x * 0.05) And then have the endtrigger start at ? x == y Any suggestions and help with syntax. Maybe someone has done this before or have a better suggestion than the percent-idea. Regards. Tophe, Östgöta Ops Share this post Link to post Share on other sites
charonos 0 Posted March 2, 2007 Go over to OFPEC.com and learn about scripting and this will be very easy for you to realize and you can implement much more diverse actions like laying down weapons and so on. You are going in the right direction with what you suggest.If you wanna make it in the editor only: Make a trigger that counts all your units relevant for the equation and name the list UNITSLIST=thisList. The trigger condition of the end trigger can be like: {alive _x} count UNITSLIST==originalamount * 0.05 Share this post Link to post Share on other sites
suma 8 Posted March 2, 2007 I suggest wait a short while for a 1.05 patch and try new trigger type "Seized by". If you do not want to wait or if you find it is not what you want, a scripted solution based on counting the enemies in the trigger lists as suggested by charonos should work. Share this post Link to post Share on other sites
tj72 0 Posted March 2, 2007 Im working with group names and Im handling each group as its own attack force. So if I was taking a town my enemies would retreat group by group. Later on I can run this retreat check on the total number of groups if I want. Say 5 groups were defending a town, one group is now left, even though they are healthy they are still retreating because they are below the totalgroups threshold I want. You may want more than one group to be checked all at once before anyone retreats which is no problem. I would make a script that uses an eventhandler "killed" for this myself. A trigger is OK to but you just want a list of enemy units in the list to get started. Generally a script will get this list and you get your count. Then you will check the status of the enemy from an eventhandler or a timed script. have it run every minute if you like and it uses this code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _Count_units1 = units group1 _Count_units2 = count _Count_units1 For your mission you can total up all the groups with a loop of the above and create variable for the sum of the enemies left. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _enemies_left = 20 (after you checked) _a = 100/_total_enemies _Result = Â _a* _enemies_left _Result is the percentage of units left ? _Result <= 50 : goto "Retreat" You could also declare a variable for this check: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> Threshold1 = 50 ? _Result <= Threshold1: goto "Retreat" Reason for doing this: you can set the threshold in the init and leave the script alone so you have more controll for testing the mission. So now you have the current number of units left when you run the script. You have to chose when and how this is checked. You could put an eventhandler "killed" to check this every time you kill a unit. Or a script could check periodically, this depends on your mission style and other things. Share this post Link to post Share on other sites
satexas69 0 Posted March 8, 2007 TJ (or anyone), I'd really like to know how to do something like this - as I have tons of troups in a city but sometimes they get stuck in walls, floors or buildings, and you can't kill them without leveling buildings sometimes. Do you have a mission example or script example (with trigger syntax) I can use to see how to do what you speak? Share this post Link to post Share on other sites
tophe 69 Posted March 8, 2007 Well.. I'd have to agree with Suma. The "Seized By" trigger is a great way to solve it. Tried it and it works great! Share this post Link to post Share on other sites
satexas69 0 Posted March 8, 2007 How does "Siezed By" work? IE, what are it's qualifications? I can't seem to find documentation on the web about it.. Share this post Link to post Share on other sites
tophe 69 Posted March 8, 2007 Look here: http://www.flashpoint1985.com/cgi-bin....t=58850 Share this post Link to post Share on other sites
satexas69 0 Posted March 8, 2007 Excellent, thank you. I'd definately say that's the way to go, and we can close this topic for sure! Share this post Link to post Share on other sites
zinc 0 Posted March 16, 2007 Well.. I'd have to agree with Suma.The "Seized By" trigger is a great way to solve it. Tried it and it works great! What, a 'siezed by' trigger in ArmA patch 1.05 ?? Interesting, because I don't have that option available on my editor trigger menu. Sounds like a useful feature I could use, if it were there! I'm using English version 1.05 Can someone enlighten me as to "where it is?" please. Share this post Link to post Share on other sites
Maddmatt 1 Posted March 16, 2007 What, a 'siezed by' trigger in ArmA patch 1.05 ??Interesting, because I don't have that option available on my editor trigger menu. Sounds like a useful feature I could use, if it were there! I'm using English version 1.05 Can someone enlighten me as to "where it is?" please. In the list along with "detected by" and "radio alpha". It should be at the bottom. Share this post Link to post Share on other sites
zinc 0 Posted March 16, 2007 In the list along with "detected by" and "radio alpha". It should be at the bottom. Thank you, appreciated! Share this post Link to post Share on other sites
tj72 0 Posted March 16, 2007 Jeez I understand you guys like this new trigger but why should we close the topic? Should we lock it and make it a sticky? Out with the old I suppose. New Trigger type is well and good but you still might want to do it my way and it will still work and use less CPU then a trigger will. Multiple triggers in a big mission are allways checking for conditions to fire and enough of them with a crowd of units will LAG! Do you want your trigger checking for nothing every clock cycle or just when a unit is killed off the EH? Which way is more efficient? Remember the last loon syndrome? So many missions were fun untill you had to kill some unit that was stuck under a house and not smart enough to know that he should retreat or surrender. This is an idea to fix that. Now BIS rolls out "Seized by" and it does the trick but it also sets up for a BF2 style C&H mode where maybe you just wanted to change an objective without anything extra. Anyone who wants clarification of the scripting way just let me know, PM's preffered since in here seems like some contest has ben lost for one method over another. Share this post Link to post Share on other sites
Maddmatt 1 Posted March 16, 2007 Jeez I understand you guys like this new trigger but why should we close the topic? Should we lock it and make it a sticky? Out with the old I suppose. New Trigger type is well and good but you still might want to do it my way and it will still work and use less CPU then a trigger will. Multiple triggers in a big mission are allways checking for conditions to fire and enough of them with a crowd of units will LAG! Do you want your trigger checking for nothing every clock cycle or just when a unit is killed off the EH? Which way is more efficient? I don't see the benefit of doing it through scripting, it's not like you are going to have 100s of these triggers all over the map. A few triggers are not going to do much to the framerate. It is also easy to set up and configure (like the time-out feature explained by Suma in the other topic that Olle Stolpe linked to). Quote[/b] ]Now BIS rolls out "Seized by" and it does the trick but it also sets up for a BF2 style C&H mode where maybe you just wanted to change an objective without anything extra. So what? there are already C&H maps for ArmA anyway. It's also much easier with the trigger. Also it's easy to adjust the size and shape of the area you want the trigger to affect. The trigger is also a good way to see which side is stronger in the area, so you could decide when to do a retreat, surrender or counterattack. I think the "Seizedby" trigger is a great new feature. It is very useful. Share this post Link to post Share on other sites
tophe 69 Posted March 16, 2007 Um.. why are you so upset TJ72? Your sollution was great as well... But for many of us the seize trigger is the best way to go. I've used it now in two missions and it really adds alot to realism and tactical gameplay. Now I will just make a script that will have the enemy units lay down their weapons when seized. Still though, your sollution might be of interest also. So there's no need to be insulted by BIS sudden "roll out" of the new trigger. Cheers. Share this post Link to post Share on other sites
tj72 0 Posted March 16, 2007 Stope Im not upset believe me. Im sorry if I seem to be. Im only bringing these points to counter this strange idea of a competition Im getting. Maybe Im getting ahead of myself, maybe. Matt: YOU say you wont need so many triggers and you may not. But not everyone is going to make missions like you will and the maps are big and alot of units can be present so those missions will need to be optimized. Its a case of the more you have the more you want with the scale of the mission and the CPU/Mem you can bring to bear. What if you have a few larger triggers checking a large number of units in the area? The same resource drain will occur. My way is fully scalable from small to big. "Seized by" is limiting for larger missions right out of the gate. Its a quick cheap way to solve the problem for beginner editors who dont want to or arent ready to get into scripting which is fine. Not every mission maker is like that, however. Im not saying it is a bad feature just that it doesnt "defeat" my method in any way. The competetive attitude here is not necessary at all. The two methods are worth comparing on equal ground with pluses and minuses on both sides. Arent two solutions better than one? I think so. If people get their problems solved and get missions set up how they want then Im happy and I want to play those missions. I merely give more options to these makers than less. Quote[/b] ]It is also easy to set up and configure so is mine......maybe its easier done than said but it really is as simple as dirt. Put the EH on your units (easy and examples are here), make a script (easy), set your percentage threshold in your inits (type in a value in a notepad file ). The hardest part is just what will happen in the script when the EH fires. IT could be as simple as: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> group _this move getpos retreat_logic or even <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">end mission Share this post Link to post Share on other sites
Maddmatt 1 Posted March 16, 2007 Matt:YOU say you wont need so many triggers and you may not. But not everyone is going to make missions like you will and the maps are big and alot of units can be present so those missions will need to be optimized. Its a case of the more you have the more you want with the scale of the mission and the CPU/Mem you can bring to bear. What if you have a few larger triggers checking a large number of units in the area? The same resource drain will occur. My way is fully scalable from small to big. "Seized by" is limiting for larger missions right out of the gate. Its a quick cheap way to solve the problem for beginner editors who dont want to or arent ready to get into scripting which is fine. Not every mission maker is like that, however. Im not saying it is a bad feature just that it doesnt "defeat" my method in any way. The competetive attitude here is not necessary at all. The two methods are worth comparing on equal ground with pluses and minuses on both sides. Arent two solutions better than one? I think so. If people get their problems solved and get missions set up how they want then Im happy and I want to play those missions. I merely give more options to these makers than less. Quote[/b] ]It is also easy to set up and configure so is mine......maybe its easier done than said but it really is as simple as dirt. Put the EH on your units (easy and examples are here), make a script (easy), set your percentage threshold in your inits (type in a value in a notepad file ). The hardest part is just what will happen in the script when the EH fires. IT could be as simple as: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> group _this move getpos retreat_logic or even <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">end mission Triggers in ArmA can be deleted and created with scripts, so you will never need a large amount of these triggers if you optimize properly. Most missions do not involve capturing every single town on the map either. Look here. You can delete and create triggers as needed in ArmA. A few triggers covering some cities is not going to have much of a performance hit. You method may be useful for some very large scale missions, but how often do you see those? If you go onto that kind of scale, you will need to be deleting and creating units as needed to keep performance up. You may as well delete and create triggers too. It really depends on what exactly the mission editor is trying to achieve. I haven't really looked at your method, but how well does it handle multiple areas at once? Triggers are easy to tie to specific areas, and will adjust to whatever units move there without them having eventhandlers. Share this post Link to post Share on other sites
tj72 0 Posted March 16, 2007 I wasnt aware you could do that with triggers, thanks for the tip Matt. Lots of possibilities I think. More editing freedom is better I think we can agree. It would happen for every unit that had the Event Handler on it. I like to copy groups and name them incrementally. You can make one group in the editor (or spawn the groups at mission start but takes more setup) have all the eventhandler code in the units then copy the group and name it then next number and change the units for the new group. Copy Paste with incremental numbers basically. I learned this from Searching this forumn for answers, in fact. All kinds of reference arrays can be numbered and cloned and then they all point to and are updated scripts to handle the arrays. Groups, game logics, Markers and even internal names can be listed and put in arrays and referenced and used by scripts. This percentage script can plug into this very well. The Seized by trigger, Im not sure, it seems to want to do its own thing a bit more which might be irking me a little I guess. A regular trigger can feed variables and lists into a script very well though. Alot of what I want to do seems to point to scripts and I admit I look to them first over ingame tools like WP and Triggers now that I can interpret know the language. I want to run a script not on this tank only but on every tank like it every time it would need it. I want a group not just to go into this building but every building like it when it thinks it should. I also admit I can spend more time just scripting and testing than actually playing and I can lose an more casual players perspective. Thanks for listening. Share this post Link to post Share on other sites