Jump to content
Sign in to follow this  
theavonlady

Need help with a trigger

Recommended Posts

I need a trigger whose condition is if all of the vehicles (armor, trucks, cars, boats and planes) within the trigger's radius cannot move or fire. There might be infantry in the same area but I don't care about them.

I know how to do this if assigning names to each vehicle but I don't know how to code this globally.

Help appreciated. TIA. smile_o.gif

Share this post


Link to post
Share on other sites

Try:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{(!(canmove _x) or !(canfire _x)) and "Man" counttype [_x] == 0} count thislist == (count thislit) - ("Man" counttype thislist)not tested smile_o.gif

Share this post


Link to post
Share on other sites
Try:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{(!(canmove _x) or !(canfire _x)) and "Man" counttype [_x] == 0} count thislist == (count thislit) - ("Man" counttype thislist)
not tested smile_o.gif

Thanks.

What's the logic of the "Man" count for, if it makes no difference whether there are or aren't infantry in the area?

Also are canmove and canfire only applicable to vehicles?

Share this post


Link to post
Share on other sites
Try:
Quote[/b] ]{(!(canmove _x) or !(canfire _x)) and "Man" counttype [_x] == 0} count thislist == (count thisli<span style='color:red'>s</span>t) - ("Man" counttype thislist)
not tested smile_o.gif

Thanks.

What's the logic of the "Man" count for, if it makes no difference whether there are or aren't infantry in the area?

Also are canmove and canfire only applicable to vehicles?

1. I corrected a spelling error in the word "thislist" (see above).

2. This works! Thanks! smile_o.gif

3. The "Man" count logic in this equation is to exclude any non-vehicles from the equation. This is needed because:

4. canmove and canfire are also applicable to non-vehicles, like soldiers.

Share this post


Link to post
Share on other sites

Just a question:

Is most of the code you see in INT fields of objects written in the same language as in script files?

I didn’t get how people learn how to write this stuff, I’ve read some lessons but I always get lost or I’m never clear on what doses what.

Are there any lessons one of you guys can recommend with some good outlined steps to help understand how to create INT strings and script files?

I know that most of the INT code that people put up on the screen is just a mater of copying and pasting in the INT field but I never really understand what this strange looking stuff doses in the back ground.

Thanks for wiping my nose..lol J/K  tounge_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Is most of the code you see in INT fields of objects written in the same language as in script files?

It is exactly the same language. Only in script files, you can do things like loops, if-then statements, and delays, which means there is a heck of a lot more that you can do in a script instead of in the field of a unit or trigger.

Head on over to OFPEC. There you will find all the knowledge you need. My personal suggestion: don't worry about how to write scripts. Just learn how to do little tricks in the init fields of units, and the on activation fields of triggers and waypoints, and last in the condition field of triggers. Anyway, grab the unofficial command reference from OFPEC, and you will see some scripting commands and how to use them. If you don't understand a certain command, just forget about it. Most commands are only really useful in scripts. You can also grab macguba's tutorial mission and look at it for a great example of some things.

Also, learn to use scripts others have written in your missions. When you use them, take a peek inside the script and see if you can figure out what is going on. Eventually, when you are comfortable with using scripting commands in init fields, waypoints and triggers, you will be able to move on to writing simple scripts. By that point, you'll see that scripting isn't much different from what you've been doing all along.

Anyway, that's how I learned scripting. Don't expect to be able to make super-complex scripts right away. Just take things a step at a time, and you'll get better and better. Also make sure to use the forums, especially the OFPEC ones, when you are stumped about things. Have fun. smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×