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

GAH! need ai help

Status
Not open for further replies.
Level 4
Joined
Apr 7, 2009
Messages
108
i am making this zombie survival map (ex: gears of war 2 horde and cod 5 zombies) and im just starting with jass so all this ai stuff is confusing me. i understand the ai editor fully. just need like some tutorial of someone to show me how to make an ai make all zombies attack closest person they spawn to per level.

please try to explain slowly, im starting to understand jass alot, but i don't know many function terms or w/e there called.(ex: CreateNUnitsAtLocation, ForForce, etc etc)

hope someone will help me and +rep:grin:
 
Last edited:
Level 4
Joined
Apr 7, 2009
Messages
108
the ai in ai editor goes in middle of map and sits there.....
but do you know of anything that could help, like a tutorial?

i have seen a few but they are about campaigns n hero arenas.
idk wat i would type of tutorial it would be if i looked for a tutorial of my type.
 
Level 4
Joined
Apr 7, 2009
Messages
108
okay my idea:
-every level the zombies hp goes up by 10, but lvl 1 is 3 hp, 2 is 6, 3 is 10, 4 is 15, 5 is 22, and 6 is 30
-you get money from kills and start with a little
-the place where you spawn has 3 spawn points where you cannot enter or go near to spawn kill
-you start with a few pistols on the ground you must grab n equip
-then you can grab 1 weapon off something, like a stand, im thinking an uzi
-you can open a gate to open a new area, opening 2 more spawns, meaning more zombies spawn
-then there are better weapons, more gates, more spawns, for every gate you open(until a dead end or a circle)
-every 10 levels a boss will spawn. adding a little spice to the game
-and oh yea, did i forget to say this, its in 3rd person view.. ^^

extra notes,
-you grab a weapon as an item, then press equip ability to equip whatever weapon is in first inv slot
-zombies will always take 6-7 hits to kill you
-you can bring someone back up that is downed
-you have a certain amount of ammo per clips, then you must realod, but infinite clips(maybe for now)
-i have already made an auto reload and ammo using system
-clip size will vary by weapon
-weapons are: pistol, sub machine gun, heavy support rifle, assault rifle, machine gun, and shotgun(for now)

AI's role:
-creates a few zombies in every spawn per zombie level (1-9, 11-19, 21-29, etc etc) and attack the closest enemy to them
-when a new person is closer they will attack new enemy
-they will not run away, retreat, or anything else, but charge to their deaths

(if you would like i can attach the game to show what i have so far)
so yea, i started this game yesterday, and i can do pretty much everything, but create a working ai.
 
Last edited:
Level 4
Joined
Nov 23, 2007
Messages
113
You can't use triggers (for example to detect when a new enemy is closest etc) or any "for" functions (such as ForForce(), ForGroup()) in an ai file. You will need to do that using triggers.
 
Level 4
Joined
Apr 7, 2009
Messages
108
store the range? can u plz like just put that in tags, or explain, this is what i think u mean

pick all units
store all ranges between all zombies and survivors
make shortest ranges attack each other?
or...
pick all survivors
attack survivor with closest range?(ima check it out right now)
 
Level 11
Joined
May 31, 2008
Messages
698
This is a trigger i made that will order all enemies to attack move to a random point on teh map:

  • OrderAttack
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup[0] = (Units owned by Player 12 (Brown))
      • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (==) (Order(none))
            • Then - Actions
              • Set TempLoc[0] = (Random point in (Playable map area))
              • Unit - Order (Picked unit) to Attack-Move To TempLoc[0]
              • Custom script: call RemoveLocation(udg_TempLoc[0])
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup[0])


Heres one that will order all units owned by a player to attack a random enemy:

  • OrderAttack Copy
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup[0] = (Units owned by Player 12 (Brown))
      • Set TempGroup[1] = (Units in (Playable map area) matching (((Matching unit) belongs to an ally of Player 1 (Red)) Equal to (==) True))
      • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
        • Loop - Actions
          • Set TempLoc[0] = (Position of (Random unit from TempGroup[1]))
          • Unit - Order (Picked unit) to Attack-Move To TempLoc[0]
          • Custom script: call RemoveLocation(udg_TempLoc[0])
      • Custom script: call DestroyGroup(udg_TempGroup[0])
      • Custom script: call DestroyGroup(udg_TempGroup[1])
You could also just give the zombies a very high acquisition range and they should automatically acquire a target once they spawn and attack that target. But to do this you will have to reveal the map for whoever the zombie player is.
  • Visibility - Create an initially Enabled visibility modifier for Player 12 (Brown) emitting Visibility across (Playable map area)
For all of this i am assuming that player 12 is the zombies and player 1 is not a zombie.
 
Level 4
Joined
Apr 7, 2009
Messages
108
i knew how to do all that, just never though about actually using object editor to help

i got entire map open from start cus its 3rd person, dnt want u looking into black =/

THANKS FROM ALL, especually wolfman, thats all i needed, 99999999 acquisitian range

well that solves the "ai" problem, time to do the boring parts, terrain, weps, and a crap load of triggers.


BUM BUM BUMMMMMM tested it, at 20k acquisition range(max) and will only go like 1000(range) then turn back werever it spawned

apperently that did not work

also wolf for yer other 2 "solution" with random stuff

attack random place:
this place is going to be huge, so that will not work, seeing random zombies going in circles isnt wat i want

attack random enemy:
say ther is a person wide and like 20 person long place with 1 ramp on end, 2 ppl r in front, only ppl that can be attked, zombs have 8/10 to attk other ppl

and also wen u do every 2 secs and a new place, the zombies actually stop for sec or 2 to figure out new location


once again i just suggest dling my map, see what i have, and see what you can do(if you want me to, i can message it to you or just attach it)
 
Level 11
Joined
May 31, 2008
Messages
698
For some reason whenever a unit is ordered to attack or do anything it always seems to go back to its starting position. Maybe you can go into gameplay constants and change guard distance or something. Try changing Guard Return Distance. The default to that is 1000, so try making it as high as it will go hopefully that will work.

EDIT:
Ok I made this trigger. It makes the zombies attack the unit that is closest to them. No need for high acquisition range, but i did change the Guard Return Distance and the Guard Distance to maximum (hold shift and double click the value to make it even higher)
  • ZombieAttack
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup[0] = (Units in (Playable map area) matching (((Owner of (Matching unit)) is an ally of Player 1 (Red)) Equal to (==) True))
      • Set TempGroup[1] = (Units in (Playable map area) owned by Player 12 (Brown))
      • Unit Group - Pick every unit in TempGroup[1] and do (Actions)
        • Loop - Actions
          • Set TempInt[0] = 1
          • Set Zombie = (Picked unit)
          • Set TempLoc[0] = (Position of (Picked unit))
          • Unit Group - Pick every unit in TempGroup[0] and do (Actions)
            • Loop - Actions
              • Set TempLoc[TempInt[0]] = (Position of (Picked unit))
              • Set TempInt[0] = (TempInt[0] + 1)
            • Do Multiple ActionsFor each (Integer A) from 1 to (Number of units in TempGroup[0]), do (Actions)
              • Loop - Actions
                • Set TempReal[(Integer A)] = (Distance between TempLoc[0] and TempLoc[(Integer A)])
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempReal[(Integer A)] Less than (<) TempReal[((Integer A) - 1)]
                    • Then - Actions
                      • Set TempLoc[1000] = TempLoc[(Integer A)]
                    • Else - Actions
          • Set TempGroup[2] = (Units within 100.00 of TempLoc[1000])
          • Unit Group - Pick every unit in TempGroup[2] and do (Actions)
            • Loop - Actions
              • Unit - Order Zombie to Attack (Picked unit)
            • Do Multiple ActionsFor each (Integer A) from 0 to 12, do (Actions)
              • Loop - Actions
                • Set TempInt[0] = (Integer A)
                • Custom script: call RemoveLocation(udg_TempLoc[udg_TempInt[0]])
          • Custom script: call RemoveLocation(udg_TempLoc[1000])
          • Custom script: call DestroyGroup(udg_TempGroup[2])
      • Custom script: call DestroyGroup(udg_TempGroup[0])
      • Custom script: call DestroyGroup(udg_TempGroup[1])
I tested it and it works. When a new unit gets closer to a zombie it will switch targets rather than stay on the closest target. If you dont want the zombies to change targets ( i wouldnt recomend that) you can just set TempGroup[1] to units in map matching owner is player 12 and current order of matching unit not equal to attack. This way they wont switch targets if someone is closer, they will keep the same target that they got when they spawned.

Hope this helped you :)
 
Level 4
Joined
Apr 7, 2009
Messages
108
wow that works, but then you must change return time, cause after # of seconds them auto turn back, BUT WOW! hold shift n double click!? wish i knew that earlier, that would major help in old game! D:
 
Level 11
Joined
May 31, 2008
Messages
698
I left the return time at the default (5 seconds) and they never went back. But maybe that was because their target was close enough that they could reach it within the 5 seconds. But yeah the shift click works pretty much anywhere, you can use it for any value in the object editor (even make stuff negative for maybe a health draining aura) and even in world editor when you place doodads; if you hold shift when you place a doodad you will notice that they can be placed much closer together. Try it out :D
 
Level 4
Joined
Apr 7, 2009
Messages
108
LOL i always thot max gold cost of anything was 100k, then i see wmw units at 150K plus, GAH this is so not fair, i couldve kept like my old games in busness, i stopped old gaes cus i couldnt go further, i needed units costing more than 100k, GRRRRRR ';..;'

TY ALOT!

i would severelly love you to see my new map, really though plz, see what it is like and wats it gona turn out to be, just tell me to attach or to msg
 
Level 11
Joined
May 31, 2008
Messages
698
ok send it to me in a pm i guess. It sounds like it would be really fun and it seems like, from what you described, that it is like nazi zombies. That wud be really cool i think if you could actually make it really good
 
Level 4
Joined
Apr 7, 2009
Messages
108
well sorry it took me so long to relook this tread, lol forgot about it, leme add just a few more levels and it will go to level 20. im hoping sometime to make a exact replica of der riese, wc3 style ^^

you start with a pistol, click swap weapon and you will equip it, then there is a smg on the wall to your left, then open the gate and far down there is assault rifle, then there is 2 more gates, 1 is good to camp in, the other has machine gun, the path is up to you! how long will you live!?

here it comes wolfman
please try to enjoy, i advice not soloing, u can't beat level 1 solo =/ so yea get some1 to host this(or i can ^^) or u can just host it yourself if you can
 

Attachments

  • Fred's Zombie Survival BETA.w3x
    181 KB · Views: 26
Last edited:
Status
Not open for further replies.
Top