Page 17 of 19
Re: Wagtunes' Modding Questions
Posted: Tue May 25, 2021 2:17 pm
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.
Re: Wagtunes' Modding Questions
Posted: Tue May 25, 2021 2:41 pm
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>
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>
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 3:12 pm
by maneus
It should be working with:
or
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:26 pm
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>
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.
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:27 pm
by Zo Kath Ra
maneus wrote: ↑Wed May 26, 2021 3:12 pm
It should be working with:
or
In ORRR2, Isaac used
Code: Select all
deadPC:damage(deadPC:getStatMax('health'), 'physical')
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:28 pm
by wagtunes
maneus wrote: ↑Wed May 26, 2021 3:12 pm
It should be working with:
or
Thanks. I'll make the changes. This is certainly more efficient.
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:32 pm
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.
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:35 pm
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.
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:38 pm
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.
Re: Wagtunes' Modding Questions
Posted: Wed May 26, 2021 7:43 pm
by wagtunes
maneus wrote: ↑Wed May 26, 2021 3:12 pm
It should be working with:
or
Champion set health blew up the editor