Jump to content
Sign in to follow this  
Andy455

State of mine?

Recommended Posts

How can I get the state of a mine created by placing one in the editor or using createMine?? For example in a mission I'm trying to make I would like there to be an objective to deactivate a preplaced mine (therefore I can't take it), I cannot find a way to detect once it has been deactivated. I have tried to use !alive Mine1 but that does'nt work, Help please :(

Share this post


Link to post
Share on other sites

You could add a action to the mine which execute a script where you can play an animation to show player working with mine and then delete the mine when it's done.

Share this post


Link to post
Share on other sites

Thanks for the reply but I think you have misunderstood me, I would like to know WHEN it has been deactivated, deactivating it is not a problem only finding out once it's disabled.

Although I could use your method to reimplement the action to disarm it and add a little line once its done to trigger the objective but I have never worked with addAction before and I have no idea how to go about it.

Edited by Andy455
spelling

Share this post


Link to post
Share on other sites

Would be interesting to know HOW you actually disable the mine. In case you just delete it, the condition to ask for would be:

isNull Mine1

I assume the game engine does nothing else: It deletes the mine (and adds one to your inventory?).

Share this post


Link to post
Share on other sites

I just disable the mine with the engineer class :), I can deactivate it with him but not pick it up with the default action, when I select deactivate the mine is still there but it moves to a slanted angle and then doesnt go off but I can still see it.

I placed the mine straight from the editor >> empty >> Mines >> Mine(RU)

EDIT: isNull Mine1 does'nt work either :-/ I was thinking maybe I could use something like if animation changed (as the mine moves to an angle) that would detect it?

Edited by Andy455

Share this post


Link to post
Share on other sites
Thanks for the reply but I think you have misunderstood me, I would like to know WHEN it has been deactivated, deactivating it is not a problem only finding out once it's disabled.

Although I could use your method to reimplement the action to disarm it and add a little line once its done to trigger the objective but I have never worked with addAction before and I have no idea how to go about it.

No i understood you i just dunno how to check the mine state so i suggested another way which i found out doesn't work, you can't add a action to a mine it seems. I also tried with an eventhandler on "killed" that doesn't work.

When an engineer disables a mine the mine change position so maybe you can store the vector on mission start and then keep checking for a change which would indicate it's been disabled?? I have no idea how to do that if it can be done!

Share this post


Link to post
Share on other sites

Does anyone else have an idea of how I could do this? I tried that vectorUP thing and it didn't work, I must have done it wrong :-/

Share this post


Link to post
Share on other sites

Andy,

you can query the mine's status by vectorUp indeed. Example code:

mymine = "MineE" createVehicle (getPos player);
test = vectorUp mymine;

test is now [0,0,1]

Next thing is that you disable the mine. Then test again:

test = vectorUp mymine;

test is now -[-0.5,0,0.866025]

Hence, if you create checksums out of (vectorUp myMine select 0 + vectorUp myMine select 1 + vectorUp myMine select 2) before and after disabling it you'll know whether somebody disabled it. Main point is that vectorUp should provide different results before and after an engineer messed with it.

Cheers,

VictorFarbau

PS: Bad style of course with global vars - better use local vars in the final script. Just did this for a test.

Share this post


Link to post
Share on other sites

I know this is an old thread, but has anyone figured out how you can properly ask for the state of a mine?

Means the mine is located in editor and its deactivated state can be asked.

Share this post


Link to post
Share on other sites

VictorFarbau's code seems not to work for editor placed mines.

hint format["%1,%2,%3", (vectorUp mine1) select 0, (vectorUp mine1) select 1,(vectorUp mine1) select 2]
// mine1 is the name of an editor placed mine

returns "any,any,any"

Also mines cannot be detected by triggers, e. g. activation "any" with onActivation code "hint format["%1", thislist]" will not even display the hint let alone an array of the mine objects within the trigger area... :(

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  

×