Deployable Minefield Button

Deployable Minefield Button

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Deployable Minefield Button

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post 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
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Something about adding a button and command, after that just a call to CreateUnit. Should be easy for you, Argh.
Masure
Posts: 581
Joined: 30 Jan 2007, 15:23

Re: Deployable Minefield Button

Post 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 !
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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 :|
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post 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.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

Maelstrom wrote:2) When a 'Lay mines' button is pressed:
You probably want to check for that in CommandFallback call-in.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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".
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post 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.
User avatar
Agon
Posts: 527
Joined: 16 May 2007, 18:33

Post by Agon »

Argh, will you release this script for public use? I could use it for a unit, too.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Absolutely, when I get it to work. I'll take a look at the barrage spell and go from there.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post 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.
Post Reply

Return to “Lua Scripts”