1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Need AI like Melee AI, only...

Discussion in 'World Editor Help Zone' started by mr subs, Jan 1, 2012.

  1. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Want AI to cast spells, but not randomly issue move orders

    I need computer controlled units to stop running to their start location when they are created (whether they enter by trigger or by being trained.) Another example of this AI problem is that sometimes (usually happens after a battle) a computer controlled unit (that had been placed in the map using the WE) will run to a region that it has an order to move to in a trigger, but that trigger was never activated and was not even enabled.

    Edit: More and better detail in my second post below.

    I am using melee AI script because I want computer controlled units to cast spells.

    My question:

    Part 1
    Is this a bug or is this a problem that everyone faces when creating an RPG?

    Part 2
    If it is a normal problem, is there an easy fix?

    If you are a philanthropist and this problem sounds abnormal, would you mind dowloading and taking a look at my map.

    Workaround (only idea)
    Alternatively, I could take out the Run Melee AI and use a custom (JASS/vJASS/GUI) AI (not .wai) that makes units cast spells, but I don't see this being very efficient or effective if it is going to command around 20 different units and be triggered by, the only event I have only had small success with, "A Unit Is Attacked".


    Edit: I explain the problem more below.

    Edit: Solved
    That's what I needed to do. I needed to use
    • Player Group - Pick every player in (All players controlled by a Computer player) and do (AI - Start melee AI script for Player 1 (Red): KOTR AI.wai)
    which has no build/attack orders, it has no guard position checked, and it has the condition (if town has gold mine) it would order attack/guard commands, and there are no gold mines in my map, so the AI doesn't order the units to move. Now I can finish making this single player with the help of the AI! I'm still having a lag issue with Drachen Fire, though. That spell worked fine when I transferred onto another map, but it lags on my map. I tried deleting all the doodads, but that didn't work. I'm going to try disabling all the triggers, next and I'll make a thread for help with this soon. THANK YOU FOR YOUR HELP I REALLY APPRECIATE IT, PM ME IF YOU DIDN'T RECIEVE REP.
     
    Last edited: Jan 5, 2012
  2. MajorKaza

    MajorKaza

    Joined:
    Nov 19, 2011
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thats weird. Maby try to make more than 1 AI (each for one city) or 2 CPU players (1 without acctions, and one for them)
     
  3. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    I have tried to use a customi AI. I imported the .wai and that actually worked for about a day. Then, the problem came back. Someone, please, test my map. The abilities are all cool and fun.

    This is part of the problem: Choose a hero with the blue wisp and the newly created hero, owned by computer controlled blue, will take off and run into a corner, because the terrain is blocking the path.

    To give you another visual... Cast the red King Arthur's Drachen Fire. Then, cast that spell using the blue King Arthur. The dragon flies to the left (blue) instead of straight up (red). This is because the dragon unit is given a move order by the AI, but it is only triggered to play its death animation.
     
    Last edited: Jan 4, 2012
  4. kkots

    kkots

    Joined:
    Jun 21, 2007
    Messages:
    534
    Resources:
    0
    Resources:
    0
    I've made a map where there's a knight controlled by computer player blue, and 2 trolls controlled by neutral hostile, and they pursue your footmen forever if you attack them.

    The trick is to order them to attack-move to their current positions periodically.

    ..I'm starting to wonder what can not be done using periodic events..

    EDIT: I'd suggest that the thread's name is changed to, like, Make Units not Come Back to Guard Positions
    EDIT2: I don't really understand what your problem is.
     

    Attached Files:

    Last edited: Jan 5, 2012
  5. Mechanical Man

    Mechanical Man

    Joined:
    Jan 18, 2005
    Messages:
    5,381
    Resources:
    39
    Models:
    30
    Icons:
    3
    Packs:
    1
    Maps:
    4
    Tutorials:
    1
    Resources:
    39
    There is an easy fix. AI - Ignore unit guard position
     
  6. kkots

    kkots

    Joined:
    Jun 21, 2007
    Messages:
    534
    Resources:
    0
    Resources:
    0
    I tried it didn't work. They kept returning.
     
  7. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    @Mechanical Man

    I'm really not sure that this is my problem, but it is definetly a good possibility.

    Edit: I did
    • Player Group - Pick every player in (All players controlled by a Computer player) and do (AI - Ignore the guard positions of all (Picked player) units)
    , but that didn't fix my problem

    @kkots

    Edit: I tested your map and its not going to fix my problem. I know this because: I let the blue knight chase my red knights to the corner. Next, let him kill all my footmen. Then, the computer controlled knight runs back to his starting location. That is my problem or at least something very similar to that. He is issued a move order after the battle.
     
    Last edited: Jan 4, 2012
  8. kkots

    kkots

    Joined:
    Jun 21, 2007
    Messages:
    534
    Resources:
    0
    Resources:
    0
    Ok then. Another map. They are being issued to stop, not attack-move (which seems to be glitched and tied to unit behavior).
     

    Attached Files:

    Last edited: Jan 4, 2012
  9. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    When I open your map it says, this map was saved with a more recent version of WE. Could this be causing the glitch? Can you check my JNGP in my signature, please?

    I do like what I see in this workaround, but I'm not sure it will address the problem. I'll see if I can figure out how to test it in my map.

    Edit: Why can't I just use something like Ignore/Recycle/Lock All Guard Positions.

    Edit 2: I don't understand how this works. Do you have this set to issue Stop on a periodic timer?

    Edit 3: I can't just issue the stop command to every unit on the map, and then periodically order newly created units to stop because I create dummy units for spells (which I create for the owner to cause dmg for that owner) and this could interrupt spellcasting.

    Edit 4: Imagine this footman (in the map below) is a dummy for a spell, or is channeling a spell. I made the periodic check if he is channeling so I think that is sort of resolved with this workaround. However, the dummy unit is still going to move while it is being issued my Last Created Unit orders.
     

    Attached Files:

    Last edited: Jan 5, 2012
  10. kkots

    kkots

    Joined:
    Jun 21, 2007
    Messages:
    534
    Resources:
    0
    Resources:
    0
    Just run the map in warcraft. Here is all you can learn from it:
    Code (vJASS):
    function Trig_Melee_Initialization_Actions takes nothing returns nothing
        call IssueImmediateOrder(gg_unit_hkni_0006,"stop")//the blue knight
        call IssueImmediateOrder(gg_unit_nftb_0005,"stop")//troll
        call IssueImmediateOrder(gg_unit_nftb_0004,"stop")//troll
    endfunction

    //===========================================================================
    function InitTrig_Melee_Initialization takes nothing returns nothing
        set gg_trg_Melee_Initialization = CreateTrigger(  )
        call FogEnable(false)
        call FogMaskEnable(false)
        call TriggerRegisterTimerEvent( gg_trg_Melee_Initialization, 8.00,true )
        call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
    endfunction

     

    EDIT for post below: you can place conditions into Unit Group loops like this:
    Unit Group - Pick every unit in Units in Playable map area matching Unit-Type of Matching unit equal to Footman and do (Actions)
    And yes the "stop" order will issued to units that have been recently produced and might prevent them from going somewhere. But you can use an order condition Current Order of Triggering Unit not equal to Order(move)

    @Meticulous Neutral hostile can cast Unholy Frenzy without turning on melee AI scripts. Computer controlled players cast for example Slow with Sorceress when it's autocast, without turning on any melee AI scripts. I'm sure that training attack groups, constructing expansions and picking up items has got nothing to do with casting spells.
     
    Last edited: Jan 4, 2012
  11. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    I did, why won't you run mine >.>

    look at my last post

    This is not going to work. Please, try to understand why above or by testing my map.

    Just removing "Run Melee AI Script" from the Initialization fixes the problem. However, then I have to create a trigger for every unit on the map or that will be on the map that has spells to get them to cast their spells.

    eg.
    • Untitled Trigger 002
      • Events
        • Unit - A unit Is attacked
      • Conditions
        • (Unit-type of (Attacking unit)) Equal to Dark Ranger
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Life of (Attacked unit)) Greater than or equal to 100.00
          • Then - Actions
            • If ((Life of (Attacking unit)) Greater than or equal to 500.00) then do (Do nothing) else do (Unit - Order (Attacking unit) to Neutral Dark Ranger - Life Drain (Attacked unit))
          • Else - Actions
     
    Last edited: Jan 4, 2012
  12. hellblazer-14

    hellblazer-14

    Joined:
    Apr 16, 2007
    Messages:
    243
    Resources:
    9
    Models:
    9
    Resources:
    9
    I have a solution (albeit cheap, I agree)... try to use the trigger


    • Actions
      • Unit - Pause AI_Unit
      • Set temp_point = (Position of AI_Unit)
      • Unit - Order AI_Unit to Move To temp_point
      • Custom script: remove point(udg_temp_point)
      • Unit - Unpause AI_Unit


    Something in that fashion may work, I'm not sure; triggers are not my strength to be quite honest. Normally that trigger would force your unit to stop, then while paused wipe the old order that made them senselessly wonder towards some point, and leave them standing where they spawned (in theory, at least).
     
  13. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,894
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
    Base your abilities on blizzard ones, and computer will cast them normally, for example, unit will cast storm bolt on you instantly, thunder clap only at 3+ units, heal when you damage it and so on...
     
  14. Meticulous

    Meticulous

    Joined:
    Nov 15, 2007
    Messages:
    779
    Resources:
    0
    Resources:
    0
    Only when melee AI scripts are run, which is the point of the thread.
     
  15. MajorKaza

    MajorKaza

    Joined:
    Nov 19, 2011
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Not rly. You can make auto-cast ablilties so they will work even without AI.

    -------------------------------------------------------------------------------------------------------------------------------------------

    Base skil is Orb of Lighting (new).
    Set chances to 100% (for all) and damage to 0 (set mana cost too if you wish so).
    Make your skill (for e.g. Chain Lighting) with all data (even cd!).
    Pin it onto Orb skill.
    Auto cast ready.

    -------------------------------------------------------------------------------------------------------------------------------------------

    Of course you don't need it for heal or rage. Then just set it as main usege skill in editor, so it will be on autocast from begin.

    -------------------------------------------------------------------------------------------------------------------------------------------
    @hellblazer-14

    It will not work couse fo that AI will make order once again. More usefull is makeing AI by triggers, becouse RPG AI usualy never fall back.
     
    Last edited: Jan 4, 2012
  16. shadowvzs

    shadowvzs

    Joined:
    Nov 13, 2006
    Messages:
    1,803
    Resources:
    2
    Spells:
    2
    Resources:
    2
    its nice coz could give auto purge and usefull with item abilities too like item purge and item rune buffs
     
  17. MajorKaza

    MajorKaza

    Joined:
    Nov 19, 2011
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It not gives auto-purge. It works this way:

    If NOT <<puted_skill>> in cooldown then order - cast <<puted_skill>> on target of attack;

    It will not purge if puted skill won't be it. This skill can cripple, hex, course, slow, stun etc. Unlucky only offensive spells.
     
  18. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Thanks everyone,

    Once I figure out what MajorKaza's idea is I'll report back. It sounds good, but I haven't tried it. I just read it and it was a little confusing at first glance. It might not work for every spell, though.

    Edit: After reading that it only works for single target spells. Its definetly not gonna work >.>
     
    Last edited: Jan 5, 2012
  19. MajorKaza

    MajorKaza

    Joined:
    Nov 19, 2011
    Messages:
    511
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks. :)
     
  20. mr subs

    mr subs

    Joined:
    Jun 18, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Solved
     
    Last edited: Jan 5, 2012