Posted by: thepredatorbg - Tuesday, March 20, 2018 8:42:06 AM
I have a modding question. I have some years of experience with INI coding in Generals, but I often try to implement rather unconventional things (for the Contra mod).
So, the question is: is it possible to make a unit fire a specific weapon directly at a specific (or nearest) allied structure? I don't mean spawning an OCL, but actually acquiring and attacking the target. It should be possible against enemies, but against allies?
What I'm actually trying to achieve is make a button which will spawn an object, which will then fire a special weapon at the tunnel (a projectile using bunker buster behavior to forcefully evacuate the tunnel).
Spawning this projectile as an OCL at the tunnel yields no results, only attacking directly does. It seems to be hard-coded. FireWeaponUpdate module also doesn't do the trick since the weapon does not pick targets.
I've implemented forceful evacuation successfully as a shortcut-accessible unit, which requires the player to ctrl+click on the tunnel. It's kind of silly, but it gets the job done. [stuck_out_tongue]
EDIT: I have tried implementing it as a button with the "NEED_TARGET_ALLY_OBJECT" option, but it doesn't seem to work with the "FIRE_WEAPON" command.
Have you tried ?
scripts\unit\Command Button\Use Command Button ability on an Object
You know , you made a Button and it conflicts with fire weapon ... So give this a try . Hope it works
Good Luke Sir [smile]
Posted by: Zatsupachi - Wednesday, March 21, 2018 7:34:49 AM
Does it really have to be NEED_TARGET_ALLY_OBJECT? Or you can work with NEED_TARGET_POS?
Posted by: klingondragon - Wednesday, March 21, 2018 8:10:37 AM
You could try to do it like the comanche rocket area attack.
Posted by: thepredatorbg - Wednesday, March 21, 2018 10:33:45 AM
[quote=Unknown Editor;147307]Have you tried ?
scripts\unit\Command Button\Use Command Button ability on an Object
You know , you made a Button and it conflicts with fire weapon ... So give this a try . Hope it works
Good Luke Sir [smile][/quote]
I'm not making a script. I need to implement this with some INI logic, so that it can work in skirmish and multiplayer.
[quote=Zatsupachi;147312]Does it really have to be NEED_TARGET_ALLY_OBJECT? Or you can work with NEED_TARGET_POS?[/quote]
Yes, I need to select the target itself. Selecting target position does not trigger the anti-tunnel garrison weapon.
[quote=KlingonDragon;147313]You could try to do it like the comanche rocket area attack.[/quote]
This will let me select a target position, but not a target object, which I need. I tested force-firing with Stealth Fighter near a tunnel and the bunker buster weapon did not clear the tunnel unless the tunnel was directly force-fired upon.
So , You mean you'll need to add a Command Button & somehow a Special Power which a unit uses by AI to remove ALLI in-tunnel forces . Then I suppose you will also need to modify SkirmishScripts.scb ; I myself haven't modified that yet but it must be carrying the info AI uses of course . anyways , what's the deal with evacuating tunnels ?
Posted by: thepredatorbg - Thursday, March 22, 2018 12:03:05 PM
[quote=Unknown Editor;147319]So , You mean you'll need to add a Command Button & somehow a Special Power which a unit uses by AI to remove ALLI in-tunnel forces . Then I suppose you will also need to modify SkirmishScripts.scb ; I myself haven't modified that yet but it must be carrying the info AI uses of course . anyways , what's the deal with evacuating tunnels ?[/quote]
I'm not talking about AI here. I was looking how to forcefully evacuate tunnels, because in Contra, some artillery units can get stuck inside tunnels because of how their "turret" deployment works. It's a hard-coded bug which the game does not take care of. So, I'm trying to give players a way to fix this problem in case it happens. Thanks for the replies nonetheless. [+1]
Posted by: Zatsupachi - Thursday, March 22, 2018 3:07:16 PM
It seems you're stuck with force-firing that shortcut-accessible unit.
I tried it myself, and only attacks that specifically aimed at the structure/bunker/tunnel seem to work. And not even a FIRE_WEAPON that needs NEED_TARGET_POS since I get it, it only triggers the auto-evac on direct target(weird, I'll take note of that).
Maybe just have an instruction to hold down ctrl?
I'm not entirely sure...
Posted by: thepredatorbg - Thursday, March 22, 2018 5:02:56 PM
[quote=Zatsupachi;147325]It seems you're stuck with force-firing that shortcut-accessible unit.
I tried it myself, and only attacks that specifically aimed at the structure/bunker/tunnel seem to work. And not even a FIRE_WEAPON that needs NEED_TARGET_POS since I get it, it only triggers the auto-evac on direct target(weird, I'll take note of that).
Maybe just have an instruction to hold down ctrl?
I'm not entirely sure...[/quote]
Yes, that's the only thing that works. However, I found that I cannot prevent this weapon from affecting enemies. It could be used for cheating by players, which is why I may drop this.