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
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

Thanks, it works now.

edit: no it does not:
party definition:

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		{
			class = "Timer",
			name = "timeSlowTimer",
			timerInterval = 30,
			disableSelf = true,
			enabled = false,
			onActivate = function(self)
				zim_functions.script:timeNormal()
			end,
		},
		{
			class = "Timer",
			name = "targetSpellUpTime",
			timerInterval = 10,
			disableSelf = true,
			enabled = false,
			onActivate = function(self)
				zim_target_ally.script.cancelledSpell()
			end,
		},
		{
			class = "Timer",
			name = "toxicItemTimer",
			timerInterval = 5,
			enabled = false,
			onActivate = function(self)
				if not zim_functions.script.toxicItemDamage() then self:disable() end
			end,
		},
		{
			class = "Null",
			name = "isScoped",
			enabled = false,
		},
		{

			class = "Controller",
			onActivate = function(self)
				self.go.particle:fadeIn(3)
			end,
			onDeactivate = function(self)
				self.go.particle:fadeOut(1)
			end,
			onToggle = function(self)
				if self.go.particle:isEnabled() then
					self.go.particle:fadeOut(1)
				else
					self.go.particle:fadeIn(3)
				end
			end,
		},	
		{
       class = "Particle",
		 name = "snow",
		 ParticleSystem = "sx_snow_emitter_party",
     },
		{
			class = "Particle",
			name = "rain",
			particleSystem = "sx_rain_emitter_party",
		},
		{
			class = "Sound",
			name = "rainsound",
			sound = "sx_rain_loop"
		},
		{

			class = "Sound",
			name = "flute",
			sound = "null",
		},
		{
			class = "Party",




		onDrawSkills = function(self, context, champion)
			local customSkills = true
			if customSkills then
				local w, h, r = context.width, 		context.height, 	context.width / context.height
				local f = (r < 1.3 and 0.8 or r < 1.4 and 0.9 or 1) * context.height/1080
				local f2 = (context.height/1080)
				local MX, MY = context.mouseX, context.mouseY
				-- Cover original skill window up
				 context.drawGuiItem("SkillMinusImage", w - (548 * f2), 287 * f2, 0, 0, 510, 292, 510*f2, 292*f2)
				local dummy1, dummy2 = context.button("dummy",w - 536, 267, 510, 312)
				-- -- Variables
				local skill_x, skill_y = 0, 0
				local val1, val2, valX, valY = {}, {}, {}, {}
				-- local skill1_p = { 2,4,5 } -- athletics
				local skill1_p = { 2,4,5 } -- block
				local skill2_p = { 2,4,5 } -- light armor
				local skill3_p = { 2,4,5 } -- heavy armor
				local skill4_p = { 1,4,5 } -- accuracy
				local skill5_p = { 2,4,5 } -- critical
				local skill6_p = { 2,4,5 } -- firearms
				local skill7_p = { 2,3,4,5 } -- seafaring
				local skill8_p = { 1,2,4,5 } -- alchemy
				local skill9_p = { 3,4,5 } -- tinkering
				local skill10_p = { 1,4,5 } -- ranged weapons
				local skill11_p = { 2,4,5 } -- throwing weapons
				local skill12_p = { 3,4,5 } -- light weapons
				local skill13_p = { 3,4,5 } -- heavy weapons
				local skill14_p = { 1,2,4,5 } -- spellblade
				local skill15_p = { 2,4,5 } -- elemental
				local skill16_p = { 2,4,5 } -- poison
				local skill17_p = { 3,4,5 } -- concentration
				local skill18_p = { 1,4,5 } -- witchcraft				
				local skill_perks = { skill1_p, skill2_p, skill3_p, skill4_p, skill5_p, skill6_p, skill7_p, skill8_p, skill9_p, skill10_p, skill11_p, skill12_p, skill13_p, skill14_p, skill15_p, skill16_p, skill17_p, skill18_p }
				-- Draw skills slots
				for i=1,18 do
					skill_x = math.floor((i-1) / 9)
					skill_y = (i-1) % 9
					context.drawGuiItem("SkillSlots", w - ((369 - (skill_x * 252)) * f2), (298 + (skill_y * 31)) * f2, 1, 1, 70, 21, 70*f2, 21*f2)
					val1[i], val2[i] = context.button("skill_info"..i, w - (548 - (skill_x * 252)), 292 + (skill_y * 31), 252, 31)
					valX[i] = 369 - (skill_x * 252)
					valY[i] = 298 + (skill_y * 31)
				end
				-- Draw skills slots (hover)
				for i=1,18 do	
					if val2[i] then
						context.drawGuiItem("SkillSlots", w - ((valX[i] + 1) * f2), (valY[i] - 1) * f2, 0, 23, 72, 23, 72*f2, 23*f2)
						break
					end
				end
				-- Draw skill pegs
				--for i=1,18 do
				--	skill_x = math.floor((i-1) / 9)
				--	skill_y = (i-1) % 9
				--	local xpositions = {0,0,0,5,10}
				--	local tickX = 0				
				--	-- Draw green pegs
				--	local skillLevel = champion:getSkillLevel(functions.script.skillNames[i])
				--	local tempLevel = skillLevel + functions.script.partySkillTemp[champion:getOrdinal()][i]
				--	if skillLevel < 5 then					
				--		if tempLevel > 0 and skillLevel < 5 then
				--			for j=skillLevel+1,tempLevel do
				--				tickX = ((j-1) * 11) + xpositions[j]
				--				context.drawGuiItem("skill_slots", w - ((366 - (skill_x * 252) - tickX) * f2), (301 + (skill_y * 31)) * f2, 10, 46, 10, 15, 10*f2, 15*f2)
				--			end
				--		end	
				--	end
					
					-- Draw yellow pegs
				--	local skillLevel = champion:getSkillLevel(functions.script.skillNames[i])
				--	if skillLevel > 0 then
				--		for j=1,skillLevel do
				--			tickX = ((j-1) * 11) + xpositions[j]
				--			context.drawImage2("mod_assets/textures/gui/skill_slots.dds", w - ((366 - (skill_x * 252) - tickX) * f2), (301 + (skill_y * 31)) * f2, 0, 46, 10, 15, 10*f2, 15*f2)
				--		end
				--	end
					
					-- Draw trait pegs
			--		for j=1,#skill_perks[i] do
			--			tickX = (skill_perks[i][j] - 1) * 11 + xpositions[skill_perks[i][j]]
			--			local got = 0
			--			if skillLevel >= skill_perks[i][j] or tempLevel >= skill_perks[i][j] then
			--				got = 7
			--			end
			--			if skill_perks[i][j] < 4 then
			--				context.drawImage2("mod_assets/textures/gui/skill_slots.dds", w - ((363 - (skill_x * 252) - tickX) * f2), (306 + (skill_y * 31)) * f2, 72, got, 4, 5, 4*f2, 5*f2)
			--			elseif skill_perks[i][j] == 4 then
			--				context.drawImage2("mod_assets/textures/gui/skill_slots.dds", w - ((364 - (skill_x * 252) - tickX) * f2), (305 + (skill_y * 31)) * f2, 76, got, 6, 6, 6*f2, 6*f2)
			--		--	else
					--		context.drawImage2("mod_assets/textures/gui/skill_slots.dds", w - ((364 - (skill_x * 252) - tickX) * f2), (305 + (skill_y * 31)) * f2, 82, got, 6, 7, 6*f2, 7*f2)
			--			end
			--		end				
			--	end
				-- Draw confirm and clear buttons
				local confirm1, confirm2 = context.button("confirm", w - (270), 584, 108, 32)
				local clear1, clear2 = context.button("clear", w - (270-125), 584, 108, 32)
				for i=1,18 do
					if functions.script.partySkillTemp[champion:getOrdinal()][i] > 0 then
						context.drawGuiItem2("ButtonAccept", w - (274*f2), 583*f2, 0, 0, 108, 32, 108*f2, 32*f2)
						context.drawGuiItem2("ButtonClear", w - ((274-125)*f2), 583*f2, 0, 0, 108, 32, 108*f2, 32*f2)
						if confirm2 then
							context.drawGuiItem2("ButtonAcceptHover", w - (274*f2), 583*f2, 0, 0, 108, 32, 108*f2, 32*f2)
							if context.mouseDown(3) then
								functions.script.performSkillTemp(champion)
							end
						end
						if clear2 then
							context.drawGuiItem2("ButtonClearHover", w - ((274-125)*f2), 583*f2, 0, 0, 108, 32, 108*f2, 32*f2)
							if context.mouseDown(3) then
								functions.script.clearSkillTemp(champion)
							end
						end
						break
					end
				end
				-- Draw description overlay and icon
				for j=1,18 do
					if val2[j] then	
						-- Click skill --
						local points = champion:getSkillPoints()
						local skillLevel = champion:getSkillLevel(functions.script.skillNames[j])
						local skillLevelTemp = functions.script.partySkillTemp[champion:getOrdinal()][j]
						local totalSkills = functions.script.countAllSkills(champion)
						if context.mouseDown(3) and points > 0 and skillLevelTemp < 5 and skillLevelTemp < 5 - skillLevel then
							if skillLevelTemp + skillLevel == 3 then
								if totalSkills >= 7 then
									functions.script.addSkillTemp(champion, j)
								else
									hudPrint("Need 7 allocated skill points to get Silver tier. You got " .. totalSkills .. ".")
								end						
							elseif skillLevelTemp + skillLevel == 4 then
								if totalSkills >= 11 then
									functions.script.addSkillTemp(champion, j)
								else
									hudPrint("Need 11 allocated skill points to get Gold tier. You got " .. totalSkills .. ".")
								end	
							else
								functions.script.addSkillTemp(champion, j)
							end
						end
						-- Unclick skill --
						if context.mouseDown(5) and functions.script.partySkillTemp[champion:getOrdinal()][j] > 0 then
							functions.script.removeSkillTemp(champion, j)						
						end
						-- Draw description
					--	local f3 = math.min(f2 + 0.1, 1)
					--	context.drawGuiItem("mod_assets/textures/gui/skill_description/skill_" .. j .. ".dds", w - (1170 * f), MY - 230, 0, 0, 556, 500, 556*f, 500*f)
						-- Draw icon
						-- context.drawImage2("mod_assets/textures/gui/skills.dds", w - (1228*f2), MY - 110 + 16, ((j-1)%13)*75, math.floor((j-1)/13)*75, 75, 75, 75*f3, 75*f3)
					--	break
					end	
				end
			end
		end,


			onDrawGui = function(party, g)
					
				end,
				onRest = function(party)
					if ( findEntity("GTK") ) then
						if ( GTK.Core.GUI:isPartyLocked() ) then	
							return false;
						end
					end			
				end,
				onWakeUp = function(party)
					if ( findEntity("GTK") ) then
						if ( GTK.Core.GUI:isPartyLocked() ) then
							return false;
						end
					end
			
				end,
------------------------------ OnInit
			onInit 	= function(self) end,
			
------------------------------ Unused OnDraws
			onDrawInventory		= function(self, context, champion) end,
			onDrawStats			= function(self, context, champion) end,
--			onDrawSkills		= function(self, context, champion) end,
			onDrawTraits		= function(self, context, champion) end,
			
------------------------------ On Draw GUI
--			onDrawGui = function(self, g)
--				--	Prevent using mouse look while the entire party is frozen and apply screen effect
--				if zim_functions.script.entirePartyHasCondition("frozen") then
--					self:playScreenEffect("frozen_screen")
--					GameMode.setGameFlag("DisableMouseLook", true)
--				end
--			end,
			
------------------------------ On Draw Attack Panel
			onDrawAttackPanel = function(self, champion, g, x, y, scaleX, scaleY, translationX, translationY)
				if champion:hasCondition("frozen") and not champion:hasCondition("petrified") then
					champion:showAttackResult("Frozen", "SpellNoEnergy")
				end
			end,
			
------------------------------ On Attack
			onAttack = function(self, champion, action, slot)
				if champion:hasCondition("frozen") then
					return false
				elseif champion:hasCondition("disarmed") then
					champion:showAttackResult("Disarmed!", "HitSplashLarge")
					return false
				end
				
				local item = champion:getItem(slot)
				if item and (item.go.name == "rope" or item.go.name == "shovel") then
					for i = 1,4 do
						local c = party.party:getChampion(i)
						if c and c:hasCondition("slowdown") then
							hudPrint("Can't use that right now...")
							return false
						end
					end
				end
			end,
			
------------------------------ on Death
			onDie = function(self, champion)
				zim_functions.script.cureConditions(champion, "death", false)
			end,
			
------------------------------ on Cast Spell
			onCastSpell = function(self, champion, spell)
			
				--	Silence spell blocker
				if champion:hasCondition("silence") then
					champion:showAttackResult("Silence", "SpellFizzle")
					playSound("spell_expires")
					return false
				end
			end,
			
------------------------------ on Damage
			onDamage = function(self, champion, damage, damageType)
			
				--	Fire damage can remove frozen condition
				--				can set the champion on fire
				if damageType == "fire" then
					if champion:hasCondition("frozen") then
						if damage > math.random(20,40) then
							champion:removeCondition("frozen")
						end
					elseif not champion:hasCondition("burning") and damage > math.random(25,55) then
						champion:setCondition("burning")
					end
					
				--	Cold damage can remove the burning condition
				--				can freeze the champion
				elseif damageType == "cold" then
					if champion:hasCondition("burning") then
						if damage > math.random(15,35) then
							champion:removeCondition("burning")
						end
					elseif not champion:hasCondition("frozen") and damage > math.random(25,75) then
						champion:setCondition("frozen")
					end	
					
				--	Shock damage can disrupt the champion
				elseif damageType == "shock" then
					if not champion:hasCondition("disrupted") and damage > math.random(25,75) then
						champion:setCondition("disrupted")
					end
				
				-- Physical damage can be reduced with the Vanguard item
				--					may cause bleeding
				elseif damageType == "physical" then
					local h1,h2 = champion:getItem(ItemSlot.Weapon),champion:getItem(ItemSlot.OffHand)
					if (h1 and h1.go.name == "vanguard") or (h2 and h2.go.name == "vanguard") then
						if math.random() < 0.33 then
							local newDamage = damage - champion:getLevel() * 10
							if newDamage > 0 then
								if not champion:hasCondition("bleeding") and newDamage > math.random(champion:getHealth()*0.15,champion:getHealth()*0.75) then
									champion:setConditionValue("bleeding", 15) 
								end									-- Check for bleeding proc because the other checker is not reached. (false is returned before it)
								champion:damage(newDamage, "pure")	-- Since armor is taken into account before the hook is called, we can use pure damage
								champion:playDamageSound()			-- But make sure there are no damage reductions on pure.
							end										-- It's pure, it shouldn't be reduced anyways. It exists for a reason.
							playSound("human_knight_block")
							return false
						end
					end
					
					if not champion:hasCondition("bleeding") and damage > math.random(champion:getHealth()*0.15,champion:getHealth()*0.75) then
						champion:setConditionValue("bleeding", 15) 
					end
				end
			end,
		
------------------------------ on Move
--			onMove = function(self, direction)
--				if zim_functions.script.entirePartyHasCondition("frozen") then
--					playSound("party_move_blocked") return false
--				end
--				
--				--	Prevent the party from moving if they're scoped
--				if self.go.isScoped:isEnabled() then return false end
--				
--				for i = 1, 4 do
--					for j = 1, 32 do
--						local item = party.party:getChampion(i):getItem(j)
--						if item then
--							if item.go.triggerOnMove then item.go.triggerOnMove.performAction(self, direction) end
--							if item.go.containeritem then
--								for s = 1, item.go.containeritem:getCapacity() do
--									local conItem = item.go.containeritem:getItem(s)
--									if conItem and conItem.go.triggerOnMove then conItem.go.triggerOnMove.performAction(self, direction) end
--								end
--							end
--						end
--					end
--				end
--				
--				local mouseItem = getMouseItem()
--				if mouseItem then
--					if mouseItem.go.triggerOnMove then mouseItem.go.triggerOnMove.performAction(self, direction) end
--					if mouseItem.go.containeritem then
--						for i = 1, mouseItem.go.containeritem:getCapacity() do
--							local item = mouseItem.go.containeritem:getItem(i)
--							if item and item.go.triggerOnMove then item.go.triggerOnMove.performAction(self, direction) end
--						end
--					end
--				end
--				
--			end,
--		
------------------------------ on Turn
--			onTurn = function(self, direction)
--				if zim_functions.script.entirePartyHasCondition("frozen") then
--					playSound("party_move_blocked") return false
--				end
--				
--				--	Prevent the party from turning if they're scoped
--				if self.go.isScoped:isEnabled() then return false end
--			end,
			
------------------------------ on Rest
			onRest = function(self)
				if ( findEntity("GTK") ) then
					if ( GTK.Core.GUI:isPartyLocked() ) then
						return false
					end
				end	
				
				--	Prevent the party from resting if everyone is frozen.
--				if zim_functions.script.entirePartyHasCondition("frozen") then
--					playSound("party_move_blocked")
--					return false
--				end
				
				--	Prevent the party from resting if they're scoped
				if self.go.isScoped:isEnabled() then return false end
				
				--	Prevent the party from resting if time was slowed down by a Timeless since waking up returns time scale back to 1.
				for i = 1,4 do
					local champion = self:getChampion(i)
					if champion:hasCondition("slowdown") then return false end
				end					
			end,
			
------------------------------ on Wake Up
			onWakeUp = function(self)
				if ( findEntity("GTK") ) then
					if ( GTK.Core.GUI:isPartyLocked() ) then
						return false
					end
				end
			end,
			
------------------------------ on Recieve Condition
			onReceiveCondition = function(self, champion, condition)
				if		condition == "burning"	then
					local tile = party.map:getAutomapTile(party.x, party.y)
					if champion:hasCondition("fire_shield") or champion:hasCondition("frozen") or (tile == 2 and party:getElevation() < 0) then
						return false
					end
					
--				elseif	condition == "frozen"	then
--					if champion:hasCondition("frost_shield") or champion:getResistance("cold") > 85 then
--						return false
--					else
--						if champion:hasCondition("burning") then champion:removeCondition("burning") end
--					end
					
				elseif	condition == "poison"	then if champion:hasCondition("poison_shield") then return false end
					
				elseif	condition == "disrupted"	then
					if champion:hasCondition("shock_shield") then return false end
					
--				elseif	condition == "frost_shield" then
--					if champion:hasCondition("frozen") then champion:removeCondition("frozen") end
					
				elseif	condition == "fire_shield" then
					if champion:hasCondition("burning") then champion:removeCondition("burning") end
					
				elseif	condition == "shock_shield" then
					if champion:hasCondition("disrupted") then champion:removeCondition("disrupted") end
					
				elseif	condition == "poison_shield" then
					if champion:hasCondition("poison") then champion:removeCondition("poison") end
					
				elseif	condition == "marked" then
					local necklace = champion:getItem(8)
					if necklace and necklace.go.name == "demonbane_sigil" then
						playSound("goromorg_shield_hit")
						champion:showAttackResult("Negated!", "HitSplashLarge")
						return false
					end
				end
			end,
			
------------------------------ on Pick Up Item
			onPickUpItem = function(self, item)
				if item:hasTrait("toxic") and not self.go.toxicItemTimer:isEnabled() then
					self.go.toxicItemTimer:enable()
				end
			end,
			
------------------------------ on Click Item Slot
			onClickItemSlot = function(self, champion, container, slot, button)
				if party.party:isCarrying("rope") or party.party:isCarrying("shovel") then
					if button == 2 then
						for i = 1,4 do
							local c = party.party:getChampion(i)
							if c and c:hasCondition("slowdown") then
								local item = champion:getItem(slot)
								if item then
									if item.go.name == "rope" or item.go.name == "shovel" then
										hudPrint("Can't use that right now...")
										return false
									end
								elseif container then
									local i = container:getItem(slot)
									if i and (i.go.name == "rope" or i.go.name == "shovel") then
										hudPrint("Can't use that right now...")
										return false
									end
								end
							end
						end
					end
				end
			end,
				onDrawGui = function(party, g)
					
				end,
				onRest = function(party)
					if ( findEntity("GTK") ) then
						if ( GTK.Core.GUI:isPartyLocked() ) then
							return false;
						end
					end			
				end,
				onWakeUp = function(party)
					if ( findEntity("GTK") ) then
						if ( GTK.Core.GUI:isPartyLocked() ) then
							return false;
						end
					end
				end,
		},	
		{
       class = "Particle",
		 name = "snow2",
		 ParticleSystem = "sx_snow_emitter_party",
		},
	},
}

functions.lua:

Code: Select all

skillNames = { "strength_training", "light_armor", "heavy_armor", "accuracy", "critical", "firearms", "willpower_training", "dexterity_training", "alchemy", "ranged_weapons", "throwing_weapons", "light_weapons", "heavy_weapons" }

champSkillTemp1, champSkillTemp2 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
champSkillTemp3, champSkillTemp4 = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
partySkillTemp = {champSkillTemp1, champSkillTemp2, champSkillTemp3, champSkillTemp4 } 




function addSkillTemp(champion, skill)
	local champ = champion:getOrdinal()
	partySkillTemp[champ][skill] = math.min(partySkillTemp[champ][skill] + 1, 5)
	champion:setSkillPoints(champion:getSkillPoints() - 1)
end

function removeSkillTemp(champion, skill)
	local champ = champion:getOrdinal()
	partySkillTemp[champ][skill] = math.max(partySkillTemp[champ][skill] - 1, 0)
	champion:setSkillPoints(champion:getSkillPoints() + 1)
end

function clearSkillTemp(champion)
	local champ = champion:getOrdinal()
	for i=1,18 do
		while partySkillTemp[champ][i] > 0 do
			partySkillTemp[champ][i] = partySkillTemp[champ][i] - 1
			champion:addSkillPoints(1)
		end
	end
end
function countAllSkills(champion)
	local champ = champion:getOrdinal()
	local result = 0
	for i=1,18 do
		result = result + champion:getSkillLevel(skillNames[i])
	end
	return result
end

when I click on the skills tabs it gives the following error: 'bad argument #1 to 'getSkillLevel' (string expected, got nil)

line that gives error in functions.lua:

Code: Select all

		result = result + champion:getSkillLevel(skillNames[i])
Thanks for all help
User avatar
7Soul
Posts: 199
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

It's because your i loop goes from 1 to 18 and your skills table only has 13 entries, so when it tries to get skill[14] is gets nil (nothing)
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

Thanks.
In this line how would I move the SkillsTab up? I've figured out that w - (635 * f2) is to move it sideways, but there is no y position or anything.

Code: Select all

context.drawGuiItem("SkillsTab", w - (635 * f2), 287 * f2, 0, 0, 510, 292, 510*f2, 292*f2)
User avatar
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

ratman wrote: Wed Nov 18, 2020 1:01 am Thanks.
In this line how would I move the SkillsTab up? I've figured out that w - (635 * f2) is to move it sideways, but there is no y position or anything.

Code: Select all

context.drawGuiItem("SkillsTab", w - (635 * f2), 287 * f2, 0, 0, 510, 292, 510*f2, 292*f2)
For the definitions of drawGuiItem and drawGuiItem2 see:
https://github.com/JKos/log2doc/wiki/Ob ... nd-Classes
User avatar
7Soul
Posts: 199
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

What's up with party:getMovementSpeed() always returning nil?
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

How would I make the guiItems appear at different 'layers'? right now the skillsTab appears in front of everything else so they cant see the buttons or anything.
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

7Soul wrote: Wed Nov 18, 2020 11:00 pm What's up with party:getMovementSpeed() always returning nil?
It returns nil if the party's movement speed is nil, which it is by default. If you want it to be something else, change it with party:setMovementSpeed().
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.
User avatar
7Soul
Posts: 199
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul »

minmay wrote: Thu Nov 19, 2020 2:09 am
7Soul wrote: Wed Nov 18, 2020 11:00 pm What's up with party:getMovementSpeed() always returning nil?
It returns nil if the party's movement speed is nil, which it is by default. If you want it to be something else, change it with party:setMovementSpeed().
So I can't get the default underwater or burdened speeds?

With that said, does anyone know what the underwater and burdened speed penalties are?
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mods
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

The movement speed you get/set with get/setMovementSpeed() is a separate multiplier from those; it's so modders can make the party faster or slower in general. It won't give you the party's "actual" movement speed with penalties for encumbrance/water/etc. included.

I think the party's speed in meters per second is 6.9*[18/23 if a champion has the "burdened" or "feet_wound" conditions]*[0.75 if underwater]*[0.95 if strafing]*[the multiplier you gave with setMovementSpeed(), or 1 by default]
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.
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

How would I make a script so it gets all the party's items in their inventory, removes them, then spawns them in a chest?
Post Reply