Can I use either COB or LUA script, to force a particular weapon to fire as is (no aiming necessary, just fire)?
The effect I'm trying to get at here is basically have the unit drop a bomb from one of its pieces in place, or emit an explosion (not cosmetic).
I believe a workaround would be emit-sfx'ing the explosion, then doing the damage using lua, but if I can, say, force a projectile or bomb to spawn, that would be nicer.
EDIT: I also just thought of a possible workaround using a unit, can someone tell me how to spawn a unit using lua? (not nearly as nice, but could be used temporarily)
Forcing a Weapon to Fire
Moderator: Moderators
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Forcing a Weapon to Fire
COB does what you want.
emit-sfx 2048 + weapon number (first weapon is 0) will fire the weapon from that piece using the piece's position and orientation. This should include projectile, etc.
emit-sfx 4096 + weapon number detonates a weapon at the piece.
For an example, spawn armthund2 in CA, or use the laser bombers modoption.
This is moot, but to create a unit using Lua, you'll need to use Spring.CreateUnit(
string "defName",
number x, number y, number z,
(number facing | string "facing"),
number teamID ) -> number unitID
This is taken from Lua SyncedCtrl.
emit-sfx 2048 + weapon number (first weapon is 0) will fire the weapon from that piece using the piece's position and orientation. This should include projectile, etc.
emit-sfx 4096 + weapon number detonates a weapon at the piece.
For an example, spawn armthund2 in CA, or use the laser bombers modoption.
This is moot, but to create a unit using Lua, you'll need to use Spring.CreateUnit(
string "defName",
number x, number y, number z,
(number facing | string "facing"),
number teamID ) -> number unitID
This is taken from Lua SyncedCtrl.
Re: Forcing a Weapon to Fire
Thanks so much, this will make things very easy.
Weird, must have just not read SyncedCtrl carefully enough...totally missed createunit.
Weird, must have just not read SyncedCtrl carefully enough...totally missed createunit.
Re: Forcing a Weapon to Fire
Hmm, I just noticed, however, that if you emit-sfx 4096 an explosion, the explosion will not follow noselfdamage=1 rules. Hmm...
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Forcing a Weapon to Fire
noselfdamage is pretty broken anyways >_>. You could try gadgeting something like this. Not sure how to get it to work with an emit-sfx explosion though.
Re: Forcing a Weapon to Fire
Hmm, well noselfdamage doesnt work with 4096, but it works with 2048 fine. A little hax makes it all ok.