Simple Wave Spawner

Hi, I try to create a simple WaveSpawner script.

My script is:

/*	
	GRIM DAWN	
	For more information, visit us at http://www.grimdawn.com	
*/

-- Wave Spawn Example Mod
-- Variables

local spawnPointId = 0
local coords = nil
local spawnProxy = 0
local entityId = 0

function gd.wavespawn.creatureSpawnPointCoords(objectId)
gd.wavespawn.Init()
	spawnPointId = Entity.Get(objectId)
	coords = spawnPointId:GetCoords()
end

function gd.wavespawn.randomFillArea()
math.randomseed(Time.Now())
local i = random(1,1)
		spawnProxy = Proxy.Create("records/proxies/proxy_wave_random"..tostring(i)..".dbr")
		spawnProxy:SetCoords(coords)
		UI.Notify("tagWaveRandom")
end

The proxy.create proxy is in my records/database/proxies folder, also in a subfolder the dbr for the proxy - It works in a different mod. So I don’t think the proxy is the problem.

I placed 2 objects on my map :
the Summoning_Stone with a conversations, the conversation works. It only has an on click end event and triggers a script function (from my script in my mod folder): Lua Script gd.wavespawn.randomFillArea(!).

The second object is the creaturespawnpoint, it is like the summoning stone placed on the map
and has a on add to world function on it, under scripts: gd.wavespawn.creatureSpawnPointCoords.

If I run the game I get the conversation at the Summoning_Stone but nothing is going to spawn.
I think it may don’t get the coords right.

I include the mod (is very barebones just a test) here:

Any advise?
Thanks :slight_smile:

I’d recommend studying waveevent.lua and the scripts that call it.

Thank’s for the fast response. I found the waveevent.lua script. I guess it take some time to study
it. :wink:

Okay, I checked the wavespawner script that’s included in Grim Dawn. I have to admit, that’s mabye a bit out of my possibilities :wink: I’m not so confident in Lua. But I also figured out, my spawner workes fine if I place them on the map. I’m pretty sure there is a failure with getting the coordinates for the spawnobject wich is placed on the map. The object is placed on the map and has the onAddtoWorld on it: gd.wavespawn.creatureSpawnPointCoords.

Can maybe someone check my script, it’s in my entry post -
Thank you :wink:

I have also a main.lua script to call my script:

/*
	
	GRIM DAWN
	scripts/main.lua
	
	Scripting entrypoint.
	
	For more information visit us at http://www.grimdawn.com
	
*/

-- Libs
Script.Load("scripts/libs/shared.lua")

-- Game
Script.Load("scripts/game/grimdawn.lua")
Script.Load("scripts/game/wavespawn.lua")

I checked it.

  • not sure what gd.wavespawn.init is doing or why
  • proxy create function might need a few more parameters to work. But i might be thinking of character.create. Regadless double check that with existing lua code.

My suggestions for trouble shootong.

  • Get grim internals as it will enable the in game console log and you will see error messages and can print debug messages.
  • test the spawn function by using the coords from the player
  • does your map have level ranges se though that should only affect loot irc

That’s alot of really good input, thank you buddy.
Btw. gd.wavespawn was just a snipped from a function I used to test if the script triggers, should not be in there anymore. :grinning: