Custom Block Bug? [Solved - False alarm]

Siren Games

  • *
  • Posts: 102
Hey guys.

I thought I saw a place for bug reporting on the weekly build (b8734), but I can't seem to find any and the "Let us know if you run into any issues" link sends me to the ask a question forum, which seems less than ideal for bug reporting.  But if I'm posting in the wrong spot, please let me know or feel free to move the topic.

Anyway.  I've been toying with custom blocks in the new build and either I'm completely misunderstanding how they work, they've changed in the latest build or they're broken. I've created a simple "Deal X damage to Y Actor" block within a health system behavior, which is attached to enemies and the player (and anything else that might have health later on).  For testing purposes I created a separate event within the health system to check to make sure I set up the block correctly.  I made it a When mouse is pressed on self, deal 10 damage to self.  Works like a charm.



Next I created a projectile, added a damage dealing behavior so I could configure damage of certain projectiles and added a collision event.  The collision even is working great and I know this because the projectiles are being destroyed when they come in contact with the enemies, BUT the deal x damage block isn't seeming to work. 



Debugging

To try to debug this I created the exact same behavior in a scene behavior and attempted to deal damage through group on group collisions and still couldn't get damage to be carried out, though the collisions were firing correctly and projectiles were being destroyed (Even used print commands to verify that I didn't have something else destroying the projectiles) Finally I set up the same behavior within the health system and even tested it in an event on the enemies and the deal damage block seems to work great. So unless I'm misunderstanding how they're supposed to work, they aren't working in behaviors attached to actors that don't also have the custom block definition attached, nor their events.


For starters does anyone have any ideas why this might be happening other than a Stencyl bug?  If so let me know and I'll do some more debugging to be sure that this isn't an issue on my end.

Thanks in advance for any suggestions or feedback on this.

yoplalala

  • *
  • Posts: 1632
use this http://www.stencyl.com/help/view/set-get-attributes-remotely/
instead of set current hp = currentHp-damage.

look at your block you have an actor parametre but he is nowhere to be found in your code.
you have to set the current hp of the actor.

so should be

the block
for actor set current hp to  (for actor get current hp fromhealth behaviour - Damage) for health behaviour

Meestar

  • Posts: 654
use this http://www.stencyl.com/help/view/set-get-attributes-remotely/
instead of set current hp = currentHp-damage.

look at your block you have an actor parametre but he is nowhere to be found in your code.
you have to set the current hp of the actor.

so should be

the block
for actor set current hp to  (for actor get current hp fromhealth behaviour - Damage) for health behaviour

You don't need to specify an actor.  Just as long as you have that there, it'll work.

Using a Game Attribute is overkill.  The actor specified is the actor the behavior is attached to, so it will default to "Self", so it will be subtracting the health from the actor the behavior is attached to.
PM me if you require help.  I'm always glad to help out!

yoplalala

  • *
  • Posts: 1632
Quote
You don't need to specify an actor.  Just as long as you have that there, it'll work.

The problem is that the block is used in the projectile , not inthe actor that should receive the damage.

Meestar

  • Posts: 654
Quote
You don't need to specify an actor.  Just as long as you have that there, it'll work.

The problem is that the block is used in the projectile , not inthe actor that should receive the damage.

Yeah, it isn't being used by the actor receiving the damage, but it should still work as is.  For instance, in my game I have the player's health manager and I have the enemy behavior.  I can use the player's health manager behavior custom block in the enemy's behavior to deal damage to the player.  It doesn't need to be used in a behavior attached to the actor, just needs to be used ON the actor with the behavior.
PM me if you require help.  I'm always glad to help out!

Siren Games

  • *
  • Posts: 102
Quote
You don't need to specify an actor.  Just as long as you have that there, it'll work.

The problem is that the block is used in the projectile , not inthe actor that should receive the damage.

Yeah, it isn't being used by the actor receiving the damage, but it should still work as is.  For instance, in my game I have the player's health manager and I have the enemy behavior.  I can use the player's health manager behavior custom block in the enemy's behavior to deal damage to the player.  It doesn't need to be used in a behavior attached to the actor, just needs to be used ON the actor with the behavior.

Alright... so does this mean I have it set up correctly and it's just a bug?  The health system that actually detracts the health is on botht he player and the enemy, and the projectile is the one using the custom block, telling it to reduce the health.  The actor in the custom block is defined with the group tag.  So that SHOULD work, right?

Meestar

  • Posts: 654
Yes, the way you have it set up should be correct and everything looks like it should be working fine.
PM me if you require help.  I'm always glad to help out!

Siren Games

  • *
  • Posts: 102
use this http://www.stencyl.com/help/view/set-get-attributes-remotely/
instead of set current hp = currentHp-damage.

look at your block you have an actor parametre but he is nowhere to be found in your code.
you have to set the current hp of the actor.

so should be

the block
for actor set current hp to  (for actor get current hp fromhealth behaviour - Damage) for health behaviour

Thanks for the idea.  I've actually dabbled with those behavior blocks before and I knew there was another way to change hit points like that.  When I first started Stencyl I figured out a way to do it with game attributes, but in this case I just wanted to get a better understanding of custom blocks so I wanted to go that route.  I redid my code and set it up using the behavior blocks (only needed the two of them to create a reasonably dynamic damage/attack system) and it's now working perfectly.  So thanks for reminding me I could do this with these blocks.

I'm fairly certain I did have my custom block set up correctly though, so I'm thinking it's just a bug and I hope it gets fixed soon so I can get back to working with them.

rob1221

  • *
  • Posts: 9473
Since the Actor parameter wasn't used I'm assuming you wanted to trigger the custom block of that actor from another behavior.  To do that you need to use %0 which will give you a dropdown to select the correct actor whose custom block you want to trigger.

Siren Games

  • *
  • Posts: 102
Since the Actor parameter wasn't used I'm assuming you wanted to trigger the custom block of that actor from another behavior.  To do that you need to use %0 which will give you a dropdown to select the correct actor whose custom block you want to trigger.

Oh wow.  I can't believe I did that.  I created a new Actor block field instead of using the self field.  I guess I assumed the self field was ONLY for self and couldn't be changed, so I created a new one.  I edited my behavior and it actually works JUST fine now.  So not a bug in Stencyl, just operator error.

Thanks for all the help, everyone.  I'll throw a solved tag in the title here and we can consider this case closed.  Bada bing.

Meestar

  • Posts: 654
Since the Actor parameter wasn't used I'm assuming you wanted to trigger the custom block of that actor from another behavior.  To do that you need to use %0 which will give you a dropdown to select the correct actor whose custom block you want to trigger.

Oh wow.  I can't believe I did that.  I created a new Actor block field instead of using the self field.  I guess I assumed the self field was ONLY for self and couldn't be changed, so I created a new one.  I edited my behavior and it actually works JUST fine now.  So not a bug in Stencyl, just operator error.

Thanks for all the help, everyone.  I'll throw a solved tag in the title here and we can consider this case closed.  Bada bing.

I'm guessing you're not the normal programmer for Siren Games?
PM me if you require help.  I'm always glad to help out!

yoplalala

  • *
  • Posts: 1632

Oh wow.  I can't believe I did that.  I created a new Actor block field instead of using the self field.  I guess I assumed the self field was ONLY for self and couldn't be changed, so I created a new one.  I edited my behavior and it actually works JUST fine now.  So not a bug in Stencyl, just operator error.


Could you post what finally worked ? Because it seems I'm the only one who hasn't undersyand what was finally wrong :P

Meestar

  • Posts: 654
When you create a custom block for an actor, it comes with a built in Actor parameter.  He made a new one and tried to use that one, which is why it wasn't working.
PM me if you require help.  I'm always glad to help out!