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'm up to the part where I want to create one of those demon heads that shoot stuff out. I have gone to the script repository and I can't believe that there isn't one script on how to do this. It seems to be such a common part of the game.

Can someone point me to a tutorial or video explaining how to do this?

** EDIT ** Okay, I found one of Komag's videos. But what if you want the door to open if the blob does not hit the receptor? In other words, the party blocks it. Is that something that has to be scripted?
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: Thu May 20, 2021 2:45 am Okay, I'm up to the part where I want to create one of those demon heads that shoot stuff out. I have gone to the script repository and I can't believe that there isn't one script on how to do this. It seems to be such a common part of the game.

Can someone point me to a tutorial or video explaining how to do this?

** EDIT ** Okay, I found one of Komag's videos. But what if you want the door to open if the blob does not hit the receptor? In other words, the party blocks it. Is that something that has to be scripted?
I think it has to be scripted.
You need a timer that checks if the blob has stopped existing.

Here's a finished implementation:
https://www.nexusmods.com/grimrock/mods/448/

There are no comments, because it doesn't contain much code.
It's probably not exactly what you want, especially if you need multiple blobs and receptors.
But it should illustrate the basic principle.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Zo Kath Ra wrote: Thu May 20, 2021 2:49 pm
wagtunes wrote: Thu May 20, 2021 2:45 am Okay, I'm up to the part where I want to create one of those demon heads that shoot stuff out. I have gone to the script repository and I can't believe that there isn't one script on how to do this. It seems to be such a common part of the game.

Can someone point me to a tutorial or video explaining how to do this?

** EDIT ** Okay, I found one of Komag's videos. But what if you want the door to open if the blob does not hit the receptor? In other words, the party blocks it. Is that something that has to be scripted?
I think it has to be scripted.
You need a timer that checks if the blob has stopped existing.

Here's a finished implementation:
https://www.nexusmods.com/grimrock/mods/448/

There are no comments, because it doesn't contain much code.
It's probably not exactly what you want, especially if you need multiple blobs and receptors.
But it should illustrate the basic principle.
Thanks. I have another problem but I'll post that in another response.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Okay, here is my problem. I have fixed it but I need to know how to keep it from happening again. I am pretty sure I know what's causing the problem. I just don't know why.

After I create a new object, I load it into the game to make sure it's working. To test the new object, since I haven't added its icon into the file of items that display in inventory, I just use one of the other items. For simplicity, I use index 0. In my case, it's a cube.

Okay, after I make sure the object is working as it appears on the floor, I then go back to Blender and render a 2D image to add to the icon file.

After I do this, I almost always get an items.lua error saying there is an invalid call and then something about D3D or DDS. I know enough to understand that this probably means the icon file as I didn't have the problem before updating it.

So I brought the DDS file into Photoshop, not Gimp. Gimp does not display the problem. In Photoshop you can see that the file is fractured in appearance. In other words, the first X number of items are all one after another with no white space in between. The last item has white space before it.

I took the original PNG file and reexported to DDS and that fixed the issue.

The problem is, obviously I am doing something in my steps that is fracturing this file. I just don't know what it is.

I have a lot of theories but right now they would all just be guesswork.

Has anybody run into this problem before? Do you know what's causing it? Do you know how to prevent it from even happening?

As I've fixed the problem, I can't send you the bad file. I should have made a copy of it but I overwrote it. I guess the only thing I can do is wait until I perform the bad step again and then document what steps I took to create the problem and zip up the file and upload it for somebody to take a look at.

In the meantime, the problem is fixed. But this is the 2nd time that it's happened and I'd like to avoid it happening again if I can help it. But it's definitely the icon file that's causing the problem.
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: Thu May 20, 2021 2:45 am Okay, I'm up to the part where I want to create one of those demon heads that shoot stuff out. I have gone to the script repository and I can't believe that there isn't one script on how to do this. It seems to be such a common part of the game.

Can someone point me to a tutorial or video explaining how to do this?

** EDIT ** Okay, I found one of Komag's videos. But what if you want the door to open if the blob does not hit the receptor? In other words, the party blocks it. Is that something that has to be scripted?
You can probably use the "party" object's "onProjectileHit" hook.
http://www.grimrock.net/modding_log1/scripting-hooks/
http://www.grimrock.net/modding_log1/as ... reference/ -> Party -> onProjectileHit

That would be a much simpler solution, if you want only the party to catch the blobs.
(and not monsters, for example)

But I haven't tried it, so I can't tell you for sure that it'll work.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Zo Kath Ra wrote: Fri May 21, 2021 3:29 pm
wagtunes wrote: Thu May 20, 2021 2:45 am Okay, I'm up to the part where I want to create one of those demon heads that shoot stuff out. I have gone to the script repository and I can't believe that there isn't one script on how to do this. It seems to be such a common part of the game.

Can someone point me to a tutorial or video explaining how to do this?

** EDIT ** Okay, I found one of Komag's videos. But what if you want the door to open if the blob does not hit the receptor? In other words, the party blocks it. Is that something that has to be scripted?
You can probably use the "party" object's "onProjectileHit" hook.
http://www.grimrock.net/modding_log1/scripting-hooks/
http://www.grimrock.net/modding_log1/as ... reference/ -> Party -> onProjectileHit

That would be a much simpler solution, if you want only the party to catch the blobs.
(and not monsters, for example)

But I haven't tried it, so I can't tell you for sure that it'll work.
I'll give it a shot. Thanks.
User avatar
Isaac
Posts: 3175
Joined: Fri Mar 02, 2012 10:02 pm

Re: Wagtunes' Modding Questions

Post by Isaac »

Be extra cautious when using hooks. Script errors that happen within a hook can often crash the editor itself. Save your work before previewing, and favor using careful sanity checks on data and objects when (before) accessing them.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Isaac wrote: Fri May 21, 2021 6:35 pm Be extra cautious when using hooks. Script errors that happen within a hook can often crash the editor itself. Save your work before previewing, and favor using careful sanity checks on data and objects when (before) accessing them.
What is a hook?
User avatar
Isaac
Posts: 3175
Joined: Fri Mar 02, 2012 10:02 pm

Re: Wagtunes' Modding Questions

Post by Isaac »

Any of the "on<Action>" events; like the aforementioned onProjectileHit() event.
Image
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Okay, I'm trying to work with some FX. Since I have no idea what they even do, I went to this forum and took some actual examples posted here (I assume they work) and plugged them into a script, trying out each one.

I hooked them up to a button, per instructions. But when I go to run the script and press the button, nothing happens. At least nothing that I can see.

Is there some step that's being left out of these examples that I'm supposed to know?

This is what I've done.

1. Put the FX item on a location on the map.
2. Put the script container on the same spot as the FX.
3. Put the code into the script container.
4. Set up a button on the wall and connected the button to the script.
5. Ran the dungeon and pressed the button.

I did this for a number of FX scripts. None of them do anything. One is supposed to create a light.

In fact, here is the script. Seems pretty simple.

Code: Select all

function spawnLight()
	spawn("fx",1,self.x,self.y,1,"effect")
	effect:setLight(1,0,0,20,7,10,true)
	effect:translate(0,2,0)
end
Doesn't do a thing.

Using those steps above and placing this code into the script in step 3, what am I doing wrong?

Thanks.
Post Reply