Date/Time script help and dungeon testing

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!
Killcannon
Posts: 73
Joined: Sun Apr 12, 2015 2:57 pm

Re: Date/Time script help and dungeon testing

Post by Killcannon »

This has me stumped. Why does this script work

Code: Select all

function zappulsechamberpuzzle()
	local max = 0
		if Electricution_lever_1.lever:isDeactivated() and
			Electricution_lever_2.lever:isDeactivated() then
			max = 2 
		elseif Electricution_lever_1.lever:isActivated() and
			Electricution_lever_2.lever:isDeactivated() then
			max = 1
		elseif Electricution_lever_2.lever:isActivated() and
			Electricution_lever_1.lever:isDeactivated() then
			max = 0
		elseif Electricution_lever_1.lever:isActivated() and
			Electricution_lever_2.lever:isActivated() then
			max = 0
		end

	for x = -max,max do
	for y = -max,max do
		if ( (x ~= 0) or (y ~= 0) ) then
			spawn("lightning_bolt_blast", 1, 19 + x, 15 + y, 0)
			spawn("lightning_bolt_blast", 1, 19, 15, 0)
		else if ( (x == 0) or (y == 0) ) then
			spawn("lightning_bolt_blast", 1, 19, 15, 0)
			end
			end
		end
	end
end
and this one doesn't?

Code: Select all

function frostexplosion()

local fmax = 0
		if frost_dummy_lever.lever:isDeactivated() then
			fmax = 3 
		elseif frost_dummy_lever.lever:isActivated() then
			fmax = 3
		end

	for x = -fmax,fmax do
	for y = -fmax,fmax do
		if ( (x ~= 0) or (y ~= 0) ) then
			spawn("lightning_bolt_blast", 1, 25 + x, 7 + y, 0)
			spawn("lightning_bolt_blast", 1, 25, 7, 0)
		else
			return nil
			end
		end
	end
end
Technically for the second all I should need is

Code: Select all

function frostexplosion()

local fmax = 3

	for x = -fmax,fmax do
	for y = -fmax,fmax do
		if ( (x ~= 0) or (y ~= 0) ) then
			spawn("lightning_bolt_blast", 1, 25 + x, 7 + y, 0)
			spawn("lightning_bolt_blast", 1, 25, 7, 0)
		else
			return nil
			end
		end
	end
end
which doesn't work either.
Killcannon
Posts: 73
Joined: Sun Apr 12, 2015 2:57 pm

Re: Date/Time script help and dungeon testing

Post by Killcannon »

I do also apologize, I don't mean to seem like the person who asks for assistance with every script that doesn't work the first time I code it because it's easier to get help than figure it out myself. I know the questions can seem overwhelming, and everyone is busy with their own projects and lives.
SpoilerShow
Especially during the holidays, alas I do have another question in regards to objects.

Germanny's Dungeon Master Resource for LoG2 by Minqmay has a dm_fire_ray spell in it. I was intending to use this at a couple points but the spell doesn't appear to have a damage component when used; but when I go through the assets for the resource, I can't find the spell definition at all to fix this. Does anyone know where this was located off hand or a good method of finding this? I've already manually opened up every lua file in the folders and am downloading a new version of the pack from nexus to look there in case I moved the bloody file.
Nevermind, I finally found it in the weapons.lua file; no wonder it was so hard to find.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Date/Time script help and dungeon testing

Post by Isaac »

WinGrep and 'Agent Ransack' are tools that can quickly search the entire asset pack for any kind of reference.
Very often I use one or the other of them search through [in] all of the lua script files for object or function names.
Works for the dungeon folder as well; to search one's own projects.

https://wingrep.codeplex.com/
https://www.mythicsoft.com/agentransack
minmay
Posts: 2790
Joined: Mon Sep 23, 2013 2:24 am

Re: Date/Time script help and dungeon testing

Post by minmay »

It's in weapons.lua because it's only ever used by a weapon (the Firestaff). It's not intended to be used anywhere else. If you're trying to use it as anything other than a player-cast spell, you need to change the code in the tracers for dealing with height differences, and you should only manually spawn dm_fire_ray_initial_tracer.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Killcannon
Posts: 73
Joined: Sun Apr 12, 2015 2:57 pm

Re: Date/Time script help and dungeon testing

Post by Killcannon »

Well the actual problem I'm having with the spell as is; was located here:

Code: Select all

class = "TileDamager",
			attackPower = 100,
			damageType = "fire",
			-- no good way to track caster, this is the same anyway
			damageFlags = DamageFlags.Champion1,
			onHitChampion = function(self, champion)
				-- no friendly fire for this spell
				return false
			end,
I say was because I changed this by making a custom clone of the spell that doesn't include this. My next step is to add a 'burning' dot mechanic to it. Alas I couldn't get to the scripting reference as the Grimrock site was completely down for me all day so I'd not had access to the stuff I needed. Thanks for the help on that; still could use some help on the other things though. Especially the alcove and AoE spells not working. Those have been infuriating me now for 6 months. The AoE one is really hindering progress on 3 or 4 boss fights I have setup.
Post Reply