Summoning Horn

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!
Post Reply
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Summoning Horn

Post by Emera Nova »

:o So I'm wanting to do stuff with the summoning horn much like they did in the main game with bringing out the enemy on the beach using it. How would I need to set up a script to have it call an enemy or create an item if you are standing somewhere.
User avatar
Zo Kath Ra
Posts: 940
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Summoning Horn

Post by Zo Kath Ra »

Emera Nova wrote::o So I'm wanting to do stuff with the summoning horn much like they did in the main game with bringing out the enemy on the beach using it. How would I need to set up a script to have it call an enemy or create an item if you are standing somewhere.
Search the asset pack for files that contain the text "Horn of Summoning"
Emera Nova
Posts: 146
Joined: Wed Jun 11, 2014 1:31 am

Re: Summoning Horn

Post by Emera Nova »

So I found the Summoning Horn in the assests list and here is the code for it..

Code: Select all

defineObject{
	name = "horn",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/horn.fbx",
		},
		{
			class = "Item",
			uiName = "Horn of Summoning",
			gfxIndex = 297,
			weight = 1.0,
			primaryAction = "blow",
			description = "This horn has a pungent earthy smell.",
		},
		{
			class = "ItemAction",
			name = "blow",
			uiName = "Blow Horn",
			cooldown = 4,
			onAttack = function(self)
				for e in party.map:entitiesAt(party.x, party.y) do
					if e.script and e.script.blowTheHorn then
						e.script:blowTheHorn()
					end
				end
				playSound("blow_horn")
			end,
		},
	},
}
>.> I don't see anything in that code that says anything about summoning the monster. :o I would like to know how to script that part.
User avatar
Skuggasveinn
Posts: 562
Joined: Wed Sep 26, 2012 5:28 pm

Re: Summoning Horn

Post by Skuggasveinn »

In the code you have this

Code: Select all

onAttack = function(self)
            for e in party.map:entitiesAt(party.x, party.y) do
               if e.script and e.script.blowTheHorn then
                  e.script:blowTheHorn()
               end
What this does is it looks for a script in the party location with the function blowTheHorn, if found it executes that function.
So all that you need to to is to place a script in the location you want the party to be standing when they use the horn, that script needs to have a function called blowTheHorn and anything you place in that function (summoning monsters, or whatever) will get executed.

kind regards.
Skuggasveinn.
Link to all my LoG 2 assets on Nexus.
Link to all my LoG 1 assets on Nexus.
Daniknamchang
Posts: 7
Joined: Thu Jul 14, 2016 4:27 pm

Re: Summoning Horn

Post by Daniknamchang »

I'm new to programing and wanted the same thing.
I understand how the code for the horn works but I'm confused on how you get the horn in the map in the first place.
User avatar
Zo Kath Ra
Posts: 940
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Summoning Horn

Post by Zo Kath Ra »

Daniknamchang wrote:I'm new to programing and wanted the same thing.
I understand how the code for the horn works but I'm confused on how you get the horn in the map in the first place.
Not sure if I understand your question.
Are you asking how to use the editor?
Daniknamchang
Posts: 7
Joined: Thu Jul 14, 2016 4:27 pm

Re: Summoning Horn

Post by Daniknamchang »

I just read it wrong.
I thought you had to make the code but it's already in the horn.
Post Reply