HELP: i need a script for a monster/party interaction.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

HELP: i need a script for a monster/party interaction.

Post by Daght »

I need a script were if Tentacles1 or 2 or 3 or 4 kills a party member then open the IronDoor.
Some one can help me?
If we do not end the war, the war will end us.
zapibranigan
Posts: 15
Joined: Thu Sep 20, 2012 9:37 am

Re: HELP: i need a script for a monster/party interaction.

Post by zapibranigan »

I don't think it's possible to know the entity which causes a death of a champion.

This said, I think you can do your script with the following technic :

entity_1 is an instance of your monster

onDie : use a hook which does this : if a party member died, look for the four adjacents tiles (party.x and party.y), and look for the location of entity_1 (entity_1.x, entity.y) : if the entity is present, ironDoor:open()

Will it be good for your need? I can try to write you the needed scripts if you want (but I'm at work now so I won't be able to test it at the moment! :) )
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

Re: HELP: i need a script for a monster/party interaction.

Post by Daght »

zapibranigan wrote:I don't think it's possible to know the entity which causes a death of a champion.

This said, I think you can do your script with the following technic :

entity_1 is an instance of your monster

onDie : use a hook which does this : if a party member died, look for the four adjacents tiles (party.x and party.y), and look for the location of entity_1 (entity_1.x, entity.y) : if the entity is present, ironDoor:open()

Will it be good for your need? I can try to write you the needed scripts if you want (but I'm at work now so I won't be able to test it at the moment! :) )
I will be glad if you can write it. Do it when you can, i'm ending the dungeon on this week end and i need to try it before publishing the beta of the full mod.
If we do not end the war, the war will end us.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: HELP: i need a script for a monster/party interaction.

Post by Neikun »

That sounds mean D:
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: HELP: i need a script for a monster/party interaction.

Post by Montis »

Neikun wrote:That sounds mean D:
it's could actually be the opposite.

like "you can do x to open the door, but if someone gets killed, the door opens as well"

I might try to whip up a script this afternoon when I have time.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: HELP: i need a script for a monster/party interaction.

Post by Montis »

Done. Can someone try the following?

in file init.lua
SpoilerShow

Code: Select all

cloneObject{
name = "party",
baseObject = "party",
onDie = function()
	murderMystery.checkWhoDidIt()
end,
}

script_entity murderMystery
SpoilerShow

Code: Select all

-- change the following line to suit your dungeon
suspectedMurderer = "tentacles"
doorToOpen = "mysteryDoor"

-- you shouldn't need to change any of the following lines
function checkWhoDidIt()
	local x = ""
	local y = ""
	for i=1,4 do
		if i==1 then
			x = party.x+1
		elseif i == 3 then
			x = party.x-1
		else
			x = party.x
		end

		if i==2 then
			y = party.y+1
		elseif i == 4 then
			y = party.y-1
		else
			y = party.y
		end

		for j in entitiesAt(party.level, x, y) do
			if j.name == suspectedMurderer then
				findEntity(doorToOpen):open()
				return
			end
		end
	end
end
Last edited by Montis on Sat Sep 22, 2012 11:10 am, edited 1 time in total.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
Emciel
Posts: 34
Joined: Fri Sep 14, 2012 2:19 am

Re: HELP: i need a script for a monster/party interaction.

Post by Emciel »

i like the script name Montis ^_^

in fact... it gave me an idea... a murder mystery mod!
one of your party members killed an innocent snail, following clues you must figure out which room the murder took place in and with which weapon!
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: HELP: i need a script for a monster/party interaction.

Post by Komag »

a Grimrock "Clue" game? Interesting!
Finished Dungeons - complete mods to play
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

Re: HELP: i need a script for a monster/party interaction.

Post by Daght »

The cript crashed as a party member died and the editor was shut down.
If we do not end the war, the war will end us.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: HELP: i need a script for a monster/party interaction.

Post by Montis »

The function was incorrect, but not to the part that it crashed for me. I fiddled around a bit and reproduced the crash: the script_entity name must(!) be the same name as you refer to it in the onDie function. So when you have ondie... murderMystery.checkWhoDidIt(), you must name the script_entity "murderMystery" or the game will crash when trying to call the function.

I corrected the script of the function above, that will work now.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
Post Reply