Page 5 of 6
Re: General scripting issues and questions
Posted: Thu Oct 04, 2012 11:49 am
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.
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.
Re: General scripting issues and questions
Posted: Thu Oct 04, 2012 12:45 pm
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
Re: General scripting issues and questions
Posted: Thu Oct 04, 2012 4:51 pm
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.
Re: General scripting issues and questions
Posted: Fri Oct 05, 2012 1:47 pm
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?
Re: General scripting issues and questions
Posted: Fri Oct 05, 2012 2:49 pm
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!
Re: General scripting issues and questions
Posted: Fri Oct 05, 2012 2:54 pm
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.
Re: General scripting issues and questions
Posted: Tue Nov 13, 2012 4:27 am
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)
Re: General scripting issues and questions
Posted: Tue Nov 13, 2012 5:32 am
by JKos
Lmaoboat wrote:How does a bit field work?
I have explained it here:
viewtopic.php?f=14&t=3861#p40130
Re: General scripting issues and questions
Posted: Tue Nov 13, 2012 9:25 am
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!
Re: Useful scripts repository
Posted: Sun Nov 25, 2012 7:34 am
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.