[Tutorial] Kill Command / NPC Conversation

Hi everyone,

I have currently setup a twofold dialog with a npc (see screenshots below)

Agreeing the first time to go back to the coffin gives the player a token, which allows to launch the second dialog (second screenshot).

My issue is that I would like the player to get killed after he agrees to go back into the coffin (which will make him respawn nearby the coffin).

What I’ve tried so far using the Conversation Editor :

  • Use the CastSkill on Player Action. I’ve tried several skills, but the gravedigger does not cast them

  • Launch a Lua Script with the character:Kill() function but it does nothing as well. I’m also pretty new to scripting so probably my script is not correct…

  • Give the player Experience for agreeing (this worked fine)

I figured a kill command would be pretty handy overall, and it’s also a key part of that interaction.

Any idea how I could get this to work/what I’m doing wrong?

I could get it to work finally.

For those who are interested, here’s a walkthrough about how to set it up :

  • Create a Lua script using the character.kill() function.

gd.kill = {}

– Kill Player

function gd.kill.player()

	local player = Game.GetLocalPlayer()
	player:Kill() 

end

  • Name it kill.lua and save it in scripts/game folder of your mod

  • In the source/game folder, open the grimdawn.lua script and add this line :

// Special Events
Script.Load(“scripts/game/kill.lua”)

  • In the Asset Manager, go to your Source tab and scripts/game folder, and then right click on kill.lua and select “Auto Create Asset”

  • Go into the Conversation Editor, make sure you have selected your current mod, and select the conversation you wish to add the kill event too, and at the dialog line that you want to trigger the kill, click on "Action, then “Add action”. Select “Lua script”. In the List of Lua cripts, there should now be a gd.kill.player() function that you can select. Select it.

And voilà! Next time your character triggers that dialog line in that conversation, it will kill it.

1 Like