• 🏆 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!

Castle Fight Style AI

Status
Not open for further replies.
Level 23
Joined
Jan 1, 2009
Messages
1,610
There was some complicated way by adding locust, hiding the unit, adding chaos, unhiding it and removing locust ~didnt really work.

In castlefight its done -afaik- by just catching the order and reordering the LastOrder.

Even easier would to make the creeps being owned by a computer, you can use nuetral hostile and neutral piassive for that, you just have to change some gameplay constants like Guard Distance. Then you can change the owner of the unit, but not its Teamcolor.
 
Level 5
Joined
Sep 1, 2010
Messages
168
You could use the following:
-a unit enters playable map area
if owner =(players from one side)
-change ownership of unit to (computer of that side) without recolouring
-set 0of keyof (triggering unit) = playernumber of previous owner) in ownerhashtable
-order unit to (attack move (target location)

plus

another trigger:
a unit dies
-add (whatever amount of gold) to player(load 0 of key(killing unit))ownerhastable
-set loc = position of dying unit
-create a floating text at loc (concecrate strings: (|colourcode you like+) (insert the goldamount you added earlier here)(|r)
set velocity of last created floating text blablabla...
blablabla (rest for floating text)
custom script: (call RemoveLocation(loc))
clear all childs of key(dying unit) in ownerhashtable


This way a player can't give bounty, you can keep track of whom the unit belongs to and you're able to add a visual bounty effect.
anything else you need?
 
Level 13
Joined
Oct 16, 2010
Messages
731
Well I forgot that i made this post so i've used computers to control the units and i have a round timer where the money the computers have is given to the computer. I'm fine with that. Thanks for the help anyway.

In the map i have made a mode where double the gold is given per round and you start with double gold, the problem is that if a tower or player controlled unit gets a kill there isn't double bounty, any way to change that? if not im not too bothered but it would be good if i can change that
 
Level 13
Joined
Oct 16, 2010
Messages
731
What i meant was when a player unit kills a unit (so a tower killing a unit).

Plus i forgot to update the thread, the normal units are now computer controlled and there are few units which the player can actually train and use themselves, which also give bounty.

I just don't know how to double the bounty given, if that is possible.
 
Level 12
Joined
Dec 17, 2009
Messages
951
i have a demo map about this.
about the 'uncontrolable', is a jass trigger (kinda annoying) so i use a owner replace, when the units come to life spawned by building type X ,auto change units owner to a unused player like player 12 or 11.
about the spawn and move system, i have everything you need, and some triggered auto cast spell, exactly like castle fight :)
 
Level 13
Joined
Oct 16, 2010
Messages
731
Thanks for the help, will do the doubling bounty thing.

.VTZ.
Sorry but i've got it sorted and i didn't really want the buildings to train them themselves, just the number of units to be done by each building (so 1 farm = 1 milita, 1 barracks = 1 footman). I'm happy with what i have so soz!
 
Status
Not open for further replies.
Top