• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Turning off Hero AI using this system

Status
Not open for further replies.
Level 2
Joined
Jun 28, 2016
Messages
12
I see the creator followed good coding convention and made things private - which prevents people from providing some quick and dirty hacks without modifying the original code. Have you tried contacting the creator - he/she might be interested in expanding the functionality of his code? Here is a completely unsafe method that you should copy into HeroAI - which should work....until the AI casts a spell.

Edit: I might update this later if required.

Edit 2: Dis-functional script deleted
 
Last edited:
Level 13
Joined
Oct 18, 2013
Messages
691
hey, thanks! Thats definitely a start! So it will work until any unit that I called RunHeroAI on casts a spell?
 
Level 2
Joined
Jun 28, 2016
Messages
12
Part of the problem is I'd rather not modify an resource without someone's permission and then share that resource. Yes - you still have to stop the triggers than have the following events in HeroAIEventResponse -> EVENT_UNIT_SPELL_ENDCAST / EVENT_UNIT_PICKUP_ITEM, EVENT_UNIT_ATTACKED and EVENT_UNIT_ACQUIRED_TARGET.

There are various ways to do this, the easiest would be to:

Add 3 trigger variables to the struct
  • Under HeroAiEventResponse - method registerEventResponses - rather than declaring a local variable, assign the respective struct variables to the triggers.
  • When you pause an AI, simply turn of the triggers as well (if they exist)
  • To resume an AI, you have to restart the timer and turn the triggers back on.
 
Last edited:
Level 13
Joined
Oct 18, 2013
Messages
691
  • When you pause an AI, simply turn of the triggers as well (if they exist)

Trying to understand what you're saying... Wouldn't this disable for all heroes? Or is this something playing in with "Add 3 trigger variables to the struct"?

also, for that function in your first post, how can I call it outside of HeroAI?
 
Last edited:
Level 2
Joined
Jun 28, 2016
Messages
12
Trying to understand what you're saying... Wouldn't this disable for all heroes? Or is this something playing in with "Add 3 trigger variables to the struct"?

also, for that function in your first post, how can I call it outside of HeroAI?

Ugh Apologies. I completely missed the fact the HeroAIStruct is actually a module and not a struct! After some digging, it looks like creating a general function which pauses or resumes AI for a given unit will be a bit more involved than what I originally expected (isn't it always). I have deleted the rubbish snippet and will look into this tomorrow.
 
Level 13
Joined
Oct 18, 2013
Messages
691
Thanks man :D Don't apologize man your being super helpful right now. I can't really intepret vJASS that much, (mainly with actions/what makes the triggers run) but yeah, if you somehow managed to figure it out and add turnoff functionality, that'd be insanely cool. A definite credits in my map :D
 
Level 13
Joined
Oct 18, 2013
Messages
691
Bump: For some reason, using this AI causes HUGE issues in my map pretty quickly after a hero has AI activated. The entire map gets delay on orders, almost like there is too much net traffic or something. Map breaking bug. If anyone can figure out why this happens and provide a fix for it, that'd be pretty neat. thanks.
 
Status
Not open for further replies.
Top