Page 379 of 390

Re: Ask a simple question, get a simple answer

Posted: Thu Jul 01, 2021 3:55 am
by Isaac
Using a teleporter as an in-place spinner is a bad idea; infinite loops.

Use a script and floor trigger, and in the function call the party object's setPosition() function to reorient them.

A good way to do this is to use the floor_trigger's facing attribute to determine the spun facing direction; this can be opposite, arbitrary, or random as suits your purpose. This way, you just position the floor_trigger to face the direction you want the party to face.

Example:

Code: Select all

function floorSpinner(trigger)
	local spinDirection = trigger.go.facing
	party:setPosition(party.x,party.y, spinDirection ,party.elevation,party.level)
end

-- For a random spin, change trigger.go.facing to math.random(4)-1
-- To have the party face backwards (regardless of current facing), change trigger.go.facing to (party.facing+2)%4

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 17, 2021 7:45 pm
by ratman
How would I make a reset button for pushable block puzzles?

Code: Select all

function resetblocks()
pushable_block_2:setPosition(3, 12, 0, 0, 3)
pushable_block_1:setPosition(3, 13, 0, 0, 3)
pushable_block_3:setPosition(2, 13, 0, 0, 3)
end
works, but it doesn't let you push the block into the square it was in before getting reset.

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 17, 2021 11:50 pm
by 7Soul
ratman wrote: Sat Jul 17, 2021 7:45 pm How would I make a reset button for pushable block puzzles?

Code: Select all

function resetblocks()
pushable_block_2:setPosition(3, 12, 0, 0, 3)
pushable_block_1:setPosition(3, 13, 0, 0, 3)
pushable_block_3:setPosition(2, 13, 0, 0, 3)
end
works, but it doesn't let you push the block into the square it was in before getting reset.
This is what the Simulacrum puzzle in the main dungeon does:

Code: Select all

function reset()
	local w = 3
	local h = 3
	
	-- delete old blocks
	for x=0, w do
		for y=0, h do
			for i in self.go.map:entitiesAt(self.go.x+x, self.go.y+y) do
				if i.name == "pushable_block" then
					i:destroy()
				end
			end
		end
	end
	
	respawn()
	playSound("teleport")
end

function respawn()
	spawn("pushable_block", self.go.level, self.go.x+3, self.go.y+2, 0)
	spawn("pushable_block", self.go.level, self.go.x+1, self.go.y+0, 0)
	spawn("pushable_block", self.go.level, self.go.x+2, self.go.y+1, 0)
	spawn("pushable_block", self.go.level, self.go.x+0, self.go.y+3, 0)
end
My guess is that setting the position of a pushable block doesn't update all of its components

Re: Ask a simple question, get a simple answer

Posted: Sun Jul 18, 2021 7:26 pm
by ratman
This works, except I have a custom object of a pushable block with a receptor on it, and this script spawns a new on without all the connecters. Is there some way to spawn it with the same connecters and entity types?

edit: Never mind, I got it to work.

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 24, 2021 4:18 am
by ratman
How would I get the magma golem ranged attack to work? In the base game it works fine, but I doubt the monster definition would be different.

Re: Ask a simple question, get a simple answer

Posted: Sat Jul 24, 2021 10:31 pm
by 7Soul
ratman wrote: Sat Jul 24, 2021 4:18 am How would I get the magma golem ranged attack to work? In the base game it works fine, but I doubt the monster definition would be different.
The room has to have enough vertical space for that attack iirc

Re: Ask a simple question, get a simple answer

Posted: Tue Aug 10, 2021 2:01 am
by ratman
I am trying to add a new mechanic to my mod, making the shields more interesting: instead of just giving evasion, you have to use them like a weapon, and it gives you a few seconds of protection (The amount depending on the shield), with a cooldown. Maybe the cooldown only affects the hand holding the shield like with dual wielding?
I remember seeing something like this somewhere, either here on the forums or nexus but I can't remember where...
Basically I could probably do the stuff like making the shields usable and making them give protection for an amount of time, but I don't know how to make the cooldown for only one hand, if this is possible. Thanks!
edit: I figured it out, never mind

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 07, 2021 9:25 pm
by bongobeat
Hey there,

I've recently tryed to enlarge some of the log2 textures, on this website which gives a good quality.
https://bigjpg.com/

For instance, here is the mine_support_dif, enlarged to 2048x2048
SpoilerShow
Image
I've done that to see if a bigger image would make the game nicer, specially on some of the 512x512 textures, like the barrel_crate.
For the mine_support_dif I only noticed a better rendering on the nails.

(For this test, I use the same image for the specular texture, and I keep the normal texture of 1024x1024 from the game.)
Generally the general rendering was better, but I though that would be much more better, for a texture of such size.

So my question is:
Is it really worth enlarging the textures? And by so, for optimal rendering does it require also a normal textures of the same size?

barrel_crate_dif: enlarged to 1024x1024: noticed a better rendering
dungeon_bricks_dif: enlarged to 2048x2048: looked better but I thought that the details would be even better
dungeon_stone_slabs_dif: enlarged to 2048x2048: I noticed a better rendering on the bricks of the dungeon alcove

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 07, 2021 10:46 pm
by Isaac
Computer enlargement is not going to improve the textures unless they are reworked afterwards to make use of the finer pixel granularity, whether done manually (by hand with an image editor like Photoshop), by using image enhancing AI, or both. Without this second step the rescaling merely pads the image with replicated or interpolated pixels.

https://www.photopea.com
____________
https://upscalepics.com/

https://letsenhance.io/

https://icons8.com/upscaler

*Normal maps should not be rescaled, as they are not perceptual data; they are either derived from the model itself, or used to —fake— lighting information not found on the model.

But normal maps can be tweaked and improved. ;)
SpoilerShow
Image

Re: Ask a simple question, get a simple answer

Posted: Tue Sep 21, 2021 10:57 pm
by Mal85
Hello everyone, I seem to have finally exploded something in my mod and could use a brain or two to get this working for me again. Thanks in advance!

I was messing with one of my monster definitions in my monsters.lua and now whenever I try to run the editor with this specific floor enabled it crashes with this error.

https://hosting.photobucket.com/images/ ... merror.png

Im like 99% certain it had to do with this monster in particular, but I am afraid to mess with years of spaghetti code any further or attempt to redefine him. Some of this I wrote years ago and it just worked somehow... :?

Code: Select all

-- This file has been generated by Dungeon Editor 2.1.9

-- TODO: place your custom monster definitions here

defineObject{
	name = "skeleton_aspect",
	baseObject = "base_monster",
	components = {
		{
			class = "Model",
			model = "assets/models/monsters/skeleton_knight_commander.fbx",
			storeSourceData = true, -- must be enabled for mesh particles to work
		},
		{
			class = "Animation",
			animations = {
				idle = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_idle.fbx",
				moveForward = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_walk.fbx",
				turnLeft = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_turn_left.fbx",
				turnRight = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_turn_right.fbx",
				attack = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_attack.fbx",
				attack2 = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_attack2.fbx",
				moveAttack = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_move_attack.fbx",
				rangedAttack = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_ranged_attack.fbx",
				summonUndead = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_summon_undead.fbx",
				turnAttackLeft = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_turn_attack_left.fbx",
				turnAttackRight = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_turn_attack_right.fbx",
				turnAroundAttack = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_turn_around_attack.fbx",
				getHitFrontLeft = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_front_left.fbx",
				getHitFrontRight = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_front_right.fbx",
				getHitBack = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_back.fbx",
				getHitLeft = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_left.fbx",
				getHitRight = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_right.fbx",
				fall = "assets/animations/monsters/skeleton_knight_commander/skeleton_knight_commander_get_hit_front_left.fbx",
			},
			currentLevelOnly = true,
			onAnimationEvent = function(self, event)
				if event == "summon_undead_begin" then
					self.go.handLeftParticle:restart()
					self.go.handRightParticle:restart()
					self.go.spellLight:fadeIn(2.7)
				elseif event == "summon_undead_end" then
					self.go.spellLight:fadeOut(0.1)
				end
			end,
		},
		{
			class = "Monster",
			meshName = "skeleton_knight_commander_mesh",
			footstepSound = "skeleton_footstep",
			hitSound = "skeleton_hit",
			dieSound = "skeleton_die",
			hitEffect = "hit_dust",
			capsuleHeight = 0.7,
			capsuleRadius = 0.25,
			collisionRadius = 0.6,			
			health = 325,
			protection = 12,
			evasion = 0,
			immunities = { "sleep", "blinded", "frozen" },
			resistances = {
				["poison"] = "immune",
				["frost"] = "immune",
				["shock"] = "weak",
			},
			traits = { "undead" },
			exp = 350,
			lootDrop = { 100, "long_sword", 25, "long_sword" },
		},
		{
			class = "SkeletonCommanderBrain",
			name = "brain",
			sight = 6,
			allAroundSight = true,
			morale = 100,	-- fearless
		},
		{
			class = "MonsterMove",
			name = "move",
			sound = "skeleton_commander_walk",
			cooldown = 2,
		},
		{
			class = "MonsterTurn",
			name = "turn",
			sound = "skeleton_commander_walk",
		},
		{
			class = "MonsterAttack",
			name = "basicAttack",
			attackPower = 17,
			accuracy = 27,
			pierce = 17,
			woundChance = 20,
			cooldown = 4,
			sound = "skeleton_commander_attack",
			onBeginAction = function(self)
				-- randomize animation
				if math.random() < 0.5 then
					self:setAnimation("attack")
				else
					self:setAnimation("attack2")
				end
			end,
		},		
		{
			class = "MonsterAttack",
			name = "turnAttack",
			attackPower = 27,
			accuracy = 27,
			pierce = 17,
			woundChance = 20,
			cooldown = 0,
			sound = "skeleton_commander_turn_attack",
			turnToAttackDirection = true,
		},
		{
			class = "MonsterAttack",
			name = "rangedAttack",
			attackPower = 30,
			cooldown = 15,
			animation = "rangedAttack",
			sound = "skeleton_commander_ice_shards",
			onAttack = function(self)
				-- cast ice shards
				local dx,dy = getForward(self.go.facing)
				local spell = spawn("ice_shards", self.go.level, self.go.x + dx, self.go.y + dy, self.go.facing, self.go.elevation)
				spell.iceshards:setRange(5)
				spell.tiledamager:setAttackPower(32)
			end,
		},
		{
			class = "MonsterMoveAttack",
			name = "moveAttack",
			attackPower = 27,
			accuracy = 45,
			pierce = 17,
			woundChance = 25,
			cooldown = 6,
			animation = "moveAttack",
			sound = "skeleton_commander_move_attack",
		},
	},
}
I can run the mod inside the editor if I disable this floor from the editor list but it wont launch as an executable. Thank you for your help!