Home   Help Search Login Register  

Author Topic: Actions and mines  (Read 1558 times)

0 Members and 1 Guest are viewing this topic.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Actions and mines
« on: 26 May 2006, 13:24:20 »
Here's the problem:

  • I have a mine placed on the ground.
  • I put this addaction ["Clear Mine","cleared.sqs"] in it's init field.
  • I write a script that deletes the object the action is attatched to, thus I can give my player the option to disarm any mines he finds on the ground.
  • It doesn't work.


This is not a syntax problem. My technique works beautifully if I put the addAction syntax in the init line of any other objects - but it doesn't work with mines.

Can someone:

1) Explain why?
2) Think of a simple solution to the problem (remembering that there will be many unnamed mines in the mission, and that i would like to find a solution that is also MP safe)???

OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline XCess

  • Former Staff
  • ****
Re: Actions and mines
« Reply #1 on: 26 May 2006, 13:30:50 »
The simplest solution would be to make the player engineer class, I believe they can disarm mines without any scripting whatsoever. Have you tried running the addAction from inside a script rather than the editor? What is the actual code? Would make it mich easier to spot the problem  ::)

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Actions and mines
« Reply #2 on: 26 May 2006, 13:46:50 »
The addAction starts a script that goes something like this (ad hoc syntax):

Code: [Select]
_mine = _this select 0

_engineer = _this select 1
~1
_engineer playMove "takeFlag"
~1
deleteVehicle _mine

exit

This should make the player fall to his knees, and then the mine should disapear. (I cannot remember if the mine or the player is this select 0 right now, but as I said... it's not a syntax that's the problem.) It works with any other object/vehicle/unit except mines.

The problem is that when the player aproaches the mine, he doesn't even get the option to "Clear Mines". It seems like "addAction" doesn't work if you put in the init field of a mine.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

klavan

  • Guest
Re: Actions and mines
« Reply #3 on: 26 May 2006, 13:51:13 »
I've encountered a similar problem months ago and if I'm not wrong i searched the solution through the old posts here at OFPEC. If my mind doen't betrays me the mines are impossible to delete and it's impossible to do anything with 'em apart  to deactivate 'em with engineers and specops. Its an OFP bug.
Klavan

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Actions and mines
« Reply #4 on: 26 May 2006, 16:45:40 »
Bugger   :-[

Have to start all over again then, with engineers  :-\
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Actions and mines
« Reply #5 on: 26 May 2006, 16:56:24 »
What if you don't put the mine there from the mission editor's menu but create it in a script? I recall that a mine placed from the editor couldn't be moved with setPos but a mine created could. Maybe it's something similar which is blocking your stuff from working.

Edit I mean of course, if the mine can't be deleted at all then just move it underground.
« Last Edit: 26 May 2006, 16:58:37 by Baddo »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Actions and mines
« Reply #6 on: 26 May 2006, 16:58:18 »
Entering un-bugger-mode :D

Thank's. I'll try that
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Actions and mines
« Reply #7 on: 26 May 2006, 17:45:12 »
indeed. unfortunately you still can't add an action to the camcreated mine.

decide how many mines you're going to have and create a global variable minenum. in this example i've used 10. place empty markers where you want the mines to be and name the markers mk_mymine1 - mk_mymine10. camcreate the mines using something like this

Code: [Select]
minenum = 10
_i = 1

#loop

call format [{mymine%1 = "mine" camcreate getmarkerpos "mk_mymine%1"}, _i]

~0.1
_i = _i + 1
?not (_i>minenum):goto "loop"

that way you have 10 mines named mymine1 - mymine10 at the corresponding marker positions.

place the same number of radios on the map somewhere, name them mine_radio1 - mine_radio10. add the action to the radios. in the init file move all the radios to the x/y pos of the mines, but 1 metre underground

Code: [Select]
_i = 1

#loop2

call format [{mine_radio%1 setpos [getpos mymine%1 select 0, getpos mymine%1 select 1]}, _i]

_i = _i + 1
?not (_i>minenum):goto "loop2"

now when the action attached to a particular radio is activated, _this select 0 is the object the action was added to. it's then easy to find the corresponding mine

Code: [Select]
_whichradio = _this select 0

_i = 1

#loop3

_radiocheck = call format [{mine_radio%1},_i]

?_whichradio == _radiocheck : call format [{mymine%1 setpos [0,0,0]}, _i]
_i = _i + 1

?not (_i > minenum):goto "loop3"

exit


missionette to illustrate attached.

[attachment deleted by admin]
« Last Edit: 26 May 2006, 20:10:25 by bedges »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Actions and mines
« Reply #8 on: 26 May 2006, 19:34:00 »
@bedges
Aha... Now I see what you're trying to do. Took me a while to understand. Will try your missionette when I have a little more time. I would have prefered a simple solution, that could be ported to MP-mode without to much fuzz, but since it's setPos commands it shouldn't be that difficult even if there's more scritping than I wanted. Thank you Bedges.
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline Tyger

  • Former Staff
  • ****
  • I was at OFPEC when it still had dirt floors...
    • OFPEC
Re: Actions and mines
« Reply #9 on: 27 May 2006, 05:32:11 »
You could simply create a game logic underneath the mine, and add the action to that. Similar to bedges' way, yet you can free up the radio for other more important things.
"People sleep soundly at night only because rough men stand ready to do violence on their behalf." - George Orwell

MSG Mike Everret - We Will Never Forget - '75-'08