[Request] Ability to have a true commandfire
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
[Request] Ability to have a true commandfire
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?
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?
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: [Request] Ability to have a true commandfire
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.
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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: [Request] Ability to have a true commandfire
Option 2 would make the most sense (I think) assuming that it was bound to a hotkey.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.
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.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.
Then on the other hand, if lurker would finish his bos to lua converter, things like this wouldn't be an issue worth discussing.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: [Request] Ability to have a true commandfire
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.KDR_11k wrote:canDGun=1?
Re: [Request] Ability to have a true commandfire
Can't say I've heard of this?Forboding Angel wrote: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.KDR_11k wrote:canDGun=1?
Re: [Request] Ability to have a true commandfire
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.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: [Request] Ability to have a true commandfire
Good then you better do that as gadget-cob script communication is a massive pain.Forboding Angel wrote: Of course scripts can be converted to lua
Re: [Request] Ability to have a true commandfire
Gadget-cob is easy. What's confusing about it?
Lua;
COB;
Lua;
Code: Select all
Spring.CallCOBScript(u, "MyShotBlockingScript", 0)
Code: Select all
MyShotBlockingScript()
{
CanFireMyNiftyGun = 0;
return (0);
}
Re: [Request] Ability to have a true commandfire
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
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
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: [Request] Ability to have a true commandfire
In lua you can easily access global tables, call synced lua functions etc...
Re: [Request] Ability to have a true commandfire
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
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

Re: [Request] Ability to have a true commandfire
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 ?
Re: [Request] Ability to have a true commandfire
Yeah, that is probably a good source.
BTW:
BTW:
I think that might be worth testing- no scripting involved, if true.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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: [Request] Ability to have a true commandfire
Thanks guys
I'll check out KP, cause I think that is what I'm wanting to do.

Re: [Request] Ability to have a true commandfire
But KP's specialattack.lua is too long, complex and confusing. The general idea is:
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.
- 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.
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.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: [Request] Ability to have a true commandfire
Actually, canDgun = true, was overall the most simple solution. However, the d key hotkey isn't working for it. Why would that be?