General scripting issues and questions

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

Re: General scripting issues and questions

Post by Isaac »

petri wrote:Are you sure the function gets triggered?
I've figured it out ~somewhat. The function I made had the Alcove trigger a script that spawned the dagger in the Alcove. Image
This caused a 'Stack Overflow'. It all works fine if I use a pressure plate instead of the alcove to call the script.

Edit: Or maybe not quite. I'll look at this some more; something is odd or being missed. I tried spawning a dagger [on a new map, in an alcove] via a script called by the alcove, and it worked; but this same code snippet causes a stack overflow in the other map.
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: General scripting issues and questions

Post by Komag »

could be something to do with already having spawned a dagger somewhere else, or using a dagger somewhere else, or something like that
Finished Dungeons - complete mods to play
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: General scripting issues and questions

Post by Lmaoboat »

Is there any way to make a looping/really long sound like torch_burning stop on command? There only seems to be a thing for playing sounds and not stopping them.
Whalefish
Posts: 15
Joined: Fri Mar 30, 2012 5:51 pm

Re: General scripting issues and questions

Post by Whalefish »

Is there a way to find out if the Light spell has been cast and is active?

And does the darkness spell negate the light spell? Or just overwrite it so that the light spell stays active on the background?


As in Grimrock when you obtain the Weapon of Power, you need to have all lights out to get it. I figured how to check for torches in hands, but how to check for the light spell?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: General scripting issues and questions

Post by Komag »

Whalefish wrote:Is there a way to find out if the Light spell has been cast and is active?

As in Grimrock when you obtain the Weapon of Power, you need to have all lights out to get it. I figured how to check for torches in hands, but how to check for the light spell?
That's a good question, I'd like to be able to recreate that effect as well!
Finished Dungeons - complete mods to play
Lmaoboat
Posts: 359
Joined: Wed Apr 11, 2012 8:55 pm

Re: General scripting issues and questions

Post by Lmaoboat »

How does a bit field work?

Code: Select all

damageTile(level, x, y, direction, flags, damageType, power)
Damages all creatures including the party in a given tile. direction specifies the direction of the attack for projectiles or melee attacks (0=north, 1=east, 2=south, 3=west). damageType must be one of the following: “physical”, “fire”, “poison”, “cold”, “poison”. Damage is rolled individually for all creatures using the power as base value. flags is a numeric bit field:

    bit 0: monsters recoil from the impact
    bit 1: ongoing damage such as poison cloud
    bit 2: damage originated from champion with ordinal index 1
    bit 3: damage originated from champion with ordinal index 2
    bit 4: damage originated from champion with ordinal index 3
    bit 5: damage originated from champion with ordinal index 4
    bit 6: ignore immunities
    bit 7: halve damage of back row party members

Bits 2-5 are used when dealing experience point awards. See also Champion:getOrdinal().
I'm not really sure how what I'm supposed to put for flags for any given situation.
Zyx
Posts: 20
Joined: Wed Oct 31, 2012 1:57 pm

Re: General scripting issues and questions

Post by Zyx »

Isaac wrote:I've got another, if any knows: Does the Grimrock editor support labels and... goto
Apparently not.
You can use a dummy function and return to reproduce a break or a continue statement inside a loop.

Code: Select all

for i in entitiesAt(level, x, y) do
	dummy(i)
end

function dummy (i)
	if i.setAIState then -- monster
		-- do something
		return 
	end
	if i.setScrollText then -- scroll
		-- do something
		return 
	end
end
(I didn't test this example)
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: General scripting issues and questions

Post by JKos »

Lmaoboat wrote:How does a bit field work?
I have explained it here:
viewtopic.php?f=14&t=3861#p40130
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Syrakh
Posts: 1
Joined: Tue Nov 13, 2012 7:09 am

Re: General scripting issues and questions

Post by Syrakh »

Greetings!

This is my first post and i hope i am in the right place ...

I'm a total script newbie and my whole script-part of my own Dungeon is just copy+pasted - so I would like to know if anybody could help me with a script for a leverpuzzle ... The player/party has to pull the levers in the right order. Please, help! For once a already made script would help me a lot, but if anyone has the patience to explain it ... would be great. :)

And I'm very sorry if i have missed the post/article in which it is explained. :-/

Thanks in advance for reading!
User avatar
ExpDevourer
Posts: 60
Joined: Mon Nov 19, 2012 9:31 am
Location: Performing mad experiments in my laboratory, usually during thunder storms.

Re: Useful scripts repository

Post by ExpDevourer »

Where and what do you use to edit the scripts? Do you go to the games files, under the lets say *textures* and open the file using Notepad or something? Or is there more to it then that, the explanations here seem fairly simple, but how do you open up the script itself to be modified. Sorry I am very new to scripting, I took maybe a week of schooling for it one time years ago, but I couldn't tell you how I went about it at the time.
I'm here to kick goblins and chew herbs, and I'm all out of herbs.
Post Reply