Page 1 of 1
[SOLVED] Add the exploding barrel effect
Posted: Sun Mar 01, 2020 1:18 pm
by NearHuscarl
Can you add a fifth parameter in IGame.SpawnProjectile() to show the explode effect when the bullet is out of the barrel?
Can you add the exploding barrel effect when bullet is going out of the barrel?

Re: Add explode effect when SpawnProjectile()
Posted: Sun Mar 01, 2020 9:03 pm
by Mr Argon
You actually can use Game.PlayEffect() to achieve that. Search the ScriptAPI for effect names and parameters.
Re: Add explode effect when SpawnProjectile()
Posted: Mon Mar 02, 2020 3:59 am
by NearHuscarl
I'd looked into EffectNames before I posted this. Unless I missed something, there is no way to do that.
Re: Add the exploding barrel effect
Posted: Mon Mar 02, 2020 7:30 pm
by Gurt
Try to create the effect by using the string "MZLED" which REQUIRES args[0] to be an int. Just send in 0.
Re: Add the exploding barrel effect
Posted: Mon Mar 02, 2020 8:13 pm
by NearHuscarl
Code: Select all
Game.PlayEffect("MZLED", Vector2.Zero, 0);
Showed nothing. Log said failed to create effect. I assume the arg[0] is the UniqueID of an IObject but changing it to the id of a nearby object still didn't work.
Re: Add the exploding barrel effect
Posted: Tue Mar 03, 2020 12:05 am
by Mr Argon
Try checking in the script of "Operation Sunrise" un "The Courtyard" part, there are some flak cannons that use this code. Just copypaste an tweak it, it should work that way.
Re: Add the exploding barrel effect
Posted: Tue Mar 03, 2020 4:04 am
by NearHuscarl
Mr Argon wrote: ↑Tue Mar 03, 2020 12:05 am
Try checking in the script of "Operation Sunrise" un "The Courtyard" part, there are some flak cannons that use this code. Just copypaste an tweak it, it should work that way.
Thank you! I didn't know that, it works perfectly now. Gurt should update the EffectNames btw because I didn't see it
Code: Select all
// Second argument Position is useless
// arg[0] is IObject's Unique ID. the argument will be spawned at IObject.GetWorldPosition()
// arg[1] is the weapon muzzle. So far I found
// "MuzzleFlashAssaultRifle" - AssaultRifle
// "MuzzleFlashL" - M60
// "MuzzleFlashM" - MP50, Pistol, Pistol45
// "MuzzleFlashS" - Cabine, Flare Gun, Grenade Launcher, Magnum, Revolver, Sniper
// "MuzzleFlashBazooka" - Bazooka
// "MuzzleFlashShotgun" - Dark Shotgun, Pump Shotgun
Game.PlayEffect("MZLED", Vector2.Zero, m_tip.UniqueID, "MuzzleFlashAssaultRifle");