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
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

I want to use a scriptable wizard, but I wonder about 3 monster's actions which seems to be identical except the animation: "escape", "crystal" and "letter". I don't remenber how they are used in the main game (if they are...). Does anyone knows how wizard's brain select one of them (hardcoded or by additional script) and if animation is the only difference, what each one do?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Ask a simple question, get a simple answer

Post by Dr.Disaster »

Duncan1246 wrote:I want to use a scriptable wizard, but I wonder about 3 monster's actions which seems to be identical except the animation: "escape", "crystal" and "letter". I don't remenber how they are used in the main game (if they are...). Does anyone knows how wizard's brain select one of them (hardcoded or by additional script) and if animation is the only difference, what each one do?
These animations are used in the main campaign at several places for storytelling purposes when the party can / will run into the wizard. None of them is combat related so they can only be accessed by scripting. For example the letter deposite scene when the party enters Sleet Island the first time is executed by calling wizard_lake.brain:performAction("letter")
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

Dr.Disaster wrote:
Duncan1246 wrote:I want to use a scriptable wizard, but I wonder about 3 monster's actions which seems to be identical except the animation: "escape", "crystal" and "letter". I don't remenber how they are used in the main game (if they are...). Does anyone knows how wizard's brain select one of them (hardcoded or by additional script) and if animation is the only difference, what each one do?
These animations are used in the main campaign at several places for storytelling purposes when the party can / will run into the wizard. None of them is combat related so they can only be accessed by scripting. For example the letter deposite scene when the party enters Sleet Island the first time is executed by calling wizard_lake.brain:performAction("letter")
Thanks! I remenber now the scene with the healing crystal where he disappears also. Therefore it has a very little interest in a new scenario.
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

Does somebody knows if it is possible to produce an horizontal light ray, like laser light, between two points? I needs a permanent light , not like a bolt. The only solution I have for the moment is a spawner associated with a timer with short interval and a blob, but I think it's an ugly solution
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

The best approach to make something that looks like a laser would be to use a model and a texture. Look at the force field and pushable block floors in the standard assets for examples.
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
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Re: Ask a simple question, get a simple answer

Post by Duncan1246 »

minmay wrote:The best approach to make something that looks like a laser would be to use a model and a texture. Look at the force field and pushable block floors in the standard assets for examples.
Yes, but how to realize the ray, in adding a tile model on each tile of the ray path?
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
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 »

Duncan1246 wrote:
minmay wrote:The best approach to make something that looks like a laser would be to use a model and a texture. Look at the force field and pushable block floors in the standard assets for examples.
Yes, but how to realize the ray, in adding a tile model on each tile of the ray path?
I would model a ray that was several tiles long, and add it as a model component to the party when fired. With an offset & rotation that originates from whichever slot the champion occupies. The player probably won't often see it behind the target (when it clips), and in twisting hallways. You could also add a tiny bit of random rotation to the beam model for every attack, and that could also help if the weapon has the rapid multi-shot firearm special attack. The randomness might also be increased the farther away the target is... simulating [totally faking] the PC's poor firearm accuracy at range.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Duncan1246 wrote:
minmay wrote:The best approach to make something that looks like a laser would be to use a model and a texture. Look at the force field and pushable block floors in the standard assets for examples.
Yes, but how to realize the ray, in adding a tile model on each tile of the ray path?
Well, there are basically three options.
1. put the entire ray in one model, and if you want to change the size or add a curve or whatever you have to make a new model. This option is crap in 99.99% of cases.
2. build the ray out of segments of constant length using setWorldPosition(), allowing you to adjust the size and add curves with setWorldRotation() or setWorldRotationAngles(), but only at certain resolutions (you could make several segment models of different length). Since too many segments would result in performance issues, if you want a beam that, say, smoothly increases in size, this method doesn't work well.
3. have just one model as in 1, but use setWorldRotation() to modify the transformation matrix to get arbitrary rotation and size, and MaterialEx:setTexcoordScaleOffset() to adjust the texture alignment each frame to compensate. (You could use an animation to transform the beam as well but since you are scaling the texture anyway you might as well just compute the transformation matrix for each frame yourself.) Very easy to make variable-length or variable-width beams, and you can still use segments to make curves. However, every segment of unique length/width would require a unique material so that you can scale the texture for each one correctly. The world transformation matrix applies to stuff like particle emitter shapes too, so you don't have to worry about adjusting those. Also, this method involves actual math, which a lot of modders are scared of.

Option 2 is probably what you wanted.
Isaac wrote:I would model a ray that was several tiles long, and add it as a model component to the party when fired. With an offset & rotation that originates from whichever slot the champion occupies.[totally faking] the PC's poor firearm accuracy at range.
so what do you suggest Duncan1246 does when the party uses free look? this sounds like a really awful approach compared to just making a new object
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
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

minmay wrote:
Isaac wrote:I would model a ray that was several tiles long, and add it as a model component to the party when fired. With an offset & rotation that originates from whichever slot the champion occupies.[totally faking] the PC's poor firearm accuracy at range.
so what do you suggest Duncan1246 does when the party uses free look? this sounds like a really awful approach compared to just making a new object
Is it possible to use free-Look while attacking?
(Obviously the idea was an on & off blink; possibly with a projectile pulse for effect ~which itself would have been issue with free look come to think of it.)

*Have I mistaken the subject; a laser. If the intent is not a laser blast, but is instead a slow moving beam spell ~that's different. In that particular case, option #3 makes for a versatile choice.

**Something like the warlock's spell in Myth2 could be really neat if the modder scripted the projectile to follow the heightmap. 8-)
https://youtu.be/Vnv_XE3m2X0?t=8m20s
(Watch the spellcaster in Black, on the left.)
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Isaac wrote:
minmay wrote:
Isaac wrote:I would model a ray that was several tiles long, and add it as a model component to the party when fired. With an offset & rotation that originates from whichever slot the champion occupies.[totally faking] the PC's poor firearm accuracy at range.
so what do you suggest Duncan1246 does when the party uses free look? this sounds like a really awful approach compared to just making a new object
Is it possible to use free-Look while attacking?
I assume Duncan1246 wanted to display the beam for more than a single frame. Even if they were okay with that, it'd still break if the party is turning.
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.
Post Reply