Page 335 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 19, 2019 3:00 pm
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 ?

Re: Ask a simple question, get a simple answer

Posted: Sat Oct 19, 2019 5:51 pm
by Isaac
If you are spawning them at a known location, you can check for all objects at that location, and get their ids.

Re: Ask a simple question, get a simple answer

Posted: Mon Oct 21, 2019 10:43 am
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)

Re: Ask a simple question, get a simple answer

Posted: Mon Oct 21, 2019 1:14 pm
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")

Re: Ask a simple question, get a simple answer

Posted: Tue Oct 22, 2019 11:50 am
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,
}

Re: Ask a simple question, get a simple answer

Posted: Wed Oct 23, 2019 10:33 am
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"
		}
	}
}

Re: Ask a simple question, get a simple answer

Posted: Wed Oct 23, 2019 1:36 pm
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...

Re: Ask a simple question, get a simple answer

Posted: Wed Oct 23, 2019 2:38 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Wed Oct 23, 2019 2:43 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Fri Nov 01, 2019 12:30 pm
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.