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!
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Ask a simple question, get a simple answer

Post by alois »

It seems to me that you are adding to the alcove surface something different from the item you have spawned. Try

Code: Select all

local rs = spawn("rat_shank")
pickup_food_alcove.surface:addItem(rs.item)
playSound("level_up")
Alois :)
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 »

alois wrote:It seems to me that you are adding to the alcove surface something different from the item you have spawned. Try

Code: Select all

local rs = spawn("rat_shank")
pickup_food_alcove.surface:addItem(rs.item)
playSound("level_up")
Alois :)
Indeed.
Or even just...

Code: Select all

pickup_food_alcove.surface:addItem(spawn("rat_shank").item)
playSound("level_up")
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Ask a simple question, get a simple answer

Post by Dunkler »

Is there a monster-blocker item in the grimrock editor?

I have only seen blockers that block everything.
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 »

Dunkler wrote:Is there a monster-blocker item in the grimrock editor?

I have only seen blockers that block everything.
I haven't seen that. The regular Blocker objects have an option for blocking the party and items, but that's not the default.

Code: Select all

-- snippet
	name = "blocker",
	components = {
		{
			class = "Obstacle",
			blockParty = false,
			blockItems = false,
		},
If you have blockParty and BlockItems set in your blockers, you can set them to False.
Dunkler
Posts: 73
Joined: Thu Jul 10, 2014 3:20 pm

Re: Ask a simple question, get a simple answer

Post by Dunkler »

Thank you.

That means there is no option to only block monsters to move to a specific square.

I remember in Dungeon Master Editors was a simple Block-Monster Objekt..which was very useful.

Edit: Oh wait...i misunderstood you :) Your created Blocker would block monsters but nothing else..so that would work
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 »

Dunkler wrote:Thank you.
Edit: Oh wait...i misunderstood you :) Your created Blocker would block monsters but nothing else..so that would work
Correct; but AFAIK, that is the default behavior of blocker objects.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

...there's already an object called "blocker" in the standard assets that does exactly what you want. It only blocks monsters.
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
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Thank you Alois and Issac awesome guys :)

Ok I got it to work, but after you use the lever 9 times it still spawns rat_shanks. I thought if "fed_counter > 9 then" would stop the player using the lever further. Once it's greater than 9 it should stop and hudPrint the text (Nothing happens)?? What imam I doing wrong on this guys thxs in return :)

Code: Select all

fed_counter = 0

function feedTheParty()
if fed_counter > 9 then
	hudPrint("Nothing happens.")
else
	fed_counter = fed_counter + 1
		pickup_food_alcove.surface:addItem(spawn("rat_shank").item)
				playSound("level_up")
end
	end
EDIT: Errrr sorry this code does work I missed 1 count with the level :oops:
User avatar
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Hi again guys.

I need a Script that allows me to turn the Party to either 0,1,2,3 when the walk onto a floor_trigger. I think this was mentioned b4 but I cannot find the Script. I know that the player can still use the mouse to turn, but I only need it to happen on level entry or exit.

Thxs for help on this :)
alois
Posts: 112
Joined: Mon Feb 18, 2013 7:29 am

Re: Ask a simple question, get a simple answer

Post by alois »

Do you want the party to simply turn (in this case: party:setPosition(party.x,party.y,0/1/2/3,party.elevation,party.level) is enough) or to be incapable of turning after you set the facing (which involves the onTurn hook)?

Alois :)
Post Reply