• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

TrinityCore WotLK Spawning world objects away from any players

therealdudelee

Enthusiast
Hi guys. I've been working on an event system today that will pick a random location and spawn stuff there at intervals, basically.

For example, it might spawn an orcish raid party in a town somewhere. My original thought was to use PerformIngameSpawn to create an 'event trigger' npc, and then use event_trigger_npc:SpawnCreature(blah blah blah) for the actual event-related mobs. Issue is, the mobs aren't spawning. I believe that the issue is due to the fact that it tries to spawn them when no players are around. Is there a way to counter this? As in, spawn creatures in maps not occupied by players at the time of spawning? Keep in mind the creatures still need to despawn after a certain period of time.

Thanks guys.

Here is an example of one of the event scripts:

Code:
trigger = PerformIngameSpawn(1, 501086, MAPID, 0, X, Y, Z, 0, false, 900)

		if(worldEventID == 1)then --orc raid
			sendWorldMessage("An orcish warband been spotted in "..location_name.."!", 2)
			for i=1,5+math.random(4) do
				if(math.random(4) == 1)then
					local npc = trigger:SpawnCreature(501088, X + (math.random(var) - math.random(var)), Y + (math.random(var) - math.random(var)), Z + (math.random(3)-1), (math.random(360) / 200), SPAWN_TYPE, 900000)
					npc:MoveRandom(random_movement)
				else
					local npc = trigger:SpawnCreature(501087, X + (math.random(var) - math.random(var)), Y + (math.random(var) - math.random(var)), Z + (math.random(3)-1), (math.random(360) / 200), SPAWN_TYPE, 900000)
					npc:MoveRandom(random_movement)
				end
			end
			local boss = trigger:SpawnCreature(501089, X, Y, Z, (math.random(360) / 200), SPAWN_TYPE, 900000)
			boss:MoveRandom(random_boss_movement)
		end

Any ideas?

EDIT: I sorted this out. It was an issue with how I was grabbing co-ords from the database, of all things.
 
Last edited:
Top