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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

So, that means I can't adress the monstergroup itself but only the monsters in it? And how to know their IDs?

Or is the only moment to do something with a monstergroup when the mod got started the first time ?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
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 »

If you are spawning them at a known location, you can check for all objects at that location, and get their ids.
User avatar
Eleven Warrior
Posts: 746
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

How do I spawn a note or scroll onto a altar with a message on either one of them ty :)

I can do this but not sure about the add message bit

Code: Select all

spawn("note",14,28,1,3,"note_2")
g1_table_3.surface:addItem(note_2.item)
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 »

Code: Select all

function addTextNote(shelf, objectId, text)
	if text and findEntity(shelf).surface and not findEntity(objectId) then
		findEntity(shelf).surface:addItem(spawn("scroll",nil,nil,nil,nil,nil,objectId).item)
		if findEntity(objectId) then
			findEntity(objectId).scrollitem:setScrollText(text)
		end	
	  else print('error: input must not be nil', self.go.id..".addTextNote", shelf, objectId, text, " " )	
	end
end

addTextNote("dungeon_alcove_1", "note_2", "Not all that glitters is gold")
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

I don't understand why, in this object, the animation don't work:

Code: Select all

defineObject{
	name = "forest_spruce_sapling_pillar",
	baseObject = "base_pillar",
	components = {
		{
			class = "Model",
			model = "assets/models/env/forest_spruce_sapling_02.fbx",
			staticShadow = true,
		},
		{
			class = "Animation",
			animations = {
				sway = "assets/animations/env/forest_spruce_sapling_02_idle.fbx",
			},
			playOnInit = "sway",
			loop = true,
			maxUpdateDistance = 6,
		},
	},
	automapIcon = -1,
	minimalSaveState = true,
}
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I removed the experience line from this standard ice_guardian taken directly from default assets.
As I try to place this "custom ice_guardian1" the editor crashes.

Code: Select all

defineObject{
	baseObject = "base_monster",
	name = "ice_guardian1",
	components = {
		{
			name = "model",
			class = "Model",
			storeSourceData = true,
			model = "assets/models/monsters/ice_guardian.fbx"
		},
		{
			animations = {
				fall = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_front_left.fbx",
				attack = "assets/animations/monsters/ice_guardian/ice_guardian_attack_close.fbx",
				getHitFrontLeft = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_front_left.fbx",
				rangedAttack = "assets/animations/monsters/ice_guardian/ice_guardian_attack_far.fbx",
				turnRight = "assets/animations/monsters/ice_guardian/ice_guardian_turn_right.fbx",
				getHitRight = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_right.fbx",
				getHitFrontRight = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_front_right.fbx",
				strafeRight = "assets/animations/monsters/ice_guardian/ice_guardian_strafe_right.fbx",
				getHitBack = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_back.fbx",
				moveForward = "assets/animations/monsters/ice_guardian/ice_guardian_walk.fbx",
				turnLeft = "assets/animations/monsters/ice_guardian/ice_guardian_turn_left.fbx",
				idle = "assets/animations/monsters/ice_guardian/ice_guardian_idle.fbx",
				getHitLeft = "assets/animations/monsters/ice_guardian/ice_guardian_get_hit_left.fbx",
				strafeLeft = "assets/animations/monsters/ice_guardian/ice_guardian_strafe_left.fbx"
			},
			class = "Animation",
			name = "animation",
			currentLevelOnly = true
		},
		{
			hitSound = "ice_guardian_hit",
			health = 500,
			immunities = {
				"sleep",
				"blinded"
			},
			meshName = "ice_guardian_mesh",
			capsuleRadius = 0.3,
			deathEffect = "death_icy",
			protection = 10,
			resistances = {
				cold = "absorb",
				fire = "weak"
			},
			class = "Monster",
			flying = true,
			hitEffect = "hit_ice",
			traits = {
				"elemental"
			},
			evasion = 10,
			dieSound = "ice_guardian_die",
			capsuleHeight = 0.6,
			name = "monster",
			collisionRadius = 0.8
		},
		{
			sight = 5,
			seeInvisible = true,
			class = "IceGuardianBrain",
			name = "brain",
			morale = 100
		},
		{
			animationSpeed = 1.3,
			cooldown = 3,
			sound = "ice_guardian_walk",
			class = "MonsterMove",
			name = "move"
		},
		{
			animationSpeed = 1.5,
			class = "MonsterTurn",
			name = "turn",
			sound = "ice_guardian_walk"
		},
		{
			sound = "ice_guardian_walk",
			class = "MonsterChangeAltitude",
			name = "changeAltitude"
		},
		{
			animation = "attack",
			onAttack = function() print('Cannot Scrape Functions'); end,
			cooldown = 5,
			sound = "ice_guardian_attack",
			class = "MonsterAttack",
			name = "basicAttack",
			attackPower = 30
		},
		{
			animationSpeed = 1.5,
			shootProjectile = "frostbolt",
			attackType = "projectile",
			class = "MonsterAttack",
			animation = "rangedAttack",
			cooldown = 3,
			sound = "ice_guardian_attack",
			name = "rangedAttack",
			attackPower = 30
		},
		{
			name = "light",
			offset = {
				0,
				0.5,
				0.25,
				0
			},
			color = {
				0.5,
				0.8,
				1.7,
				0
			},
			parentNode = "light1",
			fillLight = true,
			class = "Light",
			range = 4,
			brightness = 5
		},
		{
			rotation = {
				0,
				0,
				90,
				0
			},
			parentNode = "light1",
			class = "Particle",
			name = "particle",
			particleSystem = "ice_guardian"
		}
	}
}
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 »

Pompidom wrote: Wed Oct 23, 2019 10:33 am I removed the experience line from this standard ice_guardian taken directly from default assets.
As I try to place this "custom ice_guardian1" the editor crashes.
I don't understand why people never post the actual error message.
In this case, something about Light.lua

So let's search your code for the string "light"

Code: Select all

		{
			name = "light",
			offset = {
				0,
				0.5,
				0.25,
				0
			},
			color = {
				0.5,
				0.8,
				1.7,
				0
			},
			parentNode = "light1",
			fillLight = true,
			class = "Light",
			range = 4,
			brightness = 5
		},
"offset" and "color" look different from the ones in ice_guardian.lua in the asset pack...
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Ok, so you have to copy the monstercode straight from the individual monster files, and not from the bigass defaultassets notepad file.
woops!
It works now.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Eleven Warrior wrote: Mon Oct 21, 2019 10:43 am How do I spawn a note or scroll onto a altar with a message on either one of them ty :)

I can do this but not sure about the add message bit

Code: Select all

spawn("note",14,28,1,3,"note_2")
g1_table_3.surface:addItem(note_2.item)
What I mostly do is simply put the note on the altar, then disable the model and the item component.
This way the note is already there with the correct text, it's just invisible and can not be taken by accident.

Code: Select all

function note()
	note_1.item:enable()
	note_1.model:enable()
end
when it needs to be "spawned"

It's way simpler and faster than actually spawning in items.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

hey

Is that possible to gain a spell while using skillpoint on a trait? If the player choose a spell cast class.
I want to gain customs spells if I use skillpoints in a skill, let's say herborist.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply