Wagtunes' Modding Questions

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Okay, I want to create a tome that, when used, kills the champion.

What do I replace this code with?

Code: Select all

	gameEffect = "Gain 5 skillpoints",
		onUseItem = function(self, champion)
			playSound("level_up")
			hudPrint(champion:getName().." gained 5 skillpoints.")
			champion:addSkillPoints(5)
			return true
** EDIT ** I figured out everything but how to actually kill the champion. I can't find a code in the index that does this. I know it's possible because ORR2 does it in one particular room. I tried champion:kill() and champion:destroy() but both blow up the editor.

** EDIT** Okay, I don't know if this is the most efficient way but I found a champion:damage() command and so I just used that and set damage to some ridiculously high number that would definitely kill the champion. If there is a better way, I'd love to hear it.
Last edited by wagtunes on Tue May 25, 2021 2:44 pm, edited 1 time in total.
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Wagtunes' Modding Questions

Post by Zo Kath Ra »

wagtunes wrote: Tue May 25, 2021 2:17 pm Okay, I want to create a tome that, when used, kills the champion.

What do I replace this code with?

Code: Select all

	gameEffect = "Gain 5 skillpoints",
		onUseItem = function(self, champion)
			playSound("level_up")
			hudPrint(champion:getName().." gained 5 skillpoints.")
			champion:addSkillPoints(5)
			return true
** EDIT ** I figured out everything but how to actually kill the champion. I can't find a code in the index that does this. I know it's possible because ORR2 does it in one particular room. I tried champion:kill() and champion:destroy() but both blow up the editor.
Why are you trying random things, instead of looking at the documentation?
http://www.grimrock.net/modding_log1/sc ... reference/ -> Champion

There is, as far as I know, no function for killing a champion.
But maybe you can use two other functions to achieve the same effect?

<textbook_mode>
SpoilerShow
First, try to find a function that reduces the champion's health.
What values do you pass to this function?
If you pass a very large value, like 1 000 000, does that cause any problems?
Is there a function that determines the champion's current health?
Does reducing the champion's health by his current health always kill him?
If there are situations where it does not: Why?
</textbook_mode>
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: Wagtunes' Modding Questions

Post by maneus »

It should be working with:

Code: Select all

champion:setHealth(0)
or

Code: Select all

champion:damage(100000, physical)
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Zo Kath Ra wrote: Tue May 25, 2021 2:41 pm
wagtunes wrote: Tue May 25, 2021 2:17 pm Okay, I want to create a tome that, when used, kills the champion.

What do I replace this code with?

Code: Select all

	gameEffect = "Gain 5 skillpoints",
		onUseItem = function(self, champion)
			playSound("level_up")
			hudPrint(champion:getName().." gained 5 skillpoints.")
			champion:addSkillPoints(5)
			return true
** EDIT ** I figured out everything but how to actually kill the champion. I can't find a code in the index that does this. I know it's possible because ORR2 does it in one particular room. I tried champion:kill() and champion:destroy() but both blow up the editor.
Why are you trying random things, instead of looking at the documentation?
http://www.grimrock.net/modding_log1/sc ... reference/ -> Champion

There is, as far as I know, no function for killing a champion.
But maybe you can use two other functions to achieve the same effect?

<textbook_mode>
SpoilerShow
First, try to find a function that reduces the champion's health.
What values do you pass to this function?
If you pass a very large value, like 1 000 000, does that cause any problems?
Is there a function that determines the champion's current health?
Does reducing the champion's health by his current health always kill him?
If there are situations where it does not: Why?
</textbook_mode>
Because that's how I learn best. I've read through the documentation. Most of it is Greek to me. If I was able to learn things from reading the documentation, I wouldn't need to come here to ask questions.

If this is becoming a problem, just let me know and I will stop.
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Wagtunes' Modding Questions

Post by Zo Kath Ra »

maneus wrote: Wed May 26, 2021 3:12 pm It should be working with:

Code: Select all

champion:setHealth(0)
or

Code: Select all

champion:damage(100000, physical)
In ORRR2, Isaac used

Code: Select all

deadPC:damage(deadPC:getStatMax('health'), 'physical')
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

maneus wrote: Wed May 26, 2021 3:12 pm It should be working with:

Code: Select all

champion:setHealth(0)
or

Code: Select all

champion:damage(100000, physical)
Thanks. I'll make the changes. This is certainly more efficient.
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Wagtunes' Modding Questions

Post by Zo Kath Ra »

wagtunes wrote: Wed May 26, 2021 7:26 pm Because that's how I learn best. I've read through the documentation. Most of it is Greek to me. If I was able to learn things from reading the documentation, I wouldn't need to come here to ask questions.

If this is becoming a problem, just let me know and I will stop.
It's not a problem, it's just that you wrote "My C++ book was over 1,000 pages".
So I assumed that you were the kind of person who reads the documentation from front to back.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Let me clarify something. I'm in the process of actually creating a dungeon. As I am going through the creation, there are things I want to happen. Some things I know how to make happen. Other things I have to look up. The things that I looked up that I couldn't figure out, those are the things I come here and ask.

To me, actually creating a dungeon is the best way to learn how to do scripting, especially given that I was a computer programmer for most of my life in the working world until I retired from corporate America and started my own business.

Hope this clarifies any confusion.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Zo Kath Ra wrote: Wed May 26, 2021 7:32 pm
wagtunes wrote: Wed May 26, 2021 7:26 pm Because that's how I learn best. I've read through the documentation. Most of it is Greek to me. If I was able to learn things from reading the documentation, I wouldn't need to come here to ask questions.

If this is becoming a problem, just let me know and I will stop.
It's not a problem, it's just that you wrote "My C++ book was over 1,000 pages".
So I assumed that you were the kind of person who reads the documentation from front to back.
I did. And I usually do. But I find the documentation on scripting and the actual syntax itself lacking. Things are not explained well. Certainly not like in a textbook. Too much is left to chance and trial and error. So I decided to skip all that and simply ask when I can't get the answer through the documentation immediately.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

maneus wrote: Wed May 26, 2021 3:12 pm It should be working with:

Code: Select all

champion:setHealth(0)
or

Code: Select all

champion:damage(100000, physical)
Champion set health blew up the editor
Post Reply