Wagtunes' Modding Questions

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Wagtunes' Modding Questions

Post by Isaac »

wagtunes wrote: Sun May 23, 2021 1:52 am

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.
It works; it spawns a red light that fades after ten seconds.

*This function uses the location of the script_entity itself as the spawn point... so to see it, you should position the script_entity within view of the party.

Also... This script has no check for existing names, and thus will crash the game if run twice (within ten seconds in this case), because it explicitly assigns the same name to every fx object that it creates; duplicate object names crash the game.

____________________________

The fx object is used to place particle & light effects.

Code: Select all

function spawnPoof()
	local effect = spawn("fx",1,self.x,self.y,1)

	if effect then
		effect:setParticleSystem('blob')
		effect:setLight(1,1,1,20,7,2,false)
		effect:translate(0,1.5,0)
	end	
	
end
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Isaac wrote: Sun May 23, 2021 4:50 am
wagtunes wrote: Sun May 23, 2021 1:52 am

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.
It works; it spawns a red light that fades after ten seconds.

*This function uses the location of the script_entity itself as the spawn point... so to see it, you should position the script_entity within view of the party.

Also... This script has no check for existing names, and thus will crash the game if run twice (within ten seconds in this case), because it explicitly assigns the same name to every fx object that it creates; duplicate object names crash the game.

____________________________

The fx object is used to place particle & light effects.

Code: Select all

function spawnPoof()
	local effect = spawn("fx",1,self.x,self.y,1)

	if effect then
		effect:setParticleSystem('blob')
		effect:setLight(1,1,1,20,7,2,false)
		effect:translate(0,1.5,0)
	end	
	
end
Okay, here is what I did.

1. I created a pressure plate set to activate once and placed it 14,27

2. I created the script, using the code above, and placed it at 15,27, which is the square right in front of the pressure plate and in front of the party so they are looking right at it.

3. I placed the fx object at 15,27

4. I ran the dungeon. I stepped on the pressure plate and nothing appears in front of me. No light, nothing.

So I have no idea what the problem is
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Here is the code I used.

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)
	hudPrint("Did It")
end
I even put a hudPrint test print in it to make sure the code was being executed. It is.

I then figured maybe it doesn't work in the dungeon editor and you had to export it to a dat file. So I did that and actually ran the dungeon. Still nothing.

I am totally at a loss as to why this isn't working. I have tried this with several fx scripts and none of them work.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Wagtunes' Modding Questions

Post by Isaac »

This scene has the script, one button, and one plate; both are connected to the script.

https://www.dropbox.com/s/dp5yb052gotnq95/fx.zip?dl=1

Image

Code: Select all

function spawnPoof()
	local effect = spawn("fx",1,self.x,self.y,1)

	if effect then
		effect:setParticleSystem('blob')
		effect:setLight(1,1,1,20,7,5,false)
		effect:translate(0,1.5,0)
	end	
end
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Isaac wrote: Sun May 23, 2021 4:24 pm This scene has the script, one button, and one plate; both are connected to the script.

https://www.dropbox.com/s/dp5yb052gotnq95/fx.zip?dl=1

Image

Code: Select all

function spawnPoof()
	local effect = spawn("fx",1,self.x,self.y,1)

	if effect then
		effect:setParticleSystem('blob')
		effect:setLight(1,1,1,20,7,5,false)
		effect:translate(0,1.5,0)
	end	
end
Why a button and a plate? Don't you need just one thing to trigger it?
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Isaac wrote: Sun May 23, 2021 4:24 pm This scene has the script, one button, and one plate; both are connected to the script.

https://www.dropbox.com/s/dp5yb052gotnq95/fx.zip?dl=1

Image

Code: Select all

function spawnPoof()
	local effect = spawn("fx",1,self.x,self.y,1)

	if effect then
		effect:setParticleSystem('blob')
		effect:setLight(1,1,1,20,7,5,false)
		effect:translate(0,1.5,0)
	end	
end
Okay, here's what I did. I copied the script just as you have it. I placed the script, the fx object, a pressure plate and a button all on the same square. I connected the button and the pressure plate to the script. I then put hudPrint("Do It") inside the IF statement to make sure the script was executing.

I then started the dungeon in the editor. I stepped onto the pressure plate. Saw the message "Do It" but no fx showed. I then hit the button and looked to the left like you did in the video and still nothing.

Then I thought of something. You said if you retrigger the script within 10 seconds you'll crash the editor. So I reran it and repeatedly pressed the button with no more than a second in between. "Do It" kept reprinting for each press but no fx appeared and no crash of the editor.

I've come to the conclusion that fx don't work on my OS for whatever reason. It is the only thing that makes any sense. I have looked through the source codes of the dungeons that I've downloaded that come with source code and unfortunately, none of them utilize the fx object so I can't test it to see if it's working in other mods.

Bottom Line: It doesn't work on my PC for whatever reason and I have no idea how to fix it. If you have a dungeon you can send me with the source code to test it here, I can then be certain beyond any doubt.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Okay, I tried connecting the plate to this script.

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
I did not set the plate to activate once. I stepped onto it twice and on the 2nd time the editor did give me an error for a duplicate. But still no fx visible.

Graphics card possibly?

I'm grasping at straws here but the bottom line is that none of the fx scripts I've tried do anything visually.
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: Sun May 23, 2021 6:36 pm Okay, I tried connecting the plate to this script.

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
I did not set the plate to activate once. I stepped onto it twice and on the 2nd time the editor did give me an error for a duplicate. But still no fx visible.

Graphics card possibly?

I'm grasping at straws here but the bottom line is that none of the fx scripts I've tried do anything visually.
a) It works for me. Can you upload the Dungeon Editor source files?
b) What are your graphical settings in LoG1?
c) As far as I know, you don't need to manually place an FX object in the Dungeon Editor, because you're spawning one in your script.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

Zo Kath Ra wrote: Sun May 23, 2021 7:24 pm
wagtunes wrote: Sun May 23, 2021 6:36 pm Okay, I tried connecting the plate to this script.

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
I did not set the plate to activate once. I stepped onto it twice and on the 2nd time the editor did give me an error for a duplicate. But still no fx visible.

Graphics card possibly?

I'm grasping at straws here but the bottom line is that none of the fx scripts I've tried do anything visually.
a) It works for me. Can you upload the Dungeon Editor source files?
b) What are your graphical settings in LoG1?
c) As far as I know, you don't need to manually place an FX object in the Dungeon Editor, because you're spawning one in your script.
If that's the case, what is the fx object for? It doesn't really seem to do anything on its own. There are no slots to enter any code or anything.
wagtunes
Posts: 316
Joined: Sun Feb 04, 2018 11:04 pm

Re: Wagtunes' Modding Questions

Post by wagtunes »

One other thing. Isaac gave me a script to destroy an item in an alcove.

Code: Select all

function destroySpecialPotion(self) 
	local alcove = self
	potionName = "potionunlocking"
	
	if type(alcove) == "table" and string.match(alcove.name,"alcove") then
		for itm in alcove:containedItems() do -------------------------------------------{The alcove's contained items iterator}
			if itm.name == potionName then
				
				--optional effects
					local effect = spawn("fx",itm.level,itm.x,itm.y,itm.facing)
						effect:translate(0,1.3,0)
						effect:setParticleSystem("blob")
						effect:setLight(0, 0, 1, 1000, 2, .5, true)
						playSound("goromorg_shield_hit")
				--/optional effects
						
				itm:destroy()
			end	
		end	
	end	
end
That works. I see the white light and the item disappears. So it's not an fx object problem with it not working. But something about the code he gave me for the red light creation doesn't work.

I'm going to try to do this without placing an fx object on the spot.
Post Reply