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!
rlewarne04
Posts: 13
Joined: Wed Feb 04, 2015 9:05 pm

Re: Ask a simple question, get a simple answer

Post by rlewarne04 »

It's ok that worked as intended after tweaking it at little to suit my needs.

Thank very much for helping me Isaac. I really appreciate it. :)
User avatar
Isaac
Posts: 3182
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

rlewarne04 wrote:It's ok that worked as intended after tweaking it at little to suit my needs.

Thank very much for helping me Isaac. I really appreciate it. :)
Image
AndakRainor wrote:Thanks ! So any idea how I could access all the spells definitions in this function and for each get its name and uiName (the two values necessary to define a spell scroll) ?
Try this (in item.lua):

Code: Select all

function makeScrolls()
local spellNames = {        -- replace "blob" with your own spell names. Add more entries if you need them. 
					"blob",
					"blob",
					"blob",
					}
	for x = 1, #spellNames do
		defineObject{
			name = "scroll_"..spellNames[x],
			baseObject = "base_item",
			components = {
				{
					class = "Model",
					model = "assets/models/items/scroll_spell.fbx",
				},
				{
					class = "Item",
					uiName = "Scroll of "..string.gsub(string.gsub(string.sub("_"..spellNames[x],1), "_.", string.upper),"_", " "),
					gfxIndex = 113,
					weight = 0.3,
				},
				{
					class = "SpellScrollItem",
					spell = spellNames[x]
				},
			},
	}
	end

end
makeScrolls()
User avatar
Duncan1246
Posts: 404
Joined: Mon Jan 19, 2015 7:42 pm

Monster's limited movements

Post by Duncan1246 »

I want to limit monster's movements to an open area (without walls or such). I have made it in LoGI with "onMove" and a function, but I think it's a little bit more complicated with LoG2. What about "on PerformAction"? What syntax I have to choose?
Thanks for yours replies.
Duncan 1246
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Monster's limited movements

Post by Drakkan »

Duncan1246 wrote:I want to limit monster's movements to an open area (without walls or such). I have made it in LoGI with "onMove" and a function, but I think it's a little bit more complicated with LoG2. What about "on PerformAction"? What syntax I have to choose?
Thanks for yours replies.
Duncan 1246
why you cant just use blocker objects ?
Breath from the unpromising waters.
Eye of the Atlantis
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 »

Drakkan wrote: why you cant just use blocker objects ?
You are right for one elevation areas, but I have some elevated areas with bridges and I want that some monsters patrolls on it without jumping down...
Duncan
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 »

Jumping down?

AFAIK monsters stay on their elevation - except for flying monsters (like uggardians). But you could place blockers in the air by elevation +1/2/3...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
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 »

THOM wrote:Jumping down?

AFAIK monsters stay on their elevation - except for flying monsters (like uggardians). But you could place blockers in the air by elevation +1/2/3...
So for elevations I am worring about nothing... but for open areas it seems to me that multiply blockers is an heavy solution... i hoped to define paths included in a monster's hook, it's my first reason for asking about "onMove". With a defined path by monster, I could have differents paths for different monsters in the same area. What to do you think?
Duncan
Azel
Posts: 808
Joined: Thu Nov 06, 2014 10:40 pm

Re: Ask a simple question, get a simple answer

Post by Azel »

I'm far from a Pro on the available options to achieve a Monster Patrol Path, but if I were going to attempt it with my current bag of tricks...

I would create the monster and disable the Move option via the Editor. Then place a Script object, create a function (MoveMyMonster), and use the Monster Move/Strafe/Turn method(s) as needed (http://www.grimrock.net/modding/scripting-reference/) to "patrol" the monster along a defined path. I would hook this function to a timer than runs every second or so.

Lastly, I would set up 1 or more floor triggers near the monster so that when the party walks near the area, the floor trigger runs a Function that stops the Timer (hence, stops the MoveMyMonster function), and re-enables the default Move option so that the Monster is now free to move on its own to engage the party.

This would be simulating "aggro" found in most MMORPG's.

Of course, I'd have to actually write this out to test it and tweak it as needed to avoid errors (ie, object collisions while moving the monster) as well as realism. My 2 cents :mrgreen:
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Ask a simple question, get a simple answer

Post by petri »

You could also implement a custom brain (onThink hook) so you can make the monster do whatever you want.
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 »

petri wrote:You could also implement a custom brain (onThink hook) so you can make the monster do whatever you want.
Azel wrote:I'm far from a Pro on the available options to achieve a Monster Patrol Path, but if I were going to attempt it with my current bag of tricks...

I would create the monster and disable the Move option via the Editor. Then place a Script object, create a function (MoveMyMonster), and use the Monster Move/Strafe/Turn method(s) as needed (http://www.grimrock.net/modding/scripting-reference/) to "patrol" the monster along a defined path. I would hook this function to a timer than runs every second or so.

Lastly, I would set up 1 or more floor triggers near the monster so that when the party walks near the area, the floor trigger runs a Function that stops the Timer (hence, stops the MoveMyMonster function), and re-enables the default Move option so that the Monster is now free to move on its own to engage the party.

This would be simulating "aggro" found in most MMORPG's.

Of course, I'd have to actually write this out to test it and tweak it as needed to avoid errors (ie, object collisions while moving the monster) as well as realism. My 2 cents :mrgreen:
Thanks for the ideas Azel, I think it's a good way to do what in pretty large areas (=few chances of collisions) and close to LG1 scripting I only knows for the moment.
Petrl, I wonder about brain and what we could do with it, but do you have some examples or have you seen some threads about it, because "scripting reference" gives barely a list...
The Blue Monastery (LOG1)
download at:http://www.nexusmods.com/grimrock/mods/399/?

Finisterrae(LOG2)
download at:http://www.nexusmods.com/legendofgrimrock2/mods/61/?
Post Reply