Extension Request: Action that changes bullet cooldown

I noticed that there’s no action that changes the cooldown for the “fire bullet” behavior.

I’m making a game where the enemies and bosses have multiple phases, and I want it so the cooldown can be changed to a different number whenever they switch phases.

And while we’re at it, how about a condition that checks the value of the cooldown? (<, >, or =)

I know you guys didn’t make the fire bullet behavior, but can you show this to the guy who made it?

Create your own fire bullets event, use timers

And 4ian(creator of gdevelop) made it

It’s usually members of the community who make extensions, so it’s fine to post that here :wink:


Extensions are made out of normal events, so you can modify it if it doesn’t fit your needs. In the project manager, click on the extension. If it opens the store page, click on “edit extension”.
You should be able to see all behaviors and functions added by the extension. Since this is a behavior, you will need to click the behavior. From there, you can see all the functions of the behavior. You want to add an action, so click “add a function”, then on “action”. Click the function you created to edit it.

Functions have a one special thing that normal events do not have: Arguments. Those are the parameters of actions, expressions, conditions, etc that you need to fill when adding one to your events sheet. You can set any arguments you want, and what type of argument it is.
If it is an object or behavior, you can use it directly in the event sheet. Note that you can only use objects and behaviors passed into the function as an argument, since an extension is independent of a project or scene and doesn’t know of any of the objects there.
If it is a string or number, you can get it with the GetArgumentAsString/GetArgumentAsNumber expression.

Behaviors are attached to an object, so they automatically get the object they are attached to and the current behavior as a parameter. Additionally, behaviors have properties: Those are the settings that are displayed when adding a behavior to an object. When you are editing a behavior’s function, you can read and write those properties: Each property adds an expression Object.Behavior::Property<PropertyName> to get it, and an action on the object to edit it.

So to add this, I am pretty sure all you want to do is add an action to edit a property. In the action you created, add a parameter to be the new cooldown. Make it a number, and give it an internal name like "newCooldown". Then simply add the action in the event sheet to set the cooldown property, and use as new value GetArgumentAsNumber("newCooldown") (or whatever you decide to name the argument internally).

If you feel generous, you can then submit the update to the extension here for everyone to use:

3 Likes