thepredatorbg
8 years ago
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. 😛

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.
Sponsor
Unknown Editor
8 years ago
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 😄
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
Zatsupachi
8 years ago
Does it really have to be NEED_TARGET_ALLY_OBJECT? Or you can work with NEED_TARGET_POS?
"It's precision_bomber."
Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mods/death-label/downloads/death-label-ver-099 
Next Episode:
precision_bomber's Zero Hour SCIENCE!
klingondragon
8 years ago
You could try to do it like the comanche rocket area attack.
thepredatorbg
8 years ago

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 😄

Originally Posted by: Unknown Editor 



I'm not making a script. I need to implement this with some INI logic, so that it can work in skirmish and multiplayer.

Does it really have to be NEED_TARGET_ALLY_OBJECT? Or you can work with NEED_TARGET_POS?

Originally Posted by: Zatsupachi 



Yes, I need to select the target itself. Selecting target position does not trigger the anti-tunnel garrison weapon.

You could try to do it like the comanche rocket area attack.

Originally Posted by: KlingonDragon 



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.
Unknown Editor
8 years ago
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 ?
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
thepredatorbg
8 years ago

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 ?

Originally Posted by: Unknown Editor 



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. 👍
Zatsupachi
8 years ago
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...
"It's precision_bomber."
Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mods/death-label/downloads/death-label-ver-099 
Next Episode:
precision_bomber's Zero Hour SCIENCE!
thepredatorbg
8 years ago

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

Originally Posted by: Zatsupachi 



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.