Somehow I am not able to do it in my project
This is how I set up the action
This is how I am using it (I tried even adding all the objects mentioned as parameters,but still not working)
Somehow I am not able to do it in my project
This is how I set up the action
This is how I am using it (I tried even adding all the objects mentioned as parameters,but still not working)
You have pass gunName as string argument, it’s ok.
But you need pass too Guns and shooterbody as Objects type and declare it in your eventsheet.
Okay still not working. To test if the thing actually works, I created a text object and defined the following action.
I am calling this function as below
This is not changing the text. This is really frustrating.
For parameter#2 set object type to Text.
Here type is important because Text object is the only object how use the action “Modify a text”.
You can set Any object only if you use a standard action like position, rotation,etc…
All properties available for all objects.
Just text action are just for Text object, changing animation are only for sprite object…
You see ?
Otherwise everything is correct in your screens
Hi @Bouh, this worked. Text got changed. But in the main example it did not work even after passing all parameters. One of the parameter is an Object group (“Guns”). Is it possible to pass Object group to function?
Yes take a look on your first screen on first post, you have a 3rd tabs on it.
Yeah I did it. But I did not like the solution that GD provides.
I have an object group called Guns.
Shotgun, Machinegun, Railgun, Uzi etc (7 different guns) are member of this group Guns.
My function is for setting a gun for the player when he picks up one. I made it work by passing all the gun types and then creating an object group inside the function definition. Suppose I have 100 gun types. Does that mean I have to create all the parameters inside function??
I understand what you mean , can you share screens about this?
Hi @Bouh,
This is how the event is getting called.
This is how the function parameters are defined
This is the function body
This is the group i am passing to the function
Let me know if more screens are required. The Guns2 group has three guns now. But if I start adding more guns to the group, my function parameters will grow and make it difficult to call the function.
I see now.
Indeed you need add all objects as parameters and add them in object groups inside function.
But if you don’t want like this you can use “create object action” in a sub-event, just under your function in eventsheet.