Page 191 of 400

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 04, 2017 8:04 pm
by Isaac
akroma222 wrote:Question - can we recreate Attack Swipes ??
I know all the Attack Swipe models are in the asset pack, using "swipe01" material.
...and also that we can set new materials/textures etc etc
Just wondering if we can actually override / replicate / mimic the Attack Swipes ??
Ta!
I did for my Tiger Strength potion; but was a bit of a kludge, and is more of an additive effect.
https://www.dropbox.com/s/tq3vk02qubnp0 ... m.avi?dl=0

This was done by adding a disabled model to the party, and toggling it on/off for any melee attacks. Each time they attack... the custom swipe effect is shown, and then disabled.

**It might also be possible to make a particle effect, and just spawn one in front of the party with each attack; I didn't try that though.

IRRC the engine calls the swipe model files by name, so there didn't seem to be a way to redefine or override that. If it exists as a model component [somewhere], then it might be possible to override that once the name is known ~if such is the case.

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 04, 2017 8:51 pm
by Gradunk

Code: Select all

function warden4()
	hudPrint ("Did you or did you not? Be quick about it!")
	castle_pit_trapdoor_1:open()
end
what the hell am i doing wrong here? i've looked everywhere and that's what i've found to have worked for others but it crashes my test cause open is a nil value?
i know this is unrelated but thanks

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 04, 2017 8:53 pm
by Isaac
Gradunk wrote:what the hell am i doing wrong here?

Code: Select all

castle_pit_trapdoor_1.door:open()
Objects have component [class] functions in LoG2, it means accessing them by name. Even the party object has a party component, and has to be accessed via party.party.

**You can see these components in the editor in the object inspector.

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 04, 2017 8:56 pm
by Gradunk
Objects have component functions in LoG2, it means accessing them by name. Even the party object has a party component, and has to be accessed viaq party.party.
ooooooooh thats what the pitComponent thing means. identify what it is you're altering! thanks

Re: Ask a simple question, get a simple answer

Posted: Sat Feb 04, 2017 8:59 pm
by Isaac
Image

Here is the component list:
https://github.com/JKos/log2doc/wiki/Components

The first entry [Component], lists the methods and properties common to all; the rest of the list is information specific to each.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 2:21 am
by Zo Kath Ra
When I put this code in items.lua, everything works fine:

Code: Select all

function oei(self, champion, slot)
    print(self.go.id, champion:getName(), slot)
end

defineObject{
	name = "bone_amulet_new",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/bone_amulet.fbx",
		},
		{
			class = "Item",
			uiName = "Bone Amulet",
			description = "A primitive amulet made out of bones that are bound together with string.",
			gfxIndex = 65,
			weight = 0.2,
			traits = { "necklace" },
			
			onEquipItem = oei,
		},
	},
}
But this code in items.lua crashes the editor with "attempt to call global 'oei' (a nil value)"

Code: Select all

function oei(self, champion, slot)
    print(self.go.id, champion:getName(), slot)
end

defineObject{
	name = "bone_amulet_new",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/bone_amulet.fbx",
		},
		{
			class = "Item",
			uiName = "Bone Amulet",
			description = "A primitive amulet made out of bones that are bound together with string.",
			gfxIndex = 65,
			weight = 0.2,
			traits = { "necklace" },
			
			onEquipItem = function(self, champion, slot)
			    oei(self, champion, slot)
			end,
		},
	},
}
Is there any way to call functions defined in a lua file from hooks in the same file?

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 3:14 am
by minmay
Hook functions get a similar environment to ScriptComponents, so they won't see anything that you put in the init files' environment. You can add the 'local' keyword to your oei function to make it an upvalue and then it will work for this purpose, but of course that means you can only use it in hooks that never get serialized.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 4:27 am
by Isaac
minmay wrote:... but of course that means you can only use it in hooks that never get serialized.
How does one know which ones those are? :?

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 5:05 am
by minmay
Not sure, other than trial and error.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 5:12 am
by Mysterious
Hi all.

I have been searching for a Musical piece or 2 for the Inn I have made in my Mod. Alas to no avail :(

Most of you have heard a musical score play in most RPG Games when you enter a (Inn). So I was wondering can anyone direct me to a site where the Music File would either be free or low cost?

Thank you.