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

[Trigger] Neutral Hostile Lagging

Status
Not open for further replies.
Level 1
Joined
Jul 9, 2010
Messages
2
So, I'll get to the point of this post immediately.

I've been working on a map, where one must defend themselves from zombies while doing objectives along the way.

It's working pretty well, have it probably around 70% finished, but there's 1 big problem.

Zombies.
My zombies that I have spawn every so often, tend to get 'snagged' along the way. They move towards a player, stop moving, then continue. It happens repeatedly and often. What I've got right now is okay, I made a trigger like this:

  • Unit - Create 1 Zombie for Neutral Hostile at (Random point in ZombieSpawn1 <gen>) facing Default building facing degrees
  • Set SpawnedZombie1 = (Last created unit)
  • Unit - Order SpawnedZombie1 to Right-Click (Random unit from (Units in Attack <gen> owned by Player 1 (Red)))
It works, the zombie actually attacks, however; it targets random buildings (barricades, turrets) instead of the hero itself. Not only that, in multiplayer it simply walks past other player's buildings and heroes while being attacked. I'm not sure if this is where to request help, but I would appreciate any.

This has probably already been solved before, a similiar problem but I looked through a couple pages and found nothing, so I came here.

An f.y.i, I did try making the zombies attack range 10000000.1 in gameplay constants, and they attack great if I disable the right click trigger. But this is where the 'snag' problem comes in.

Any help is GREATLY appreciated. Thank you. :vw_love:
 
Level 4
Joined
May 25, 2009
Messages
100
I think your problem is:
  • Unit - Order SpawnedZombie1 to Right-Click (Random unit from (Units in Attack <gen> owned by Player 1 (Red)))
What you're doing here is: You give the zombie the order to attack a random unit in the rect, whichs means that the system is looking for a random unit in the rect, for example a building or a turret (Buildings etc. are counting as units). And then it orders the zombie to attack it and ignore everthing else.
What you could try is:
  • Unit - Order SpawnedZombie1 to Attack-Move To (Position of Hero)
(Point order)
or
  • Unit - Order SpawnedZombie1 to Attack Hero
With the 1 way you order the zombie to move to the hero and attack everthing on its way. With the 2. way you order the zombie just to attack the hero and ignore everything else.
And you should put the Gameplayconstant "Creeps - Guard Return Distance" as high as possible (I think it was this one. If not, i'm sure somebody else will post it :D)
 
Level 1
Joined
Jul 9, 2010
Messages
2
Thanks Cataract, I'll try that an get back to you :D

On a side note, Daffa the Mage
I have no idea what that means, try being more specific?

Edit: Cataract, I kind of added the triggers together and made the zombies attack-move to the position of the hero, the problem with it is I have to have a repeating trigger to make them continue to do this, and I don't want it to cause lag issues, or rather... The 'snag' issue I've been having.
 
Level 4
Joined
May 25, 2009
Messages
100
Did you edit the gameplay constant? Because it think your problem is that every Unit owned by Neutral Hostile wants to go back to its "camp" (where it was created). You can change it by editing the gameplay constant or just spawn the zombies for player 12 (or another hostile player) instead of Neutral Hostile.
If you have to much zombies and they block eachother they start to "snag"...there is no direct fix for that, sadly. It's a pathfinding issue in the wc3 engine (It's not made for too many units). What you can do is decrease the "Pathing - Collision Size" of the zombie in the Object Editor. That allows the zombies to "walk" a bit into other zombies and don't get blocked by them.
What Daffa the Mage meant, was that when you create a unit somewhere or order a unit to go somewhere the editor automaticly creates a new "location"variable. This is a variable which is created just for wc3 (not like integer, real, boolean etc.) And everytime a new locationvariable gets created the variable gets saved in the memory of your pc. And if you play for 2h and if the game creates a new locationvariable every second, wc3 will become laggy. To prevent that, you have to destroy the locationvariable after it got used. Doing so is a bit complicated:
1. Save the location in a variable
2. Do your action
3. Destroy the location and "null" the variable

  • Set loc_spawningpoint = (Random point in (Playable map area))
  • Set loc_attackpoint = (Position of Hero)
  • Unit - Create 1 Zombie for Player 12 (Brown) at loc_spawningpoint facing Default building facing degrees
  • Set zombieunit = (Last created unit)
  • Unit - Order zombieunit to Attack-Move To loc_attackpoint
  • Custom script: call DestroyLocation(udg_loc_spawningpoint)
  • Custom script: call DestroyLocation(udg_loc_attackpoint)
  • Custom script: set udg_loc_spawningpoint = null
  • Custom script: set udg_loc_attackpoint = null
If you want to know more about it: HERE

But to be honest: It is quite advanced and not always nesessary, specially not in those basic triggers. How often do you want to create a new zombie?
 
Status
Not open for further replies.
Top