Page 382 of 400

Re: Ask a simple question, get a simple answer

Posted: Thu Dec 16, 2021 12:31 am
by Adrageron
Another noobish question from me, guys :)
I have a lot of moving and rotating stuff in the mod, including the one with MinimalSaveState.
For these primitives I have the function, which is called from onInit() hook of this object:

Code: Select all

defineObject{
	name = "script_starter",
	components = {
		{
			class = "Null",
			onInit = function(self)
				init_functions.script:movePrimitives()
			end,
		},				
	},
	placement = "floor",
	editorIcon = 256,
	minimalSaveState = true,
}
All works fine from the editor and at first mod launch, but after reload game crahses if I try to change any object directly

Code: Select all

-- like this: 
forest_ruins_wall_02_269.door:disable()
or just ignore moving if I use safe findEntity procedure.

Code: Select all

function spin(entity, x, z, y)
	local en = findEntity(entity)
   if en then    
      en:setWorldRotationAngles(x, y, z)    
   else
      	print('no such entity: '..entity)
   end
end
object not rotated, hudPrint was ignored too.
I assume that this is namespace related stuff, but I have no idea how to make it work :) Calling out for help! :)

Added: oh, and another question: I have not found the legal way to change accuracy or critical chance in condition definition, so I've used this hack, that surprisingly works (not only for wizards):

Code: Select all

defineTrait{
	name = "wizard",
	uiName = "Wizard",
	icon = 33,
	description = "As a wizard, you have a huge reserve of magical energy and deep knowledge of the Arcane sorcery arts.",
	gameEffect = [[
	- Health 40 (+2 per level), Energy 60 (+8 per level)
	- You can learn and cast Arcane spells.
	- Willpower +1 per level.
	- You can cast spells with bare hands.]],
	onRecomputeStats = function(champion, level)
		if level > 0 then
			level = champion:getLevel()
			champion:addStatModifier("willpower", level)
			champion:addStatModifier("max_health", 40 + (level-1) * 2)
			champion:addStatModifier("max_energy", 60 + (level-1) * 8)
		end
	end,
	onComputeAccuracy = function (champion, weapon, attack, attackType, skillLevel)
		if champion:hasCondition("heroism") then
			return 20
		end
	   end,
	onComputeCritChance = function (champion, weapon, attack, attackType, skillLevel)
		if champion:hasCondition("heroism") then
			return 4
		end
	end,
}
Is this ok or there is a better and less cheesy way to do that? :)

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 06, 2022 1:15 pm
by bongobeat
Hey guys: I got an issue of collision on a special wall:

if I use any spell launching by a wand or orb (eg. zhandul orb, lightning wand, etc...) or any item that use a custom spell, the spell explode on the party, when the special wall is behind the party (and only this direction).

The special wall is in fact, a door based object. I use it that way for the door up-and-low sliding without creating an animation (and because I don't know how). So there is a button within the definition that open the door, then the figure goes up, and goes down when repressed and so on.

Here is some screenshots that explain the thing maybe better:

the object is partially derived from the sx_fountain, I keep the head, make the other part of the moded invisible, and use it with an offset to be put on a wall.
On the left, once pressed, the model goes up, like a door. So it's a door, but placed on a wall.
SpoilerShow
Image
And when you use a spell, in this screen its a custom spell, but with the zhandul orb its the same as well, it explodes on the party.
SpoilerShow
Image
This is the view in the editor:
SpoilerShow
Image
And this is the whole code of the object:
SpoilerShow

Code: Select all

defineObject{
	name = "zo_tomb_daemon_door_with_minimal",
	baseObject = "base_door",
	components = {
		{
			class = "Model",
			-- original fountain model
			model = "mod_assets/sx_town/models/sx_dungeon_fountain_static.fbx",
			-- custom object using only the demon head and placed to be fit
			-- on a wall without using an offset
--			model = "mod_assets/zo_temple/zo_demon_face_door_decimate_50.fbx",
		materialOverrides = { ["castle_inside_wall_tile"] = "invisib", ["marble_floor"] = "invisib", ["sx_water"] = "invisib", ["marble_daemon_head"] = "zotomb_daemon" },
--			offset = vec(-0.05, -0.15, -0.85),
			staticShadow = true,
		},
		{
			class = "Door",
			openVelocity = 0.3,
			closeVelocity = -0.15,
			closeAcceleration = -1,
			--sparse = true,
			killPillars = false,
			openSound = "no_sound",
			closeSound = "no_sound",
			lockSound = "palace_secret_button_lock",
			openingDirection = "up",
			maxHeight = 0.2,
			secretDoor = true,
		},
		{
			class = "Clickable",
			offset = vec(0,1.475,0),
			size = vec(0.5, 1.0, 0.4),

			--debugDraw = true,
			-- the inside button using to toggle the state of the door,
			-- while using a minimal save state and because the state
			-- of this door doesn't bother once saved.
			onClick = function(self)
				if self.go.door:isClosed() then
					self.go.controller:open()
				else
					self.go.controller:close()
				end
			end
		},
		{
			class = "Controller",
			onOpen = function(self)
				self.go.door:open()
			end,
			onClose = function(self)
				self.go.door:close()
			end,
			onToggle = function(self)
				self.go.door:toggle()
			end,
		},
	},
	minimalSaveState = true,
	replacesWall = false,
	placement = "wall",
	editorIcon = 8,
	automapIcon = -1,
}
Now, what I tryed or what I noticed:
- When I remove the offset thing in the definition (with the fountain model), there is no more collision with a spell, but then you cannot see it, before the fountain is made to be used within the wall, in an alcove

- When I edited the fountain model in blender and keep only the head adjusted (in blender) that it can fit on a wall, I no longer need an offset,but the spell are still exploding on the party.

- There is no collision, when using no offset, and when the door component of both models are opened

- When using throwing or missile weapons:
The object with the sx_fountain model (while used with an offset), block every trowing/missile items.
Without an offset it works well.
The object with the "custom" head only, block no missile or throwing weapons.

So, is there a way on how to fix this and of course keep the sliding door effect?

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 14, 2022 8:21 pm
by maneus
It seems, that the door is inside you(offset 1,475).

You can send me the model and I can take a look on it.

Re: Ask a simple question, get a simple answer

Posted: Tue Feb 15, 2022 7:36 pm
by bongobeat
Well, the "1.475" is the offset of a clickable objet, it is not a model. Though I don't know if this can colide with anything.

I've worked something by editing the boudbox of the model with the GMT, by reducing the parameters. Spells doesn't collide anymore, but when you use the camera to look all around, the model disappear because of the new parameters. Not very fancy, but at least the party cannot kill itself for the moment.

This was more a bit of luck, I don't realy know what I'm doing while modifying a boundbox. I hope I didn't break anything.

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 20, 2022 10:33 pm
by bongobeat
Back with something else that I discovered yesterday:

I use the invoke fire spell by Minmay, from his mod dungeon master reconversion:
That's the spell for the firestaff.

The problem is that you can cast it trough a force field, (well i mean it goes trought the forcefield, only a true wall stop it) and so it can be some kind of exploit/bug for killing safely anything who is trapped or protected by a force field.

I don't know how to modify that.



The code is all here (but not the particles and item)
SpoilerShow

Code: Select all

----- fire ray from Minmay's firestaff spell
-- used by orb of the meteor
defineSpell{
	name = "dm_invoke_fire",
	uiName = "Invoke Fire",
	gesture = 0,
	manaCost = 50,
	skill = "fire_magic",
	requirements = {},
	icon = 71,
	spellIcon = 0,
	description = "",
	hidden = true,
	onCast = function(champion,x,y,direction,elevation,skill)
		local dx,dy = getForward(direction)
		local nx = x+dx
		local ny = y+dy
		if nx >= 0 and nx < party.map:getWidth() and ny >= 0 and ny < party.map:getHeight() then
			if party.map:checkLineOfFire(x,y,nx,ny,elevation) then
				spawn("dm_fire_ray_initial_tracer",party.level,nx,ny,direction,elevation)
			end
		end
	end,
}
defineObject{
	name = "dm_fire_ray",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "dm_fire_ray",
			offset = vec(0, 1, 0),
			destroyObject = true,
		},
		{
			class = "Light",
			offset = vec(0, 1, 0),
			color = vec(1, 0.5, 0.25),
			brightness = 80,
			range = 4,
			fadeOut = 0.5,
			disableSelf = true,
		},
		{
			class = "TileDamager",
			attackPower = 1000,
			damageType = "fire",
			-- no good way to track caster, this is the same anyway
			damageFlags = DamageFlags.Champion1,
			onHitChampion = function(self, champion)
				-- no friendly fire for this spell
				return false
			end,
			onInit = function(self)
				local g = self.go
				local wpos = g:getWorldPosition()
				local ppos = party:getWorldPosition()
				-- enforce same elevation as caster on heightmapped levels
				g:setWorldPositionY(ppos[2])
				local partyDistance = math.sqrt((wpos[1]-ppos[1])^2+(wpos[2]-ppos[2])^2+(wpos[3]-ppos[3])^2)
				if partyDistance > 11 then
					g.particle:setParticleSystem("dm_fire_ray_lowdetail")
				end
				local f = g.facing
				local dx,dy = getForward(f)
				local nx = g.x+dx
				local ny = g.y+dy
				local m = g.map
				local e = g.elevation
				if nx < m:getWidth() and nx >= 0 and ny < m:getHeight() and ny >= 0 then
					if m:checkLineOfFire(g.x,g.y,nx,ny,e) then
						spawn("dm_fire_ray_tracer",g.level,nx,ny,f,e)
					end
				end
			end,
		},
	},
}
defineObject{
	name = "dm_fire_ray_initial",
	baseObject = "dm_fire_ray",
	components = {
		{
			class = "Sound",
			name = "sound1",
			sound = "fireburst",
			offset = vec(0, 1, 0),
			pitch = 0.75,
		},
		{
			class = "Sound",
			name = "sound2",
			sound = "gun_shot_cannon",
			offset = vec(0, 1, 0),
			pitch = 2,
		},
	},
}
defineObject{
	name = "dm_fire_ray_tracer",
	placement = "floor",
	components = {
		{
			class = "Null",
			onInit = function(self)
				local g = self.go
				local wpos = g:getWorldPosition()
				local ppos = party:getWorldPosition()
				if wpos[2]-ppos[2] <= 0.5 then
					g:spawn("dm_fire_ray")
				end
				g:destroyDelayed()
			end,
		},
	},
	tags = {"dm"},
}
defineObject{
	name = "dm_fire_ray_initial_tracer",
	placement = "floor",
	components = {
		{
			class = "Null",
			onInit = function(self)
				local g = self.go
				local wpos = g:getWorldPosition()
				local ppos = party:getWorldPosition()
				if wpos[2]-ppos[2] <= 0.5 then
					g:spawn("dm_fire_ray_initial")
					party.party:shakeCamera(0.2,0.8)
				end
				g:destroyDelayed()
			end,
		},
	},
	tags = {"dm"},
}

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 03, 2022 3:59 pm
by ColdDeadStone
Hello!

Is there any way to change an existing dungeon that is currently being played (with savegames), if you have made a mistake? So practically a patch for the dungeon.

My attempts in this direction have failed. Changing the scripts apparently does nothing because they are saved in the savegame?

If anyone has an idea for this, please, share it with me! :?

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 03, 2022 5:01 pm
by THOM
I think there are ways to alter the stats of the party members.

As far as I know there are no possibilities to change the behaviour of the dungeon itself. And if there is, I presume it is far away from being done easily...

EDIT: Some things can of course be done with the help of the console, though.

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 03, 2022 7:34 pm
by Isaac
In the One Room Round Robin 2 mod, we essentially erased /or respawned the rooms as they were entered or left by the player, for performance reasons; LoG1 had no occlusion.

In LoG2, most things can be changed on the fly using the console if you know —exactly— the objects you want to change.

For instance it's easy to change all of the [placed] spiders to snails, or to other monsters. It's possible to teleport the party to anywhere, or delete walls, open doors; spawn keys, add or remove connections to switches... etc.

What precise change did you have in mind?

(Know that some changes might inadvertently or adversely affect scripts or scripted events; possibly making the game unwinnable.)

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 03, 2022 9:03 pm
by ColdDeadStone
I was thinking mainly of script errors. If I made a mistake somewhere, in the script itself, then the game crashes. There is no chance to fix it afterwards. The dungeon file is over 11MB, so going through it all will take time, but I guess I have no other choice. :?

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 03, 2022 11:34 pm
by Isaac
It's more or less like that by design. For ORRR2, we had to reupload the whole dat file each time we patched it.

However, for small issues it is sometimes possible to post a console fix [manually typed in by the player], that lasts for the rest of their current game, but would need to be done again each time they started a new one. This can be done as an immediate fix that will later become part of a future update.