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
KhrougH
Posts: 68
Joined: Tue Sep 04, 2018 11:45 pm
Location: Roma

Re: Ask a simple question, get a simple answer

Post by KhrougH »

Isaac wrote: Tue Oct 30, 2018 8:45 am
KhrougH wrote: Tue Oct 30, 2018 7:39 am i can't use Grimrock Model Toolkit. i have a macbook. so i go straight to the mod_asset folder
Blender then. It's the same general task.
good , good... it's getting better... fixing troubles.
gate node changing works, normalmap modification works, also modify object in blender and than making a define object works.

here is a fance from sx_towntileset.
https://drive.google.com/open?id=1r5PrT ... _DwXEbxi0W

1) is the original
2) is modified

https://drive.google.com/open?id=11w859 ... DdQd1aWtCG

made by a middle part of the fence and, separately, the pillars so it looks ... ongoing (is it right in english?), without interruptions.

still: nothing special for pro modders, good target for me :D
thank you guys. now i need some practice with this. new questions will come soon!!! :twisted: :twisted: :twisted:
[...]
All those moments will be lost in time, like tears in rain.
Time to die.
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 »

akroma222 wrote: Mon Oct 29, 2018 7:12 am
bongobeat wrote: Sun Oct 28, 2018 8:14 pm Hi there,
Can someone explain how the magic resistances work please? I mean how is calculated the total magic resistances, with additionnal gears.
I want to remove temporally 60 % of all resistances.
Hey Bongo,

.....as KhrougH suspected - Ive asked about this before in the 'Multiple Magic School Spells" thread
viewtopic.php?f=22&t=9579&p=109434&hili ... ce#p109434

AndakRainor offers a method by which to accurately get resistance values here^^

Now the issue, in fetching accurate values for some of our champ stats is - pending on what and where you are doing these calculations (eg - trait hook) ....... the accuracy of the fetched stat values can vary - this is because there is an "priority order" to which the vanilla game calculates statistic values.
Minmay has given us this order (I believe this to be up to date) :
SpoilerShow

Code: Select all

-----------------------------stat recompute order:

--1. items in inventory from 1 to BackpackFirst-1 in order
--2. conditions in undefined order (pairs)
--3. skills in undefined order (pairs)
--4. traits in undefined order (pairs)

----------------------------applied after all onRecomputeStats are called:

--5 protection is rounded to the nearest integer
--6 leadership and nightstalker
--7 light and heavy armor penalties
--8 strength, dexterity, vitality, willpower bonuses to max load, evasion, health and health regen, energy and energy regen, resistances
--9 (after strength/dexterity/vitality/willpower are applied), resistances are clamped between 0 and 100, health is clamped at max_health, energy is clamped at max_energy
--10 when resting, evasion is decreased by 100
This shows that we encounter problems if trying to to fetch an actual value for a statistic whilst the game is in the middle of recalculating that statistic. This is actually something I need to revisit and check and double check myself. However, I will post my resistance modifying trait so you can get an idea of how to code that up:
SpoilerShow

Code: Select all

{
		name = "correct_resistance",
		uiName = "Core Hidden Trait", 
		iconAtlas = "mod_assets/textures/gui/blank_borders/blank64x80.tga",
		icon = 0, 
		charGen = false,
		hidden = true,
		group = "core",
		description = "...no descript needed for hidden traits...",
		--------------------------------------
		onRecomputeStats = function(champion, level)
			if level > 0 then
				local statResTab = {strength = "fire", dexterity = "shock", vitality = "poison", willpower = "cold"}
				for k,v in pairs(statResTab) do
					local currStat = champion:getCurrentStat(k)
					local diff = currStat - 10
					if diff >= 1 then	
						champion:addStatModifier("resist_"..v, - (diff * 2))
					end
				end
			end
		end,
	},
Now while this works for my purposes (the only stat bonus given to resists are done and capped at champ creation - no more resist bonuses from increasing stats after the game begins) .... Im unsure on how this cleanly stands up to the aforementioned problem w the stat calc process....

EDIT: In fact I remember someone specifically telling me NOT to get Stat values in the onRecomputeStat hook - as I have done in the above definition (local currStat = champion:getCurrentStat(k))

I remember less so a solution to that being.....(sorry this was a while back) .... Call up a custom get Stat Function that will refer to either a global statistic variable .........OR a Config Table .......OR something else that will hold the statistic value constant until your code manually updates it. Then you can get / fetch a stable value of your statistic.

Plz anyone, tell me if Ive got this wrong -
I think this issue is important ....and a clear reliable method to read stat values would is needed + would benefit all modders

Hope this helps 8-)
Thank you, I'm going to look at that! ;)
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 was playing with the idea of making structures rise out of the sea or ground.
For example, solving a puzzle where a pyramid rises out of the sea revealing a new dungeon to explore.

Don't mind the current wall clipping issues, this is just haphazardly 5 minutes of concept work. And wall clipping during movement can easily be discarded by adding dust particles and earthquake screen shaking. And structures that rise out of the sea can't have clipping issues :)

https://youtu.be/NMYNZRZeenw
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

That's a nice effect. 8-) Is it done with custom doors, or with setWorldPositionY ?
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Not at home now, I'll release my dungeon editor file tonight or tomorrow, so you can take a look yourself.

Nothing fancy, just some timer hooked to a movement script with setPosition that stops when it reaches the desired height.
An invisible exit and then some ".model:disable()/enable()" trickery.

Tonight I'm going to try and make a boat float over a river. When that works I will release the next update of my dungeon file.

I will have to check for minimal savestate compatibility as well first.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I was looking into spawning particle effects to cover up wall clipping, when rising up structures from up the ground. Is there a list of particle effects I can call upon? For example the undead monster spawns dirt particle effects when crawling from under the ground.

I was also looking at Minmay's scripts in Artifacts of Might, especially where the particle effect "dm_wood_shatter" is called upon, but my lack of braincells and my lack of coding knowledge just made my brain hurt trying to comprehend those advanced scripts.

The best I can come up with is a bunch of invisible undead with everything disabled and then with delayed calls calling their "dirt" particle effect every second, then igniting the invisible undead with a firewall so it looks like the plants in front of the structure get destroyed by the fire and the way is cleared.

https://youtu.be/mTkSqOZgYro
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Pompidom wrote: Fri Nov 02, 2018 10:52 pm I was looking into spawning particle effects to cover up wall clipping, when rising up structures from up the ground. Is there a list of particle effects I can call upon?
There is a folder in the asset pack that has all of the particle definition scripts.

But the names within it are these:

Code: Select all

beacon_crystal
beacon_furnace_text_glow
blinded_monster
castle_button
castle_ceiling_light
castle_pillar_candles
castle_wall_text
castle_wall_text_long
castle_window_dust
catacomb_alcove_candles_01
catacomb_alcove_candles_02
crystal
damage_fire
damage_screen
damage_shock
death
death_icy
dummy_light
dungeon_fire_pit
dungeon_wall_lantern
earthquake_dust
essence_air
essence_balance
essence_earth
essence_fire
essence_water
ethereal_blade
etherweed
floor_vent_steam
forest_falling_leaves
forest_fireflies
forest_lantern
forest_pit_fog
forest_underwater_bubbles
forest_underwater_plankton
frost_arrow
glitter
hit_blood
hit_blood_black
hit_dust
hit_firearm
hit_flame
hit_goo
hit_ice
hit_slime
hit_terracotta_jar
hit_wood
meteor_hammer
mine_ceiling_pit_light
mine_crystal
mine_support_ceiling_lantern
mine_support_lantern
particles.txt
party_crush
poisoned_monster
portal_effect
potion_of_dexterity
potion_of_strength
potion_of_vitality
potion_of_willpower
power_gem
power_gem_item
prison_ceiling_lamp
stunned_monster
swamp_fume
teleporter
tomb_wall_lantern
torch
uggardian_flames
witch_lantern
By examining the ones in the asset pack, and referencing the properties list below, one can define their own custom particle effects to use in the game.
Wiki wrote: https://github.com/JKos/log2doc/wiki/As ... systemdesc
  • emitterShape:type of the emitter, either “BoxShape” (default) or “MeshShape”.
  • emissionRate:number of particles to emit per second.
  • emissionTime:duration of emission in seconds. If set to zero, emission time is infinite.
  • maxParticles:maximum number of active particles. Sensible values are between 100 and 1000.
  • spawnBurst:if enabled maximum number of particles are emitted in a single burst when the particle system is started.
  • boxMin:a 3D vector defining the minimum extents for particle emission.
  • boxMax:a 3D vector defining the maximum extents for particle emission.
  • sprayAngle:a table whose first and second elements set the minimum and maximum spraying angle in degrees.
  • velocity:a table whose first and second elements set the minimum and maximum velocity in units per second.
  • size:a table whose first and second elements set the minimum and maximum size for for emitted particles.
  • lifeTime:a table whose first and second elements set the minimum and maximum lifetime for emitted particles.
  • texture:a valid texture asset reference. The texture may contain multiple frames laid out on a grid.
  • frameSize:(optional) pixel size of a frame in the particle animation sequence. Typically 32 or 64.
  • frameCount:(optional) total number of frames in the particle animation sequence.
  • frameRate:(optional) frame rate of the particle animation sequence.
  • color0:a table containing R,G,B values in range 0-1 for initial particle color.
  • color1,color2,color3:(optional) particle color sequence. These parameters have no effect if colorAnimation is not enabled.
  • colorAnimation:a boolean which enables particle color animation.
  • opacity:particle opacity value between 0 and 1.
  • fadeIn:particle’s fade in time in seconds.
  • fadeOut:particle’s fade out time in seconds.
  • gravity:a 3D gravity vector.
  • airResistance:air resistance parameter. Sensible values are between 0 and 10.
  • rotationSpeed:rotation speed of particles in degrees.
  • randomInitialRotation:a boolean flag, if enabled particles’ initial rotation angle is randomized.
  • blendMode:blending mode for particle rendering. Must be either “Additive” or “Translucent”.
  • objectSpace:a boolean flag, if enabled particles are emitted to object space rather than world space.
  • clampToGroundPlane:a boolean flag, if enabled particles collide against the ground.
  • depthBias:depth bias value in world space units.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

function earthquake()
if forest_plant_cluster_01_109 then
forest_plant_cluster_01_109:spawn('earthquake_dust')
end
end

I was hoping it would be simple like this, but it's not :p
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

You must create a particle component on the object, and assign it a particle system.
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Code: Select all

function earthquake()
	if forest_plant_cluster_01_109 then
		forest_plant_cluster_01_109:spawn("particle_system")
			.particle:setParticleSystem("earthquake_dust")
	end
end
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.
Post Reply