Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --This function isn't moving the hero like it should
- --Also when getting the heroes' location, its returning 0, 0, 0
- --How do I get npc to equal the actual hero being spawned?
- function GameMode:OnNPCSpawned(keys)
- DebugPrint("[BAREBONES] NPC Spawned")
- DebugPrintTable(keys)
- -- This internal handling is used to set up main barebones functions
- GameMode:_OnNPCSpawned(keys)
- local npc = EntIndexToHScript(keys.entindex)
- if npc.IsRealHero and npc:IsRealHero() then
- local ents = Entities:FindAllByName("spawnpoint")
- DebugPrint("[STICKARENA] finding all entities by name spawnpoint")
- DebugPrintTable(ents)
- --get amount of entities because lua is stupid
- local Count = 0
- for Index, Value in pairs( ents ) do
- Count = Count + 1
- print('[STICKARENA] entity count: ', Count)
- end
- if Count > 0 then
- local infotarget = ents[RandomInt(1, Count)]
- print('[STICKARENA] Getting random spawnpoint entity: ', infotarget)
- print('[STICKARENA] The vector position of that entity is: ', infotarget:GetAbsOrigin()) --Returns a valid vector
- print('[STICKARENA] The vector position of the hero is: ', npc:GetAbsOrigin()) --Is 0, 0, 0 for some reason when that's not where the hero is at all
- npc:SetAbsOrigin(infotarget:GetAbsOrigin()) --Doesn't do anything
- else
- print('[STICKARENA] ERROR: no spawnpoint entities')
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement