Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Problem:
- -- The creeps definitely don't follow the waypoints. It seems they move towards the end path_corner entity while making a
- -- 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.
- -- I've checked the actual waypoints (in the GameMode.InitialWaypoint variable) in the map many times and there are no errors.
- -- It is a series of path_corner entities, each one having its "Next stop target" property pointing to the next until the
- -- last path corner, which is within a trigger so the creeps won't even reach it.
- -- What I need to figure out:
- -- Why are the creeps are not following the waypoints?
- -- Initialization code
- GameMode.CreepSpawnPoints = {}
- GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS] = {}
- GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS] = {}
- GameMode.InitialWaypoint = {}
- GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS] = {}
- GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS] = {}
- GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS][1] = Entities:FindAllByName("hlw_good_bot_spawn")[1]
- GameMode.CreepSpawnPoints[DOTA_TEAM_GOODGUYS][2] = Entities:FindAllByName("hlw_good_top_spawn")[1]
- GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS][1] = Entities:FindAllByName("hlw_good_bot_wp_1")[1]
- GameMode.InitialWaypoint[DOTA_TEAM_GOODGUYS][2] = Entities:FindAllByName("hlw_good_top_wp_1")[1]
- GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS][1] = Entities:FindAllByName("hlw_bad_bot_spawn")[1]
- GameMode.CreepSpawnPoints[DOTA_TEAM_BADGUYS][2] = Entities:FindAllByName("hlw_bad_top_spawn")[1]
- GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS][1] = Entities:FindAllByName("hlw_bad_bot_wp_1")[1]
- GameMode.InitialWaypoint[DOTA_TEAM_BADGUYS][2] = Entities:FindAllByName("hlw_bad_top_wp_1")[1]
- -- Spawn code
- function GameMode:HOnPlayerSpawnedCreep(keys)
- local playerID = keys.PlayerID
- local creepNumber = keys.CreepID + (10 * (GameMode.PlayerLevels[playerID] - 1))
- local gold = PlayerResource:GetGold(playerID)
- local team = PlayerResource:GetTeam(playerID)
- local caster = PlayerResource:GetSelectedHeroEntity(playerID)
- local random = RandomInt(1, 2)
- local spawnLoc = GameMode.CreepSpawnPoints[GameMode:HGetOtherTeam(caster)][random]
- local waypointEnt = GameMode.InitialWaypoint[GameMode:HGetOtherTeam(caster)][random]
- local unit = CreateUnitByName("npc_dota_unit_hlw_level" .. creepNumber, spawnLoc, true, caster, caster, team)
- FindClearSpaceForUnit(unit, spawnLoc, true)
- unit:SetInitialGoalEntity(waypointEnt)
- unit:MoveToPositionAggressive(waypointEnt:GetOrigin()) -- Tried it with and without this line
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement