OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: magnar on 03 Jul 2005, 08:59:28

Title: deactivating mines
Post by: magnar on 03 Jul 2005, 08:59:28
  I have looked for information on this, but have come up empty.  How can you, via trigger or script, whatever is easier, have an objective met when 5 mines are deactivated.  I tried the   not alive way, naming mines M1 through M5, but that doesnt work.  Any help would be greatly appreciated. ??? :-\
Title: Re:deactivating mines
Post by: General Barron on 03 Jul 2005, 09:12:32
Maybe try the "isnull" command? For example:

{isnull _x} count [M1,M2,M3,M4,M5]
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:15:06
will try right now.  Thanks
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:18:48
oops.  Sorry, does this go in the cindition field of the trigger, or is it used in a script?  Noob to scripting here, my bad!
Title: Re:deactivating mines
Post by: General Barron on 03 Jul 2005, 09:19:42
That would be the condition field of a trigger.
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:22:50
with this in condition field of trigger, am getting the TYPE NUMBER, EXPECTED BOOL error.......?
 
Title: Re:deactivating mines
Post by: General Barron on 03 Jul 2005, 09:28:38
Whoops, I'm sorry, I didn't finish! It should look like this:

({isnull _x} count [M1,M2,M3,M4,M5]) == 0
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:35:50
thanks again ;D
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:38:31
({isnull _x} count [M1,M2,M3,M4,M5]) == 0  ; this makes the trigger go off but none of the mines were deactiviated yet?  hmmmmmm?
Title: Re:deactivating mines
Post by: General Barron on 03 Jul 2005, 09:40:00
Damn it... I need to go to sleep.

({! isnull _x} count [M1,M2,M3,M4,M5]) == 0
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 09:46:13
unfortunately same result.  It seems as if the mines are not responding to the is null command.  I really appreciate your help, and hope you can sleep soon!
Title: Re:deactivating mines
Post by: THobson on 03 Jul 2005, 10:04:30
This is really odd.  I placed a mine on the map called m1 and then I set up the following radio hint

hint format["XLocation = %1\nisNull = %2\nAlive = %3",getPos m1 select 0,isNull m1,alive m1]

And it seems that as far as the mine is concerned its location, its isNull status and its alive status are all undefined.  If I call something else m1 then the hint gives the correct values.

It seems there is some other property of the mine that needs to be checked - or maybe it is not possible.
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 10:09:42
I think you are right, its status is undefined, as least as far as those two commands are concerned.  Ive been looking in the command ref, but I dont see anything else (with my limited knowledge) that would serve to change its status.  Maybe its not possible, unless someone has a different suggestion?  Thanks for your help with this............ ::)
Title: Re:deactivating mines
Post by: qqqqqq on 03 Jul 2005, 10:35:26
Mines are not proper objects.   Most scripting commands do not apply to them.    magnar, give us more details or rethink your mission.   A complex and sophisticated workaround will probably be required.    AFAIK the only people who have managed to do anything like this are macguba and Sui.
Title: Re:deactivating mines
Post by: THobson on 03 Jul 2005, 10:35:29
It is as if you can't give mines a name.

I am going out now and so can't test it, but could you get the mine by using nearestObject command and then check its status?

It is a bit fiddly otherwise I would do it now.
Title: Re:deactivating mines
Post by: 456820 on 03 Jul 2005, 19:51:47
how about not canmove and not canfire
they might work but i doubt it but worth a go
Title: Re:deactivating mines
Post by: magnar on 03 Jul 2005, 21:45:27
As far as details go, I just wanted the player, an engineer, to deactivate 5 mines to clear a path for following armor.  I can still do this, just cant tie it to an objective.  Thats OK though, I just thought it could be done.  I thought it would work  with  grouping the mines to triggers with the "vehicle" and "Present/not present/or not alive"  options.   The game has to recognize them with some type of command, as when you deactivate them they filp sideways!  
Finding the key seems to be more work than its worth at this point, but I hope I am wrong.  Thanks all, for your help.
Title: Re:deactivating mines
Post by: ACF on 03 Jul 2005, 23:07:54
Alternative approach - why not have a radio trigger or an action for the player to call the armour forward when he's happy the road's been cleared.  That can set the objective to "DONE".

Then, if you haven't done it properly, losing a vehicle within a suitable time period (i.e. on a mine) could reset the objective to "FAILED".

Part of the skill would be for the sapper to 'judge' when the road is clear, rather than a treasure hunt for a known quantity of mines.
Title: Re:deactivating mines
Post by: General Barron on 04 Jul 2005, 00:55:11
Here is another alternative... don't make the player an engineer. Instead, add an action to each of the mines, which runs a  script that does 2 things: increases a global var (Mines_disarmed), and moves the mine off into the abyss [0,0,0] (or just deletes it, if that is possible).