Ask a simple question, get a simple answer

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!
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post 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.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post 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: )
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Ask a simple question, get a simple answer

Post 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
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post 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
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Gradunk
Posts: 54
Joined: Tue Oct 22, 2013 2:26 am
Location: Calgary, Canada

Re: Ask a simple question, get a simple answer

Post by Gradunk »

you are a god minmay lol
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
sleepy
Posts: 15
Joined: Wed Feb 04, 2015 2:34 am

Re: Ask a simple question, get a simple answer

Post 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.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post 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
Badgert
Posts: 258
Joined: Sun Jan 29, 2017 6:14 pm

Re: Ask a simple question, get a simple answer

Post 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.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post 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.
Liam.Ducray
Posts: 4
Joined: Sun Feb 19, 2017 11:23 am

Re: Ask a simple question, get a simple answer

Post 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
Post Reply