Page 1 of 1

Summoning Horn

Posted: Sun Mar 08, 2015 8:07 pm
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.

Re: Summoning Horn

Posted: Sun Mar 08, 2015 10:26 pm
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"

Re: Summoning Horn

Posted: Wed Mar 11, 2015 4:16 pm
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.

Re: Summoning Horn

Posted: Wed Mar 11, 2015 6:50 pm
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.

Re: Summoning Horn

Posted: Thu Jul 14, 2016 4:30 pm
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.

Re: Summoning Horn

Posted: Sat Jul 16, 2016 10:12 am
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?

Re: Summoning Horn

Posted: Sun Jul 17, 2016 8:28 pm
by Daniknamchang
I just read it wrong.
I thought you had to make the code but it's already in the horn.