Page 193 of 391

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 8:30 pm
by Zo Kath Ra
zimberzimber wrote:
Zo Kath Ra wrote:I'd like to change the direction of a "blob" without destroying it and spawning a new one.
I could use teleporters, but I want to change the direction even if the blob isn't in the center of a square.

Changing the direction to up/down can be done like this:
ProjectileComponent:setVelocity(0)
ProjectileComponent:setFallingVelocity(number)
If you want to turn it left/right mid flight, you can change world position.
I can't really post code right now, but you could find an example for this in my asset packs lich.lua (shameless self advertising :lol: )
Thanks, that did the trick.
I was only using setPosition() before, which destroyed the blob.
But using setPosition() followed directly by setWorldPosition() works.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 9:35 pm
by akroma222
Isaac wrote:Reading back through the script, I enable it in onDrawGui ~inside a condition that checks for the right-mouse-button click, the correct location of the mouse cursor when clicked, and that the champion is ready to attack. I disable it again in the onGetPortrait hook; that runs every frame for the duration of the effect.
**I do not know/remember why I chose onDrawGui instead of onDrawAttackPanel; but I plan to find out [again]. It would seem able to simplify it by removing the screen region check.
The tricky part of the tiger effect, is the management of arbitrary items they may be carrying in the hands; often weapons. They have to be removed, stored, and returned, outside of inventory.
Ahh, of course - onDrawGui/ onDrawAttackPanel/ onGetPortrait run every frame, much better than onAttack 8-)
Thankyou again for the detailed instructions good sir!
(back to work i go :mrgreen: )

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 10:26 pm
by Gradunk
I'm trying to make the party only have 1 set champion. but i'm having trouble finding code on here that would remove champions 2-4 or set stats of champion one.
to remove them i've got

Code: Select all

function solo()
	for i=2, 4 do
		party:getChampion(i):setEnabled(false)
	end
end
but it's saying getChampion is a nil value even though it has the parameter.

i've seen lists of things i can do to a party but nowhere does it say how to remove them or what the party components are.
thanks again

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 10:41 pm
by minmay
You're trying to call the PartyComponent methods on a GameObject instead of the PartyComponent. You wanted:

Code: Select all

function solo()
   for i=2, 4 do
      party.party:getChampion(i):setEnabled(false)
   end
end

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 05, 2017 10:50 pm
by Gradunk
you are a god minmay lol

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 06, 2017 5:41 am
by sleepy
zimberzimber wrote:Here's what can be done:
Define a camera to be used with stairs
Upon activating a scrip, the camera is moved to the parties position and plays a 'going up/down' animation
Play the going up/down sound
When the animation ends, the the parties position to the new location
reset the current camera

Only hard part is animating the camera :?
Yeah, that's about what I"d come to. What set me on about this was being seriously bothered by not being able to see staircases from their sides in the town tileset. If you want an outdoor town that looks convincing: you need stairs. Must. No exception. I've tried very hard. The best you can do is use bridges over varying heightmapping:
SpoilerShow
Image
Though you will get some edge seams depending upon how you start it, in this case I've decided to keep it, because I was able to cover all but this bit very easily:
SpoilerShow
Image
The camera doesn't look too bad. There's few components to worry about. Though game cameras still tend to trip me up, scripted, predefined, cameras are way easier to deal with.
akroma222 wrote: Hey Sleepy,
have you had a look through this thread?
viewtopic.php?f=22&t=8178&hilit=Stairs+ ... vator+Demo
There is a Stairs & Elevator Demo dungeon ... it may be of some help
( EDIT... however, it doesnt use the overlapping stair + ladder code that you are pursuing )
Akroma
That elevator script is interesting. I might have to test it. My interest in the ladder style solution is purely for the aesthetic value of being able to have functional free standing staircases. That and it's a super common thing people ask about.

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 06, 2017 8:42 am
by akroma222
sleepy wrote: That elevator script is interesting. I might have to test it. My interest in the ladder style solution is purely for the aesthetic value of being able to have functional free standing staircases. That and it's a super common thing people ask about.
I agree, everyone could enjoy the aesthetic value of well placed stair cases
Probably a good thing to register with AH if they are keen on doing another Glogg Session

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 19, 2017 9:28 am
by Badgert
Good afternoon!
Please tell me how to put in an alcove a unique personal key that opens only one lock in the game, has a new name and description?
Sorry if the question is too easy - I'm new to modding.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 19, 2017 10:14 am
by Isaac
Badgert wrote:Good afternoon!
Please tell me how to put in an alcove a unique personal key that opens only one lock in the game, has a new name and description?
Sorry if the question is too easy - I'm new to modding.
You define your own key, like this:

Code: Select all

-- This doesn't go in a script_entity. Place this in the items.lua file, in your mod's scripts folder.
-- This is usually found (for Windows OS), at C:\Users\ {Your own user account} \Documents\Almost Human\Legend of Grimrock 2\Dungeons\ {Your own mod's name} \mod_assets\scripts

defineObject{
	name = "unique_key",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/key_tomb.fbx",  -- << You can change 'tomb' to any of the other key styles, to change the key's physical appearance.
														 --  tomb, nexus, skull, iron, master_key, cube, prison, mine_storage, gear, ornate, round, brass, gold 
		},
		{
			class = "Item",
			uiName = "Unique Key", -- Change "Unique Key" to whatever name you want the player to see.
			gfxIndex = 406,
			weight = 0.2,
			traits = { "key" },
		},
		{
			class = "Particle",
			particleSystem = "glitter_gold",
		},
	},
}
It's unique, so long as you only use it for one lock.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 19, 2017 11:45 am
by Liam.Ducray
Hi folks,

I am actually modding a custom dungeon. I´m pretty noob in this but I studied all night long some basic stuff on the official page and theese forums. Doing good so far. At the moment I am working on the items.LUA to overhaul every ingame item. :D Don´t ask me why, I just love it.
Some questions remain after searching forum and googling for hours, so ... here they are:

1. Isn´t it possible to create a character-level requirement for weapons in the LUA file? Like i.e. Character must be at least level 4 to hold a Sabre.
I tried the command "requiredLevel = X," as written on the official page, but it does not work.

2. Isn´t it possible to give the parameters "knockback" and "pierce" to ranged weapons? As I tried, the editor spelled error messages upon testplay.

3. Isn´t it possible to give Ammunition a "damageType" like i.e. fire ? I created my own Flaming Crossbow Bolts, and of course they are supposed to deal fire damage.
But again, the editor gave me the "invalid component property"-error messages upon testplay.

thats all for now :P
thanks and cheers