Deployable Minefield Button
Moderator: Moderators
Deployable Minefield Button
Basically, I'd like one of the vehicles in PURE to be able to deploy a minefield, exactly once per Unit. I have made a new type of minefield, which actually acts like a minefield, so I don't want them to be spammable, but I want them to be deployable fairly quickly, so that they are tactically useful. I'd like a button that says "Deploy mines", which then will create a Unit behind the vehicle, then the button should remove itself. Needs to be a Gadget, for obvious reasons.
By an actual minefield, I hope you mean a field of mines, each as a single weapon, which only disappears when all weapons are exhausted yet until then is listed as a single entity.
You could have just asked Nemo about it, he implemented a minefield after a discussion of ours some time ago.
If I recall, this should be an easy bit of LUA.
You could have just asked Nemo about it, he implemented a minefield after a discussion of ours some time ago.
If I recall, this should be an easy bit of LUA.
Re: Deployable Minefield Button
Juste like the chinese buildings in C&C ?Argh wrote:Basically, I'd like one of the vehicles in PURE to be able to deploy a minefield, exactly once per Unit. I have made a new type of minefield, which actually acts like a minefield, so I don't want them to be spammable, but I want them to be deployable fairly quickly, so that they are tactically useful. I'd like a button that says "Deploy mines", which then will create a Unit behind the vehicle, then the button should remove itself. Needs to be a Gadget, for obvious reasons.
That's a good idea !
<shrugs> it's really easy to do with BOS, so I just did it that way, for now- just made the Unit able to build, then jammed the script afterwards. I could even cheat, and make some cheesy visual appear over the Unit to tell people it's no longer able to lay mines, but it's inelegant.
The problem lies in getting rid of the button.
So, er... how do I kill a button? Now that I have a smallish clue about LuaCob, I know I can pass arguments to a Function. All I need is a Function that clears all builder-buttons, so that users can no longer see the button, which is functionally useless after the COB has done its thing, anyhow. I have everything else working- the Unit works, the minefield works, the jammed builder-script is already done. I just need this last little bit, so that it's a nice smooth thing for the user. Otherwise I'll no-doubt hear whining about it, "we luv tha minez, Arrg, but itz borken", when I'd rather just put a little label that says, "One-use deployable minefield. Click to place. Can only be used one time."
That's where I'm stuck, at the moment. I think I need to go to sleep and come back to this when I'm not ridiculously tired, all of the art that's been completed is animated, integrated and working, and the game design is working well enough to do basic tests of gameplay... it's been a long day
The problem lies in getting rid of the button.
So, er... how do I kill a button? Now that I have a smallish clue about LuaCob, I know I can pass arguments to a Function. All I need is a Function that clears all builder-buttons, so that users can no longer see the button, which is functionally useless after the COB has done its thing, anyhow. I have everything else working- the Unit works, the minefield works, the jammed builder-script is already done. I just need this last little bit, so that it's a nice smooth thing for the user. Otherwise I'll no-doubt hear whining about it, "we luv tha minez, Arrg, but itz borken", when I'd rather just put a little label that says, "One-use deployable minefield. Click to place. Can only be used one time."
That's where I'm stuck, at the moment. I think I need to go to sleep and come back to this when I'm not ridiculously tired, all of the art that's been completed is animated, integrated and working, and the game design is working well enough to do basic tests of gameplay... it's been a long day

1) Every time a mine layer unit is created, use InsertUnitCmdDesc() to give it a 'Lay mines' button
2) When a 'Lay mines' button is pressed:
- Spawn the mines, how ever you are going to do that
- Use InsertUnitCmdDesc() to remove the button
Simple. No LuaCob, no jamming build scripts, no ugly hacks.
2) When a 'Lay mines' button is pressed:
- Spawn the mines, how ever you are going to do that
- Use InsertUnitCmdDesc() to remove the button
Simple. No LuaCob, no jamming build scripts, no ugly hacks.
Er, wait... um... we have to have some COB running, for the relevant animation. I don't want the mines just popping into existence here. So the whole COB thing, even if it's just a function that's called once, after getting poked into life by a LUA variable state being passed to the COB... is still relevant.
This must either be a Function that eliminates a build-menu, or a Function that displays a button and then destroys itself when a value changes, and either way it's gotta interact with COB, so that it can be told, "hey, this Unit actually finished laying mines once, now I should drop that button".
This must either be a Function that eliminates a build-menu, or a Function that displays a button and then destroys itself when a value changes, and either way it's gotta interact with COB, so that it can be told, "hey, this Unit actually finished laying mines once, now I should drop that button".
The Barrage Spell is almost perfect for my needs! It creates a button, communicates through COB, and creates a Unit in the gameworld. Just about exactly what I need, actually.
I've PM'd imbaczek some questions, to (hopefully) get me through this intact, and will (again, hopefully) gain a clue as I go here.
I've PM'd imbaczek some questions, to (hopefully) get me through this intact, and will (again, hopefully) gain a clue as I go here.