Advertisement
epitaque_

Untitled

Sep 2nd, 2015
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. -- Problem:
  2. -- The creeps definitely don't follow the waypoints. It seems they move towards the end path_corner entity while making a
  3. -- couple random small turns on the way. A couple times the creep randomly turned right before it is about to get sent to the last - path_corner to some weird direction (its always the same direction) where I don't have any path_corner entities.
  4. -- I've checked the actual waypoints (in the GameMode.InitialWaypoint variable) in the map many times and there are no errors.
  5. -- It is a series of path_corner entities, each one having its "Next stop target" property pointing to the next until the
  6. -- last path corner, which is within a trigger so the creeps won't even reach it.
  7.  
  8. -- What I need to figure out:
  9. -- Why are the creeps are not following the waypoints?
  10.  
  11. -- Initialization code
  12. GameMode.CreepSpawnPoints = {}
  13. GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS] = {}
  14. GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS] = {}
  15.  
  16. GameMode.InitialWaypoint = {}
  17. GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS] = {}
  18. GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS] = {}
  19.  
  20. GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS][1] = Entities:FindAllByName("hlw_good_bot_spawn")[1]
  21. GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS][2] = Entities:FindAllByName("hlw_good_top_spawn")[1]
  22. GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS][1] = Entities:FindAllByName("hlw_good_bot_wp_1")[1]
  23. GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS][2] = Entities:FindAllByName("hlw_good_top_wp_1")[1]
  24.  
  25. GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS][1] = Entities:FindAllByName("hlw_bad_bot_spawn")[1]
  26. GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS][2] = Entities:FindAllByName("hlw_bad_top_spawn")[1]
  27. GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS][1] = Entities:FindAllByName("hlw_bad_bot_wp_1")[1]
  28. GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS][2] = Entities:FindAllByName("hlw_bad_top_wp_1")[1]
  29.  
  30. -- Spawn code
  31. function GameMode:HOnPlayerSpawnedCreep(keys)
  32. local playerID = keys.PlayerID
  33. local creepNumber = keys.CreepID + (10 * (GameMode.PlayerLevels[playerID] - 1))
  34. local gold = PlayerResource:GetGold(playerID)
  35. local team = PlayerResource:GetTeam(playerID)
  36. local caster = PlayerResource:GetSelectedHeroEntity(playerID)
  37.  
  38. local random = RandomInt(1, 2)
  39. local spawnLoc = GameMode.CreepSpawnPoints[GameMode:HGetOtherTeam(caster)][random]
  40. local waypointEnt = GameMode.InitialWaypoint[GameMode:HGetOtherTeam(caster)][random]
  41.  
  42. local unit = CreateUnitByName("npc_dota_unit_hlw_level" .. creepNumber, spawnLoc, true, caster, caster, team)
  43. FindClearSpaceForUnit(unit, spawnLoc, true)
  44.  
  45. unit:SetInitialGoalEntity(waypointEnt)
  46. unit:MoveToPositionAggressive(waypointEnt:GetOrigin()) -- Tried it with and without this line
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement