Item-on-Altar with additional condition

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
DarkChaplain
Posts: 2
Joined: Sat Sep 22, 2012 1:44 am
Contact:

Item-on-Altar with additional condition

Post by DarkChaplain »

Hey guys, I hope you can help me out with this one.

I just opted into the beta and tried the editor, have read a bit of the documentation and basically found what I was looking for already:

http://www.grimrock.net/modding/how-to- ... ve-puzzle/

However, I am not quite satisfied with just putting an item on top of my altar to open a gate. I want a little additional condition.

Instead, I'd like to have the player pick up a Skull and a Dagger onto the altar. The twist? The player must have drawn blood with the Dagger at least once.
Ideally, I'd want to require the player to pick a party member who 'uses' the Dagger to sacrifice a few HP, without needing an enemy to get involved.

I hope I didn't overlook anything too obvious.

Any hint on how to get this to work?
Help will be much appreciated!
User avatar
Malveus
Posts: 25
Joined: Tue Jul 17, 2012 5:03 am
Location: Louisville, KY

Re: Item-on-Altar with additional condition

Post by Malveus »

I'm not the greatest coder, but I believe you could actually manage this by using a wand and just loading the dagger graphic onto it.The altar could then check the number of charges on the dagger to ensure it's been used.
User avatar
Malveus
Posts: 25
Joined: Tue Jul 17, 2012 5:03 am
Location: Louisville, KY

Re: Item-on-Altar with additional condition

Post by Malveus »

Actually, I missed the obvious here - use the venom dagger as your base item, and just tie in a script to check the charge value remaining and return false if it's still maxed.
User avatar
DarkChaplain
Posts: 2
Joined: Sat Sep 22, 2012 1:44 am
Contact:

Re: Item-on-Altar with additional condition

Post by DarkChaplain »

Hah! I found a way!

First I introduced two new items:

Code: Select all

cloneObject{
	name = "sacrificial_dagger",
	baseObject = "dagger",
	uiName = "Sacrificial Dagger",
	attackPower = 12,
	damageType = "physical",
	description = "This dagger has not tasted blood in a long time...",
	consumable = True,
	emptyItem = "bloodied_dagger",
    onUseItem = function(item, champion)
	   hudPrint("Ouch!")
	   champion:playDamageSound()
	   champion:modifyStat("health", -15)
	   playSound("impact_blade", 1, party.x, party.y)
	   spawn("bloodied_dagger", 1, party.x, party.y, party.facing)
	  return true
    end,
}

cloneObject{
	name = "bloodied_dagger",
	baseObject = "dagger",
	uiName = "Bloodied Dagger",
	attackPower = 12,
	damageType = "physical",
	description = "A dagger coated in fresh blood.",
}
There's the Sacrificial Dagger, which is placed into an alcove in the altar room.
It is consumable, which clears it from the game after usage.
Upon using it, the champion loses 15 health (I tried the "damage(type, amount)" function first, but it would crash the game, so I took a look at the way potions work and inverted the healing). Fittingly, the game plays a champion-based damage sound.

Since the SD isn't what we want, the consumption spawns the second item, the Bloodied Dagger, at the party's current position. It will lie at their feet, which isn't too bad, as I imagine the character might simply drop his dagger, which I thought I'd accentuate with the "impact_blade" sound effect.

Now that the BD is in play, all that's left is placing it onto the altar to open the door, as explained in the Item on an Alcove Puzzle page. I combined it with another item, a skull, and the door opens nicely with both those items placed on the altar.


If you want to take a look at the whole thing in motion, go ahead =)

http://www.mediafire.com/download.php?w07c8f5r7wllu06
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Item-on-Altar with additional condition

Post by Komag »

that's a very cool setup you've put together, nice!
Finished Dungeons - complete mods to play
Post Reply