Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
I got a request from aeroblyctos, when I finished it he suggested that I could upload it here and now that's done .
The system is MUI and could be very useful in maps with many units. This way allows you to make it easier to controll all those units.
The system allows you to:
* set AI units that will follow and protect any unit
* each AI can have their own master
* each master can have a unlimited ammout of pets (if you would use too many they could not move anyway )
* modes for the pets, passive mode, normal mode and aggresive mode
* unit 1 can have passive mode on while unit 2 can have normal mode
Init
Events
Map initialization
Conditions
Actions
Hashtable - Create a hashtable
Set AI_hash = (Last created hashtable)
-------- SETUP --------
Set AI_move[1] = 500.00
Set AI_move[2] = 300.00
Set AI_move[3] = 500.00
Set AI_order_return[1] = 1000.00
Set AI_order_return[2] = 1000.00
Set AI_order_return[3] = 1500.00
Set AI_order_return_instant[1] = 1200.00
Set AI_order_return_instant[2] = 1200.00
Set AI_order_return_instant[3] = 2000.00
Set AI_order_attack[1] = 800.00
Set AI_order_attack[2] = 500.00
Set AI_order_attack[3] = 1200.00
AI loop
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in AI_group and do (Actions)
Loop - Actions
Custom script: local integer h
Set t_unit = (Picked unit)
Custom script: set h = GetHandleId(udg_t_unit)
Custom script: set udg_Not_AI = LoadUnitHandle(udg_AI_hash, h, 4)
Custom script: set udg_AI_mode = LoadInteger(udg_AI_hash, h, 5)
Set t_loc_3 = (Position of Not_AI)
Set t_loc = (Position of t_unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between t_loc and t_loc_3) Greater than or equal to AI_order_return_instant[AI_mode]
Then - Actions
Unit - Move t_unit instantly to t_loc_3
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between t_loc and t_loc_3) Greater than or equal to AI_order_return[AI_mode]
Then - Actions
Unit - Order t_unit to Move To t_loc_3
Else - Actions
Custom script: set bj_wantDestroyGroup = true
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Issued order) Not equal to (Order(attack))
Then - Actions
Unit - Order t_unit to Attack (Random unit from (Units within AI_order_attack[AI_mode] of t_loc_3 matching ((((Matching unit) belongs to an enemy of (Owner of t_unit)) Equal to True) and ((((Matching unit) is alive) Equal to True) and ((Matching unit) Not equal to No unit)))))
Else - Actions
Custom script: set udg_t_loc_2 = LoadLocationHandle(udg_AI_hash, h, 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Current order of t_unit) Equal to (Order(<Empty String>))
(Distance between t_loc and t_loc_2) Less than or equal to 50.00
Then - Actions
Set t_loc_2 = (t_loc_3 offset by (Random real number between 1.00 and AI_move[AI_mode]) towards (Random real number between 1.00 and 360.00) degrees)
Pet/Companion system 1.4 | Reviewed by Maker | 01.01.14
Concept[/COLOR]]
Pets are a cool addition and are fittinng in a lot of maps
Triggers[/COLOR]]
The system has required options like insta teleport. It is also MUI
There is a...
Non-constant global variables shouldn't be lower-cased,ItShouldBeLikeThis.
Group filters shall be done inside the group enumeration,for readabilty increase.
The "Functions" Trigger should be written in the map header. Not in GUI,it doesn't look good.
Use a Unit Indexer to get rid of hashtable limits.
GetEnumUnit() > cache this.
in the AI group, integer h should be done after setting the PickedUnit var.
@almia
did not know that
It reduces readability in my opinion that is why I used it.
so I should convert the trigger to jass?
I can not use unit indexers, then I can not read my own code
will do
ok
updated.
1. The code will not order the unit to attack if he allready is issued to attack something
2. The unitgroup no longer checks for enemy of player red
You could still terminate the loop if the unit is ordered to attack. You can try Custom script : return or pick a single random unit from the fltered group.
updated!
1. location stored in hashtable is now removed before flushing
2. the location is no longer removed in the function trigger
3. the AI now check if the ordered target is alive before attacking
4. changed trigger names
Xonok the point is to make multi controlling easier. This is better if you got one hero and a few normal units. If you want it to work.with many heroes then just switch the pet owner when you select a unit
Why are the footmen running around like headless chicken all the time in the map? It does not help to test the system. I'll have to edit the test setup myself.
"
-You leak a unit group when you order a unit to attack random unit
The random unit can be null and the attack order still given
from group
-You overwrite locations in the hashtable and thus leak in AI loop
-In Functions you store a loc into the hashtable but remove it right away"
1. fixed
2. I think I fixed it
3. fixed
will try to fix the footman issue before updating tho
EDIT: I found nothing wrong with the movement of the footmans
Hello I really think this is a cool idea for a system. Havent seen it before... but now, so I ve tested it.
________________
When my soldier attacked my hero(on purpose), it ended in chaos and all tryed to kill each other
Same if one of them attacks another one.. maybe you could do they all only attack the attacking unit, but that they all kill each other is strange.
Then I attacked an enemy.. I aimed the closest enemy there was, my soliders were following me.
Then they recognized a new enemy and so they all decided to leave my hero alone and attacked the new enemy (which was a bit far away :s)
This one ...
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between t_loc and t_loc_2) <= 50.00
Then - Actions
Set t_loc_2 = (t_loc_3 offset by (Random real number between 1.00 and AI_move[AI_mode]) towards (Random real number between 1.00 and 360.00) degrees)
1. will do
2. I don't see the benefit out of that. it will not shorten the code/use less actions. I dont see how it could give the system benefits either.
sorry for a very late reply. Then I would need to re-work almost the whole system :-/ I don't think I want to do that.
oh well I fixed a few minior flaws, updated.
The thing is maker have done like 6 reviews on this system and now he wants me to remake the whole shit that will make 6 more reviews after I have remaked it.
not makers fault but it's not really a big inspiration
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.