Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

Hey guys,
I was trying to make an enemy respawn again, when he dies. Tried it like this:

Code: Select all

function crawlerspawn()
spawn("undead",party.level,13,28,0,0).monster:addConnector("onDie", self.go.id, "onDeathAction")
end

function onDeathAction(self)
self.go:spawn(self.go.name).monster:addConnector("onDie", self.go.id, "onDeathAction")
end
I think i know where the Problem is, but i can´t find a way to fix it. Could it be the self.go.id in the on DeathAction function? I think it uses the id of the undead i spawned in the crawlerspawn function. How can i fix this? Also how can i add a second Connector to the undead spawned in the onDeath function.
Í don´t want the Player to farm infinite exp there. :)
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

It doesn't seem to cause a problem for me. What does it do for you?

Code: Select all

-- Place in a script; place the script where it should initially spawn.
function crawlerspawn()
self.go:spawn("zarchton_ambush").monster:addConnector("onDie", self.go.id, "onDeathAction")
end

crawlerspawn()

function onDeathAction(self)
self.go:spawn(self.go.name).monster:addConnector("onDie", self.go.id, "onDeathAction")
end
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

So it works for you?
When i kill him he´s only respawning once. I want him to respawn infinite times.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
Isaac
Posts: 3188
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Code: Select all

--Place the script where you want the initial spawn to be; subsequent re-spawns will be where the monster dies.
function crawlerSpawn(monster)
	local monster = monster or self
	monster.go:spawn("zarchton_ambush").monster:addConnector("onDie", self.go.id, "crawlerSpawn")
	if not respawnTimer then
		local t = self.go:spawn('timer').timer
		t:addConnector('onAcivate', self.go.id, "crawlerSpawn")
		t:start()
		t:setDisableSelf(true)
	end
end
crawlerSpawn(self)
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

I changed it a little bit, because of the exp Problem i mentioned, but it works great now thank you :D
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

Ok i really don´t know if this is a simple question, but i´ll just give it a try and go ahead.
I´m having Troubles using the grimtk assets. I am pretty sure i imported everything correctly, but i can´t make it work. All i can do now is messing around with this function.

Code: Select all

function message1()
	GTKGui.Basic.showInfoMessage("I am confused.");
end
It is the only Thing out of the sample dungeon that works. When i try another sample of the dungeon,i either get stuck on the pressure plate (Dialogs) or totally nothing happens (other textmessage), so i think the functions work, but something might be wrong with the Output.
I have no clue what i can do now. I hope you guys have any Options for me.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Xardas wrote:Ok i really don´t know if this is a simple question, but i´ll just give it a try and go ahead.
I´m having Troubles using the grimtk assets. I am pretty sure i imported everything correctly, but i can´t make it work. All i can do now is messing around with this function.

Code: Select all

function message1()
	GTKGui.Basic.showInfoMessage("I am confused.");
end
It is the only Thing out of the sample dungeon that works. When i try another sample of the dungeon,i either get stuck on the pressure plate (Dialogs) or totally nothing happens (other textmessage), so i think the functions work, but something might be wrong with the Output.
I have no clue what i can do now. I hope you guys have any Options for me.
A fair few people have had trouble with getting grimtk to play nice initially
So is the grimtk sample dungeon actually not working properly - or is the problem using it once imported into your dungeon?
Do you have any error messages you can post up here?

Often problems have had to do with people placing a 'grimtk' entity into their dungeon.
Have you done so? if so where did you place it?
If you havent already - try placing this entity on the co-ord x0,y0 of your first level

Akroma
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

I already placed it in the very first map at 0,0. The sample dungeon works perfectly, but when i try the samples in my project now, they won't work. I'm calling the same sample files the same way like in grimtks sample dungeon. When calling a dialog sample i get stuck on the pressure plate, unable to move anywhere. I think that isn't the problem, if the dialog window would pop up. The only thing that works are like i said the little info boxes. The strange thing is, that i have no errors and the editor isn't crashing, so i can't say anymore. :?
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

OK, so the sample windows do pop up - but the party then cant move at all (ie stuck on pressure plate) ??
Can the party turn?
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas »

Ok i'm sorry it might be my english which makes it hard to understand (Please tell me if this is the case)
Anyway, what i'm trying to say is that the dialog windows do not pop up. There is absolutely no visual output ingame.
When stepping on the pressure plate the party is unable to move or turn.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
Post Reply