How do I spawn items with a spell?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Lollgramoth
Posts: 35
Joined: Fri Jun 15, 2012 7:31 am
Location: Germany

How do I spawn items with a spell?

Post by Lollgramoth »

I try to make a spell which spawns an item. But all I get is a very ugly way to exit Grimrock(Program shuts down if the onCast function is executed). What do I do wrong?
The Idea is to be able to select a hero with this item, so effects can take place.

Code: Select all

defineSpell{
   name = "Spawn_it",
   uiName = "Shmendrik",
   skill = "spellcraft",
   level = 1,
   runes = "EF",
   manaCost = 20,
   onCast = function(caster, x, y, direction, skill)
	 setMouseItem(spawn(healwave_item))
   end
}
User avatar
Edsploration
Posts: 104
Joined: Wed Sep 19, 2012 4:32 pm

Re: How do I spawn items with a spell?

Post by Edsploration »

I haven't played with this myself, but I can at least point out that the spawn function should have a string as its first argument:

Code: Select all

setMouseItem(spawn("healwave_item"))
Open Project -> Community FrankenDungeon: viewtopic.php?f=14&t=4276
Lollgramoth
Posts: 35
Joined: Fri Jun 15, 2012 7:31 am
Location: Germany

Re: How do I spawn items with a spell?

Post by Lollgramoth »

hooray. That was the solution. Puzzel solved, Edsploration thank you very much.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: How do I spawn items with a spell?

Post by Montis »

Lollgramoth wrote:I try to make a spell which spawns an item. But all I get is a very ugly way to exit Grimrock(Program shuts down if the onCast function is executed). What do I do wrong?
The Idea is to be able to select a hero with this item, so effects can take place.
Keep in mind that any mouse-held item will be overridden if you use setMouseItem.
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: How do I spawn items with a spell?

Post by msyblade »

U need to have quotes around the item you want to spawn in the string.
Example: setMouseItem(spawn("snail_slice"))
end
yer missing those quotes ", otherwise you got it right ! :)
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Post Reply