User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: trigger event when all enemies are same state

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Sep 2008
    Location
    Melbourne, Australia
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trigger event when all enemies are same state

    I'm stuck on a condition, and not sure if it's just because my brain has shut down for the evening; I have multiple enemies with a spread ID and fast loop. All working fine.
    But I want something to trigger only when they're all in the same state.

    This is all I've come up with at the moment:

    On loop "enemyState"
    +enemyID of enemy = LoopIndex("enemyState")
    +state of enemy = 15

    - begin trigger

    Problem here is the first enemy to get a state of 15 activates the trigger. But I only want it to happen when they're all state 15.

  2. #2
    Clicker Multimedia Fusion 2
    Algul's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Have a temp value and in loop add 1 every time the enemy have that state.
    on loop "enemyState"
    +ID = loopindex
    +state = state_to_test
    -add 1 to "temp"

    then test if "temp" = enemy count.
    I don't know if this is the best way to do it but it should work as you want.
    Or you can use Select object extension to pick all objects with that state and then compare number of selected object with total count.

  3. #3
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Make sure you reset temp before/after the loop!
    Working as fast as I can on Fusion 3

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Sep 2008
    Location
    Melbourne, Australia
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Hey that's it! Thanks so much, Algul, LB.

    Hugely appreciated.

  5. #5
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Saml's Avatar
    Join Date
    Jan 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Or you could just go

    (negated) state of "enemy" <> 15

    -trigger

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Sep 2008
    Location
    Melbourne, Australia
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Quote Originally Posted by Algul
    Have a temp value and in loop add 1 every time the enemy have that state.
    on loop "enemyState"
    +ID = loopindex
    +state = state_to_test
    -add 1 to "temp"

    then test if "temp" = enemy count.
    I don't know if this is the best way to do it but it should work as you want.
    Or you can use Select object extension to pick all objects with that state and then compare number of selected object with total count.
    Unfortunately, didn't work as planned. as it keeps adding 1 to temp on the first enemy that becomes the required state.
    This is what I've done:

    On loop "enemyState"
    +enemyID = loopindex("enemyState")
    +State of enemy = 15
    -add 1 to temp

    temp of enemy = NObjects("enemy")
    -trigger

    The Select Object Extension looks interesting in this case, but I'm not exactly sure how to use it. How do I select only the objects in that state?

    Saml - thanks for your input, unfortunately comparing to an alt value can't be negated.

  7. #7
    Clicker Multimedia Fusion 2
    Algul's Avatar
    Join Date
    Feb 2008
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    If you set "temp" to 0 before running the loop as LB pointed out then it should work. Here I tested it View MFA

  8. #8
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Sep 2008
    Location
    Melbourne, Australia
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Thank you, Algul for taking the time to do that. I did set temp to 0 but set a few other things up incorrectly as you've highlighted for me.

    Thanks again for your help.

    Edit: what I did wrong - I added the 'temp' val to the actual enemies, instead of another object. Made all the difference. I can sleep now!

  9. #9
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    To use the select object, you'd do:

    State of enemy = 15
    +Select: Compare to number of selected "enemy" = NObjects("enemy")
    -do stuff

    Then "do stuff" will only happen when all "enemy" have state = 15.

  10. #10
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Sep 2008
    Location
    Melbourne, Australia
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: trigger event when all enemies are same state

    Now I know about, and have installed the select object. I'll probably make some use of it. Thanks for that, Dynasoft. I was getting a little confused with some of the options in there, and what order to put 'State of enemy = 15'.

    Now I've learned two ways to do the job, I'm stoked!

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Trigger event on Windows shutdown?
    By Ryan in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 3rd July 2013, 10:46 AM
  2. Trigger Event When Objects in Group Share Same Value
    By Sky in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 5th June 2013, 11:18 AM
  3. Beta 33 [Crash] when using a 'read button state' event in the first frame
    By colej_uk in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 28th August 2012, 11:54 AM
  4. Search inside edit box for text, trigger event.
    By Kingoftaurus in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th May 2010, 04:33 AM
  5. How would you trigger an event after a fastloop?
    By BREK in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th April 2009, 11:57 AM

Posting Permissions

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