[Request] Ability to have a true commandfire

[Request] Ability to have a true commandfire

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

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

[Request] Ability to have a true commandfire

Post by Forboding Angel »

What I mean by that is, I want to be able to have stockpileable weapons on certain units in addition to their regular weapons, firing from the same place, but i need those weapons to only fire on a certain command. I thought commandfire true would do the trick, but it turns out that commandfire true will fire the weapon upon any attack order, this means that unless the unit is set to hold fire, the stockpiled weapon will fire the moment it has something to attack.

The idea here is that these stockpiled weapons would be more devastating versions of the original weapons. For example, in the current evo build (523), the riottanks can stockpile an advanced riot weapon that instead of the normal shot which is 1 round every 0.5 seconds, it is 25 shots spread over 0.5 seconds (in other words, 5 rounds every millisecond).

But, there is a huge gaping flaw, and that is the fact that commandfire doesn't work the way I thought it did. Could someone help me out with implementing something like this?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: [Request] Ability to have a true commandfire

Post by KDR_11k »

canDGun=1?
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: [Request] Ability to have a true commandfire

Post by Google_Frog »

Do it in Lua! (I presume that's why you posted here)

I see two variations for the UI for this:
1. A button that toggles between fire normal or special weapon.
2. A button that fires the special weapon much like a dgun.

I hope your unit scripts are written in lua... I could write some outlines as to how to do either implementation but it would be wasted if your unit scripts cannot be converted to lua.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Request] Ability to have a true commandfire

Post by Forboding Angel »

Google_Frog wrote:Do it in Lua! (I presume that's why you posted here)

I see two variations for the UI for this:
1. A button that toggles between fire normal or special weapon.
2. A button that fires the special weapon much like a dgun.
Option 2 would make the most sense (I think) assuming that it was bound to a hotkey.
Google_Frog wrote:I hope your unit scripts are written in lua... I could write some outlines as to how to do either implementation but it would be wasted if your unit scripts cannot be converted to lua.
Now you're just being silly. Of course scripts can be converted to lua, but if possible I'd prefer to not have to because it would be a massive pain in the ass.

Then on the other hand, if lurker would finish his bos to lua converter, things like this wouldn't be an issue worth discussing.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Request] Ability to have a true commandfire

Post by Forboding Angel »

KDR_11k wrote:canDGun=1?
Unless I'm mistaken, dgun stuffs is due for separation from the engine (to be redone via lua), so going this route would in the end probably be a bad idea.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: [Request] Ability to have a true commandfire

Post by FLOZi »

Forboding Angel wrote:
KDR_11k wrote:canDGun=1?
Unless I'm mistaken, dgun stuffs is due for separation from the engine (to be redone via lua), so going this route would in the end probably be a bad idea.
Can't say I've heard of this?
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: [Request] Ability to have a true commandfire

Post by hoijui »

if it will be outsourced from the engine to Lua, you would be able to use the replacement Lua afterwards, so it would not be a bad idea cause of that. i do not know if anyone plans to really do that, but it would make sense of course, as it is very limited as it is, and very TA specific.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: [Request] Ability to have a true commandfire

Post by Google_Frog »

Forboding Angel wrote: Of course scripts can be converted to lua
Good then you better do that as gadget-cob script communication is a massive pain.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Request] Ability to have a true commandfire

Post by Argh »

Gadget-cob is easy. What's confusing about it?

Lua;

Code: Select all

Spring.CallCOBScript(u, "MyShotBlockingScript", 0)
COB;

Code: Select all

MyShotBlockingScript()
{
	CanFireMyNiftyGun = 0;
	return (0);
}
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: [Request] Ability to have a true commandfire

Post by AF »

It's slow, and has all the problems that come with cob, whereas lua to lua is faster and allows for far easier implementation and much better integration

That and cir is kind of a cul de sac dead end technology, there's just so much kore that can be done in a proper dynamically typed language than a compiled language that doesn't even support all of the most common basic data types
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: [Request] Ability to have a true commandfire

Post by Google_Frog »

In lua you can easily access global tables, call synced lua functions etc...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Request] Ability to have a true commandfire

Post by Argh »

Aw, c'mon, guys. Don't waste time with irrelevancies.

All you have to do now is write the Lua side, which is universal.

I'm fairly sure that Forb can write a COB script cancelling an aim-weapon routine, and connect your script to COB, using the code as demonstrated and a hold on an aim-weapons function :regret:
SeanHeron
Engines Of War Developer
Posts: 614
Joined: 09 Jun 2005, 23:39

Re: [Request] Ability to have a true commandfire

Post by SeanHeron »

Perhaps semi-relevant (though no ready made solution there - and I have to admit, I got held up with other stuff, so have no working code laying about either) - Dgun Command fire For Non TA games ?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Request] Ability to have a true commandfire

Post by Argh »

Yeah, that is probably a good source.

BTW:
I believe any commandfire weapons on a canDGun unit will be bound to the dgun button, IIRC I had that mixed on a SimBase EDIT commander that had both a regular weapon and a vlaunch missile.
I think that might be worth testing- no scripting involved, if true.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Request] Ability to have a true commandfire

Post by Forboding Angel »

Thanks guys :-) I'll check out KP, cause I think that is what I'm wanting to do.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: [Request] Ability to have a true commandfire

Post by zwzsg »

But KP's specialattack.lua is too long, complex and confusing. The general idea is:
  • Make a custom command.
  • In CommandFallback makes it:
    • CallCOBScript a bos/cob function that set a variable
    • Insert a attack command at the top of the command queue
  • In the bos/cob, have the weapon be locked (with a return 0; in AimWeaponX) unless the variable is set.
  • Lock the regular weapons when that var is set.
  • Reset that var in the FireWeaponX.
However, because of syncedness, you can't do stuff in CommandFallback, so instead in CommandFallback you store in a list the units who needs to have the attack command inserted and the CallCOBScript called, and you treat them in GameFrame.

If the unit is set on repeat, attack command keeps getting inserted over and over, so to prevent that I added a check that the top command in the queue isn't already an attack command.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: [Request] Ability to have a true commandfire

Post by Forboding Angel »

Actually, canDgun = true, was overall the most simple solution. However, the d key hotkey isn't working for it. Why would that be?
Post Reply

Return to “Lua Scripts”