Page 1 of 1
Deployable Minefield Button
Posted: 26 Aug 2007, 02:35
by Argh
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.
Posted: 26 Aug 2007, 03:17
by AF
This shouldnt be hard todo, I look forward to seeing your progress.
Implementing a simple point and click to deploy mines at a location in a spiral or geometric pattern seems simple enough
Posted: 26 Aug 2007, 04:53
by Neddie
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.
Posted: 26 Aug 2007, 09:19
by KDR_11k
Something about adding a button and command, after that just a call to CreateUnit. Should be easy for you, Argh.
Re: Deployable Minefield Button
Posted: 26 Aug 2007, 11:40
by Masure
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.
Juste like the chinese buildings in C&C ?
That's a good idea !
Posted: 26 Aug 2007, 11:55
by Argh
<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

Posted: 26 Aug 2007, 12:28
by Maelstrom
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.
Posted: 26 Aug 2007, 13:28
by imbaczek
Maelstrom wrote:2) When a 'Lay mines' button is pressed:
You probably want to check for that in CommandFallback call-in.
Posted: 26 Aug 2007, 13:36
by Argh
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".
Posted: 26 Aug 2007, 15:44
by imbaczek
Make a cob function that sleeps and calls luaCOB. I did something similar in the barrage spell script. Also, remember to disallow command in AllowCommand after you remove the button.
Posted: 26 Aug 2007, 16:50
by Agon
Argh, will you release this script for public use? I could use it for a unit, too.
Posted: 26 Aug 2007, 23:12
by Argh
Absolutely, when I get it to work. I'll take a look at the barrage spell and go from there.
Posted: 27 Aug 2007, 00:55
by Argh
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.