Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

How to change dud chance to 0?

Share questions and tutorials related to the map editor. Share you maps in the Superfighters Deluxe Custom Maps section.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
dsafxP
Meatbag
Posts: 6
Joined: Fri May 08, 2020 5:16 am
SFD Account: dsafxP

How to change dud chance to 0?

Post by dsafxP » 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?
0 x

User avatar
Pricey
Superfighter
Superfighter
Posts: 399
Joined: Thu May 05, 2016 9:29 pm
SFD Alias: (LM) Pricey
Started SFD: August 2015
Location: United Kingdom
Gender:
Age: 18

Post by Pricey » Tue Jun 02, 2020 2:07 pm

If you place a gib zone in front of the player you want to explode, the grenade will always explode when it hits it.
Image
► Show Spoiler
0 x

User avatar
Odex64
Superfighter
Superfighter
Posts: 116
Joined: Sat Jul 29, 2017 12:39 pm
Title: Content Creator
SFD Account: Odex64
Started SFD: PreAlpha
Location: Italy
Gender:
Age: 18

Post by Odex64 » Tue Jun 02, 2020 3:37 pm

@Pricey is right, but if you want to do it through script you can use my code:

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);
}
Now place any trigger when the scene starts, and assign it "GrenadeDud" on ScriptMethod and "on" in ObjectID box.
From now on any grenade you throw, it'll explode!

To disable it, place another trigger when your scene is over and assign it "GrenadeDud" on ScriptMethod and "off" in ObjectID.
1 x
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1861
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 30

Post by Gurt » Tue Jun 02, 2020 6:27 pm

To 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);
}
0 x
Gurt

User avatar
KliPeH
Moderator
Moderator
Posts: 888
Joined: Sat Mar 19, 2016 3:03 pm
Title: [happy moth noises]
SFD Account: KliPeH
Started SFD: Pre-Alpha 1.4.2
Gender:
Contact:

Post by KliPeH » Tue Jun 02, 2020 9:34 pm

Off Topic
Gurt wrote:
Tue Jun 02, 2020 6:27 pm
To 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);
}
Does this work like any other script? Can it be posted on the Steam workshop?
0 x
 
Image

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1861
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 30

Post by Gurt » Tue Jun 02, 2020 10:41 pm

KliPeH wrote:
Tue Jun 02, 2020 9:34 pm
Off Topic
Gurt wrote:
Tue Jun 02, 2020 6:27 pm
To 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);
}
Does this work like any other script? Can it be posted on the Steam workshop?
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);

But yes, all parts are there for a script to be utilized in the workshop if you like.
0 x
Gurt

User avatar
KliPeH
Moderator
Moderator
Posts: 888
Joined: Sat Mar 19, 2016 3:03 pm
Title: [happy moth noises]
SFD Account: KliPeH
Started SFD: Pre-Alpha 1.4.2
Gender:
Contact:

Post by KliPeH » Tue Jun 02, 2020 11:13 pm

Off Topic
Gurt wrote:
Tue Jun 02, 2020 10:41 pm
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);

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

I would highly appreciate it if this were to be uploaded to the Steam workshop.
0 x
 
Image

User avatar
Odex64
Superfighter
Superfighter
Posts: 116
Joined: Sat Jul 29, 2017 12:39 pm
Title: Content Creator
SFD Account: Odex64
Started SFD: PreAlpha
Location: Italy
Gender:
Age: 18

Post by Odex64 » Tue Jun 02, 2020 11:52 pm

KliPeH wrote:
Tue Jun 02, 2020 11:13 pm
Off Topic
Gurt wrote:
Tue Jun 02, 2020 10:41 pm
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);

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

I would highly appreciate it if this were to be uploaded to the Steam workshop.
Off Topic
Time ago I was developing a "nerf" script which remove drones, reduce damage and criticals for some weapons and change some gameplay mechanics, but I never finished it. I could resume my work and add the grenades dud chance thing
2 x
Image

User avatar
dsafxP
Meatbag
Posts: 6
Joined: Fri May 08, 2020 5:16 am
SFD Account: dsafxP

Post by dsafxP » Wed Jun 03, 2020 8:41 am

Thank you all!
0 x

Post Reply