User Tag List

Results 1 to 7 of 7

Thread: Help with my I.A of turret geting new objective

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with my I.A of turret geting new objective

    Hello I want to achieve this:
    I have turrets that player can create with a radius, turret body and a turret part that rotates when any monster is near and shot him. (in a future will add line of sigh but first need this to work).
    -Turrets must select an objective when monster enter in his radius and won't leave it until monster dies or monster leaves from radius
    -Turret will only shot and rotate in direction of objective
    -(Later will add line of sigh to objective)
    -Also need to fix that turret rotate instantly to monster, maybe saving actual angle and new angle and then slowly substract?

    I dont know what i'm doing wrong need some help, here is an example of my code, thanks!
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    up anyone?

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Apr 2017
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what turret should do if 2 enemies is in radius?

    if U need smooth rotation, use value with angle to monster, and use fast loop:
    every 10ms change direction: actual direction +/- 1
    +/- is a secon condition to loop event (IF monster direction > actual direction THEN actual direction ++)

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by shaku88 View Post
    what turret should do if 2 enemies is in radius?

    if U need smooth rotation, use value with angle to monster, and use fast loop:
    every 10ms change direction: actual direction +/- 1
    +/- is a secon condition to loop event (IF monster direction > actual direction THEN actual direction ++)


    Turret must select the first objective enters in radius, he ignores others until this is dead or leaves radius

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    Here's a modified example:

    example_turret_1.mfa

    I've simplified a bit here and there, added a "rotate-to-destination" part,
    and the turret shots only if it's in an offset of +/-10 degrees towards target (you can change it in line 13 >> angle_to_dest)
    I've moved some of the values to the "visor" object, when useful

  6. #6
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Unknowner's Avatar
    Join Date
    Oct 2011
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    Here's a modified example:

    example_turret_1.mfa

    I've simplified a bit here and there, added a "rotate-to-destination" part,
    and the turret shots only if it's in an offset of +/-10 degrees towards target (you can change it in line 13 >> angle_to_dest)
    I've moved some of the values to the "visor" object, when useful
    Wow that's exactly what I was going for! thanks!, I see where I failed on my first attemp, btw in line 15 you use:
    -Attack_timer ("turret_visor")< 60
    -every 00"-01
    +Add 1 to atack timer

    How you target each counter of turrets instead of all since u dont make a foreach? I tought u should do it always when u want to do multiple independent task on objects

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,155
    Mentioned
    27 Post(s)
    Tagged
    1 Thread(s)
    As a general rule,
    Foreachs are strictly needed when you need to address specific parameters of an object
    that are not available in the object's own "new condition" submenu
    (the one popping out when you click on the object for inserting a new condition)

    All of those are self-scoping,
    so i.e. if you check a condition against alt values of an object,
    all single instances of the object will be checked, and the action(s) will perform on them each singularly

    while it doesn't work the same if you "compare two general values" and pick the values from the object

    In this case it's even simpler,
    because we only need to "add 1" (and not retrieve some specific data from specific objects in the action)
    to "all objects matching condition"
    so altval < 60 will pick all objects whose alt val is < 60
    and all of those objects will get a +1

Similar Threads

  1. geting sacale from an object
    By mmf2fish in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 19th February 2015, 12:25 AM
  2. Replies: 8
    Last Post: 12th February 2014, 03:57 PM
  3. Unicode Programming Help Visual C and Objective C :)
    By Tim in forum Extension Development
    Replies: 17
    Last Post: 1st April 2013, 02:28 PM
  4. error: statically allocated instance of Objective-C class 'BoidType" at build
    By MTCMusic in forum iOS Export Module Version 2.0
    Replies: 7
    Last Post: 27th February 2013, 01:03 PM
  5. geting tired
    By willow in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 22nd June 2010, 06:38 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
  •