How to change dud chance to 0?
Posted: Mon Jun 01, 2020 6:59 am
I'm doing a scene, where a Player throws a grenade to another player and explodes, how do i change or remove dud chance?
- official home of Superfighters Deluxe!
https://mythologicinteractiveforums.com/
https://mythologicinteractiveforums.com/viewtopic.php?f=12&t=4056
Code: Select all
Events.ObjectCreatedCallback ObjectCreated = null;
public void GrenadeDud(TriggerArgs args) {
if (((IObject) args.Caller).CustomId == "on")
ObjectCreated = Events.ObjectCreatedCallback.Start(OnObjectCreated);
else if (((IObject) args.Caller).CustomId == "off")
ObjectCreated.Stop();
}
public void OnObjectCreated(IObject[] objs) {
foreach(IObject obj in objs)
if (obj.Name == "WpnGrenadesThrown")
((IObjectGrenadeThrown) obj).SetDudChance(0.0f);
}
Code: Select all
public void OnStartup(){
Events.ObjectCreatedCallback.Start(OnObjectCreated);
}
public void OnObjectCreated(IObject[] objs) {
foreach(IObject obj in objs)
if (obj.Name == "WpnGrenadesThrown")
((IObjectGrenadeThrown) obj).SetDudChance(0.0f);
}Does this work like any other script? Can it be posted on the Steam workshop?Gurt wrote: ↑Tue Jun 02, 2020 6:27 pmTo always remove the dud chance from grenades for all grenades ever spawned:Code: Select all
public void OnStartup(){ Events.ObjectCreatedCallback.Start(OnObjectCreated); } public void OnObjectCreated(IObject[] objs) { foreach(IObject obj in objs) if (obj.Name == "WpnGrenadesThrown") ((IObjectGrenadeThrown) obj).SetDudChance(0.0f); }
I suggest using the new Events.PlayerWeaponRemovedActionCallback and IPlayer.SetActiveThrowableTimer in v.1.3.6 to modify the explosive timer and modify the dud chance as the player weapon (a grenade) is removed (thrown or dropped) by the player. Just check if the object in the PlayerWeaponRemovedActionCallback event is a IObjectGrenadeThrown and call ((IObjectGrenadeThrown) obj).SetDudChance(0.0f);KliPeH wrote: ↑Tue Jun 02, 2020 9:34 pmOff TopicDoes this work like any other script? Can it be posted on the Steam workshop?Gurt wrote: ↑Tue Jun 02, 2020 6:27 pmTo always remove the dud chance from grenades for all grenades ever spawned:Code: Select all
public void OnStartup(){ Events.ObjectCreatedCallback.Start(OnObjectCreated); } public void OnObjectCreated(IObject[] objs) { foreach(IObject obj in objs) if (obj.Name == "WpnGrenadesThrown") ((IObjectGrenadeThrown) obj).SetDudChance(0.0f); }
I have no idea what any of this means. All I'm saying is I feel a reliable grenade script will be welcomed by the community with open arms and is something I'd even personally use in my own lobbies whenever I host.Gurt wrote: ↑Tue Jun 02, 2020 10:41 pmI suggest using the new Events.PlayerWeaponRemovedActionCallback and IPlayer.SetActiveThrowableTimer in v.1.3.6 to modify the explosive timer and modify the dud chance as the player weapon (a grenade) is removed (thrown or dropped) by the player. Just check if the object in the PlayerWeaponRemovedActionCallback event is a IObjectGrenadeThrown and call ((IObjectGrenadeThrown) obj).SetDudChance(0.0f);
[...]
KliPeH wrote: ↑Tue Jun 02, 2020 11:13 pmOff TopicI have no idea what any of this means. All I'm saying is I feel a reliable grenade script will be welcomed by the community with open arms and is something I'd even personally use in my own lobbies whenever I host.Gurt wrote: ↑Tue Jun 02, 2020 10:41 pmI suggest using the new Events.PlayerWeaponRemovedActionCallback and IPlayer.SetActiveThrowableTimer in v.1.3.6 to modify the explosive timer and modify the dud chance as the player weapon (a grenade) is removed (thrown or dropped) by the player. Just check if the object in the PlayerWeaponRemovedActionCallback event is a IObjectGrenadeThrown and call ((IObjectGrenadeThrown) obj).SetDudChance(0.0f);
[...]
I would highly appreciate it if this were to be uploaded to the Steam workshop.