OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Cpt. Robertson on 01 May 2003, 03:12:42

Title: Unit Distance Trigger (mines)
Post by: Cpt. Robertson on 01 May 2003, 03:12:42
Hi there.

Just a quick question about a simple script to detect the distance between ANY game object and a specific object i.e. :-

?(Any unit regardless of side or type) distance landmine1 < 1 :goto "detonate"

I can do a simple 'unit1 distance unit2 <100' entry in the script and it works fine, but I'm stumped as to how I can get the thing (Anti-personnel mine in this case) to detonate when any land unit comes within 1M of it.   I can do it using a 1M radius trigger in the in-game editor, but I'd prefer to make a script that does this instead, if that's possible?

Thanks for any help. :-)
Title: Re:Unit Distance Trigger (mines)
Post by: nEO iNC on 19 May 2003, 12:20:20
Hey Cpt. Robertson, I'm not quite sure why a 1m "ANYBODY PRESENT" trigger over the mine isn't good enough... Is there some specific reason why you want to use a script..?  ???

The script would give you flexibility for the name of the mine to detonate by passing it into the script, but you're still left with the problem of actually telling the game it needs to run the script to set this mine off. The basic mechanism to do this is a trigger.

I guess what I'm saying is, no matter which way you do it with a simple trigger with the appropriate line in the OnAct: field, or via a script it will involve a trigger at some point as far as I can see. I could be wrong, but I don't think so... Especially if you aren't looking for a specific unit name or <player>... :-\

Sorry if this doesn't help much...
Title: Re:Unit Distance Trigger (mines)
Post by: Harkonin on 21 May 2003, 07:33:20
This is actually a valid question since I had a similar problem.

While using the editor is fine for simple missions you'll need to script things like this. For example I recently added AT and AP minefields to a CTI map I've made and you can't really use ingame triggers for that since the mines are created at runtime ingame and are always in different locations.

anyways just use something like ?(unittype == "land")&&(unit distance <= 1)

something like that you might have to play with it but basically the "land" is for any ground unit or vehicle and the distance is the radius of activation.

Hope that helps.