User Tag List

Page 4 of 4 FirstFirst ... 2 3 4
Results 31 to 34 of 34

Thread: [Bug?] For each object in filter condition

  1. #31
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Vilhjalmr's Avatar
    Join Date
    Mar 2014
    Location
    Sweden
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe this thread could be renamed the "official loop scope issue" thread? I have another one that I've been struggling with.
    I have a shooter game where I want damage counters to show the total damage taken by enemies. These counters (black ones) pop up over their heads and disappear after 1 second after the last hit. When the enemy is killed the counter is destroyed and replaced by another counter that show the "final damage" (blue ones). The problem I have is that SOMETIMES "ghost counters" appear under the black counters, as if the pairing of ID to fixed value is lost and prevents the counter from following the hit enemy. However, the counter isn't stuck, there just seems to be another counter created under it and left in place since it shows up in the debugger. Might be a scope issue with the "counterCool" value that should make it disappear, but none of the counters seem to be reset. It's is kind of hard to recreate this.

    ghostCounters.png
    This image shows the ghost counters, enemies have been killed.

    ghostCounters2.png
    The damageRoll flag means that the enemy has been hit and has a counter. DamageRoll for the "cha" object is unrelated. The counter is created on first hit and added to while hit again (addToCounter loop).

    ghostCounters3.png
    The blue counter is created when the counters' respective enemy has HP 0. Old counter is destroyed. (The counter add furthest down is unrelated).

    ghostCounters4.png
    The counter should follow it's enemy and is destroyed when counterCool or Hp is 0.


    Any help greatly appreciated!

  2. #32
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Vilhjalmr's Avatar
    Join Date
    Mar 2014
    Location
    Sweden
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another one, I just can't wrap my head around these.
    Even though the pairing ID->Fixed works then creating the objects only 1/3 of the objects behave correctly.
    position.png
    position2.png

  3. #33
    Clicker

    Fusion 2.5Android Export Module

    Join Date
    Jan 2007
    Posts
    277
    Mentioned
    6 Post(s)
    Tagged
    1 Thread(s)
    Vilhjalmr, What happens if you change the lines that say "

    Damage Counter of Group.Enemies = Fixed Value

    to

    Fixed Value = Damage Counter of Group.Enemies

    I've also attached a MFA of what I think you're trying to accomplish.

    Z shoots 1 bullet
    Holding X shoots rapid fire
    Pressing 1-9 shoots that many bullets consecutively

    I'm not 100% sure, but line 19 may have to be scoped within a foreach loop to prevent counters/enemies from getting mixed up in a game.

    The concept is that you don't need to link anything via fixed-ID. All damage taken information is stored within the enemy being attacked so the game should always know exactly what enemy is taking the damage. The bullets are scoped within a foreach loop because sometimes multiple bullets can hit the enemy and be destroyed, but the code only triggers once . . . the foreach loop makes sure each bullet has moment and runs the damage code :P.



    Personally I've been having some issues with ForEach loops seemingly not iterating through all lines that they're instanced in . . . if that makes sense.

    I have a foreach loop that basically does the following:

    Start of frame
    - Run ForEach loop "Stairs" on "Group.Obstacles"

    On ForEachLoop "Stairs"
    + Condition 1 is met
    - Write String "Stairs" to Array 1 at x,x,x

    On ForEachLoop "Stairs"
    + Condition 2 is met
    - Write String "Stairs" to Array 2 at x,x,x

    On ForEachLoop "Stairs"
    + Condition 3 is met
    - Write String "Stairs" to Array 3 at x,x,x

    On ForEachLoop "Stairs"
    + Condition 4 is met
    - Write String "Stairs" to Array 4 at x,x,x


    Depending on how many conditions are met simultaneously, it writes to a completely random set of arrays and not all of them. So if 2 conditions are met it might only write to one. If 4 conditions are met it might only write to 2. If I deactivate some of the lines then the array(s) that get written to changes again. If I split the code up into 4 different loops it works perfectly so I had to use this as a solution.

    Start of frame
    - Run ForEach loop "Stairs____1" on "Group.Obstacles"
    - Run ForEach loop "Stairs____2" on "Group.Obstacles"
    - Run ForEach loop "Stairs____3" on "Group.Obstacles"
    - Run ForEach loop "Stairs____4" on "Group.Obstacles"

    On ForEachLoop "Stairs____1"
    + Condition 1 is met
    - Write String "Stairs" to Array 1 at x,x,x

    On ForEachLoop "Stairs____2"
    + Condition 2 is met
    - Write String "Stairs" to Array 2 at x,x,x

    On ForEachLoop "Stairs____3"
    + Condition 3 is met
    - Write String "Stairs" to Array 3 at x,x,x

    On ForEachLoop "Stairs____4"
    + Condition 4 is met
    - Write String "Stairs" to Array 4 at x,x,x

    All 4 arrays get populated with the correct values in the correct spots.

    The biggest detail to note is that the loop is scoping the "Group.Obstacles" BUT the conditions inside of the loop are all checking to see if specific strings exist within specific arrays. I've attached a screenshot of some of the code. I find it odd that this doesn't work within a single loop, but works when the loops are split.

    snippet.jpg
    Attached files Attached files

  4. #34
    Clicker Fusion 2.5 DeveloperAndroid Export Module
    Vilhjalmr's Avatar
    Join Date
    Mar 2014
    Location
    Sweden
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    GamesterX23, I tried what you said.
    I switched the cases in first all, and then just some of the lines but it broke the overall functionality.
    Thank you for making the .mfa, I attached a vid of the envisioned mechanics with the ghost counter showing up. I'm trying to make out what causes this but it's hard to see and recreate.
    I think the fixed->ID relation is necessary to accomplish this with many counters moving after their respective enemy but I'm not sure.

    https://streamable.com/f9snaz

    I see that I'm not alone in coming across these peculiarities regarding Fusions loops and scope, there should be a comprehensive guide made covering these scenarios.

Page 4 of 4 FirstFirst ... 2 3 4

Similar Threads

  1. Help with active object condition
    By fafikozoom in forum Fusion 2.5
    Replies: 5
    Last Post: 18th October 2016, 07:25 PM
  2. Flash object while [condition]
    By Hidronax in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 13th August 2016, 06:23 PM
  3. Replies: 2
    Last Post: 26th September 2015, 07:23 PM
  4. nearest object condition event
    By Lukiester in forum Fusion 2.5
    Replies: 4
    Last Post: 21st August 2015, 06:24 PM
  5. Graphics Filter, Audio Filter, and Transition SDK
    By kraminator in forum Extension Development
    Replies: 7
    Last Post: 27th March 2011, 08:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •