Ask a simple question, get a simple answer

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!
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

You can change the ambient track by using GameMode.playStream("myTrack")

But there will always be a harsh cut between the two sounds. AFAIK there is no way to avoid that.

And I would like to recommend not to use real music. The player might stay for half an hour or much longer in one level and if you hear the same song again and again it can annoy very soon. There is a reason why AH used soundscapes in LoG.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
superraton
Posts: 1
Joined: Sun Feb 24, 2019 3:06 pm

Re: Ask a simple question, get a simple answer

Post by superraton »

I'm making a custom dungeon and I have a problem. When I put a ceiling light somewhere (a mine_ceiling_pit_light for example) the light works only at 3 block distance from the party. I mean: if I get closer (2 block distance) the light suddenly turns off. Same issue on exported file. Two weeks trying to find a solution on the forum and nothing. What I'm missing?

Thanks you very much in advance.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

The Mine_ceiling_pit_light works as intended on my computer in the full 0 - 7 square range. So check your graphics settings if you have put everything on High.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Spot lights are broken that way in Wine and maybe on some graphics cards on Windows as well. There's not really anything you can do about it.
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.
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

Safe Fireburst Spell

a) When you cast a Fireburst spell in front of a wall, it spawns on the same tile as the party.
b) When you cast it on front of a barrel_crate_block, it spawns on the crate's tile.

I'd like to make a safe version of this spell.
In cases like (a), where Fireburst would spawn on the party's tile, the spell just fizzles.
In cases like (b), it works normally.

How does Fireburst determine which case to use?
Otherwise, I'll just have to try all possible cases and hope I don't miss any.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Zo Kath Ra wrote: Wed Feb 27, 2019 12:41 am Safe Fireburst Spell

a) When you cast a Fireburst spell in front of a wall, it spawns on the same tile as the party.
b) When you cast it on front of a barrel_crate_block, it spawns on the crate's tile.

I'd like to make a safe version of this spell.
In cases like (a), where Fireburst would spawn on the party's tile, the spell just fizzles.
In cases like (b), it works normally.

How does Fireburst determine which case to use?
Otherwise, I'll just have to try all possible cases and hope I don't miss any.
My guess is that fireburst is simply a projectile and simply behaves like a fireball or Fire Bomb. So my guess is projectile collider.

You can always make a custom "safe" Fireburst spell that always spawns a "fireburst" spell in the square in front of the party. This way it won't "sizzle" but the fireburst will be safe to use at all times I suppose :)

I'd be very interested in this "safe Fireburst" if you find out how to make it :)
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Code: Select all

defineSpell{ 
	name = "fireburst",
	uiName = "Fireburst",
	gesture = 1,
	manaCost = 25,
	skill = "fire_magic",
	requirements = { "fire_magic", 1 },
	icon = 60,
	spellIcon = 1,
	description = "Conjures a blast of fire that deals fire damage to all foes directly in front of you.",
	onCast = function(champion) 
			local dX, dY = getForward(party.facing)
			local X,Y = dX+party.x, dY+party.y 
			local obCheck = party.map:checkObstacle(party, party.facing)
			if obCheck == "door" or obCheck == "wall" then
				champion:showAttackResult("Fizzle", "SpellFizzle")
				playSound("spell_fizzle")
				return false
			end
			spawn("fireburst",party.level,X,Y,party.facing,party.elevation).tiledamager:setCastByChampion(champion:getOrdinal())
			return true
		end
}
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Zo Kath Ra wrote: Wed Feb 27, 2019 12:41 am Safe Fireburst Spell

a) When you cast a Fireburst spell in front of a wall, it spawns on the same tile as the party.
b) When you cast it on front of a barrel_crate_block, it spawns on the crate's tile.

I'd like to make a safe version of this spell.
In cases like (a), where Fireburst would spawn on the party's tile, the spell just fizzles.
In cases like (b), it works normally.

How does Fireburst determine which case to use?
Otherwise, I'll just have to try all possible cases and hope I don't miss any.
I've reproduced the behaviour of the builtin Fireburst spell here. It should be easy to adapt this to fizzle if it targets the party's square.
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: Ask a simple question, get a simple answer

Post by Killcannon »

Someone earlier was asking how to spawn spells in an area of effect. Here's the code to do so.

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("frostbolt_blast", 5, 25 + x, 7 + y, 0)
         spawn("frostbolt_blast", 5, 25 + x - 1, 7 + y - 1, 0) 
         spawn("frostbolt_blast", 5, 25 + x - 2, 7 + y - 2, 0) 
         spawn("frostbolt_blast", 5, 25, 7, 0)
         end
      end
   end
end
The above code will define a 3 x 3 square. You can modify the shape by changing the +- of the x and y values to be any rectangular shape. You can make it larger or smaller by changing the fmax value.

I do have a question with this. Is there a way to have a spell find the location of a monster or the party and spawn at that location? Would it be possible to also add a delay to this? If so how could it be done?
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

The party is always the party, and can be referenced as such in a spell or hook. The monster id needs to be found by a hook either in the monster component, or a projectile component.
Post Reply