Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
It is not possible to remove items from SurfaceComponents or SocketComponents except by destroying the items or getting the player to click on the items and pick them up. Attempting to remove an item from one of these components via script (by destroying the Surface/SocketComponent, adding it to another surface/socket/inventory, using setMouseItem(), etc. etc.) will cause the savegame to permanently break and crash when the player tries to load it.
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.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
... But you can construct a duplicate of the item; as in the case of [seeming to move] item stacks, and custom magical items with partially used charges.
Re: Ask a simple question, get a simple answer
I need ask a grimtk related question, I will post here but link it in the grimtk thread.
If this is an easy thing and Ive just missed an obvious fix - pls correct me...
OK the issue is mouse clicking through grimtk windows / widgets .... and in doing so >> activating things from the vanilla game that I definitely do not want activzated (eg attack panel weapon swap buttons)
Ive read into (but am still not totally comfy with) the code from grimtk's script files.... I had suspected for a while that I could do some fancy widgetStack manipulation - but vanilla buttons don't register when grimtk checks and builds the widgetStack (any widgets directly underneath the mouse cursor). I also noticed but blanked on some of the mouse methods / fields such as:
self.visitWidget = function(self, gContext, widget)
self.commit = function(self)
self.mouseFocus
Im not entirely sure how these things interact - if anyone has an explanation of this that a cat could understand, pls send it my way
So, re-worded, my question is:
Can we prevent the mouse clicking through grimtk windows & widgets (and cease iatrogenically activating vanilla buttons / menu stuff) ??
If this is an easy thing and Ive just missed an obvious fix - pls correct me...
OK the issue is mouse clicking through grimtk windows / widgets .... and in doing so >> activating things from the vanilla game that I definitely do not want activzated (eg attack panel weapon swap buttons)
Ive read into (but am still not totally comfy with) the code from grimtk's script files.... I had suspected for a while that I could do some fancy widgetStack manipulation - but vanilla buttons don't register when grimtk checks and builds the widgetStack (any widgets directly underneath the mouse cursor). I also noticed but blanked on some of the mouse methods / fields such as:
self.visitWidget = function(self, gContext, widget)
self.commit = function(self)
self.mouseFocus
Im not entirely sure how these things interact - if anyone has an explanation of this that a cat could understand, pls send it my way
So, re-worded, my question is:
Can we prevent the mouse clicking through grimtk windows & widgets (and cease iatrogenically activating vanilla buttons / menu stuff) ??
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: Ask a simple question, get a simple answer
Artifacts of might: dm_resource_log2 asset pack has a particle called dm_waterdrops that's used in a cave-in ceiling
I'd like to make a placable object of these waterdrops to create a nonintrusive rain effect
I have the entire pack in my mod.
I was looking at the defineobject snow code from the winter set to make a similar object.
But I'm not sure how to proceed.
into
Would this work?
I'd like to make a placable object of these waterdrops to create a nonintrusive rain effect
I have the entire pack in my mod.
Code: Select all
defineParticleSystem{
name = "dm_waterdrops",
emitters = {
{
emissionRate = 16,
emissionTime = 0,
spawnBurst = false,
maxParticles = 64,
boxMin = {-1.0,-1,-1.0},
boxMax = {1.0,5,1.0},
sprayAngle = {178,180},
velocity = {8,10},
texture = "assets/textures/particles/glitter_silver.tga",
lifetime = {1, 4},
colorAnimation = false,
color0 = {0.42, 0.56, 0.7},
fadeIn = 0.5,
fadeOut = 0.5,
size = {0.01, 0.02},
gravity = {0,-12,0},
airResistance = 5,
rotationSpeed = 2,
blendMode = "Additive",
depthBias = -0.001,
clampToGroundPlane = true,
},
}
}
But I'm not sure how to proceed.
Code: Select all
defineObject{
name = "sx_snow_particles_1square",
components = {
{
class = "Model",
model = "mod_assets/sx_winter_tileset/models/sx_blocker.fbx",
},
{
class = "Controller",
},
{
class = "Particle",
ParticleSystem = "sx_snow_emitter_1x1",
--debugDraw = true,
},
},
placement = "floor",
replacesFloor = false,
editorIcon = 136,
}
Code: Select all
defineObject{
name = "waterdrops1",
components = {
{
class = "Particle",
ParticleSystem = "dm_waterdrops",
--debugDraw = true,
},
},
placement = "floor",
replacesFloor = false,
editorIcon = 136,
}
Re: Ask a simple question, get a simple answer
1) Is there a way to add a chance for a throwing item or missile ammo to convertToItemOnImpact ? Setting it to "true" always converts it, but I need a slight chance only for it to happen (e.g. attrition).
2) Fiddling with skill points via onEquipItem and onUnequipItem is bad, I know. How could I at least prevent the 5th skill point from getting removed when unquipping the item with a maxed out skill (concentration lvl 5)? Permanent removal of a skill point seems pretty bad.
Code: Select all
onThrowAttackHitMonster = function(self, monster)
if math.random() < 0.8 then
monster:setCondition("poisoned", 20)
end
end,
Code: Select all
onEquipItem = function(self, champion, slot)
if slot == 1 or slot == 2 then
champion:trainSkill("concentration", 1, false)
end
end,
onUnequipItem = function(self, champion, slot)
if slot == 1 or slot == 2 then
champion:trainSkill("concentration", -1, false)
end
end,
Re: Ask a simple question, get a simple answer
Hey Pompidom,Pompidom wrote: ↑Fri Aug 23, 2019 8:47 pm Artifacts of might: dm_resource_log2 asset pack has a particle called dm_waterdrops that's used in a cave-in ceiling
I'd like to make a placable object of these waterdrops to create a nonintrusive rain effect
I have the entire pack in my mod.
Would this work?
Ive used this texture file from the winter tileset
Code: Select all
texture = "mod_assets/sx_winter_tileset/textures/sx_raindrop_fx.tga",
SpoilerShow
Code: Select all
{
class = "Particle",
name = "rain",
particleSystem = "sx_rain_emitter_party_square",
onInit = function(self)
self:disable()
end
},
SpoilerShow
Code: Select all
defineObject{
name = "sx_rain_particles_1square",
tags = { "my_stuff" },
components = {
{
class = "Model",
model = "mod_assets/sx_winter_tileset/models/sx_blocker.fbx",
},
{
class = "Controller",
},
{
class = "Particle",
ParticleSystem = "sx_rain_emitter_party_square",
--debugDraw = true,
},
},
placement = "floor",
replacesFloor = false,
editorIcon = 136,
}
defineParticleSystem{
name = "sx_rain_emitter_party_square",
emitters = {
{
-- The hard particle cap (~5000 per emitter/system?) is
-- relevant here. You'll know if you hit it because the
-- entire emitter will stop.
-- XXX: in fact, this emitter might hit it if the
-- framerate goes below 3 FPS or so?
-- In my tests performance is mostly dependent on number
-- of pixel blends rather than particle count so I'm not
-- too worried about that - then again, I only have a
-- few different GPUs and I don't have the Grimrock
-- source.
emissionRate = 500,
emissionTime = 0,
maxParticles = 65535,
sprayAngle = {180,180},
velocity = {18,18},
-- Rotates with the party, so only make particles in
-- front of them. There's a bit of lag with turning but
-- it's like 50ms, I can't imagine anyone noticing it
-- without specifically looking for it.
-- The Y variation is necessary because otherwise the
-- particles fall in planes.
-- XXX: Since Grimrock does not have a fixed horizontal
-- FOV, the X span may not be wide enough at wide
-- (>16:9) aspect ratios.
boxMin = {-1,8,-1.6}, -- -1,8,-1
boxMax = {1,7,1}, -- 1,7,1
-- boxMin = {-8,4,0},
-- boxMax = {8,5,12},
texture = "mod_assets/sx_winter_tileset/textures/sx_raindrop_fx.tga",
frameSize = 256,
lifetime = {0.3,0.3},
color0 = {0.15, 0.2, 0.25},
opacity = 1,
fadeIn = 0.001,
fadeOut = 0.1,
size = {0.09, 0.09},
gravity = {0,0,0},
airResistance = 0.001,
rotationSpeed = 0.04,
blendMode = "Additive",
objectSpace = false,
randomInitialRotation = false,
},
}
}
Code: Select all
party.rain:enable()
party.rain:disable()
Akroma
NOTE** You will need to make arrangements for handling when the party is undercover but looking out at an area with rainfall
Last edited by akroma222 on Mon Aug 26, 2019 1:33 pm, edited 1 time in total.
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: Ask a simple question, get a simple answer
Lorial,Lorial wrote: ↑Sun Aug 25, 2019 10:06 am 2) Fiddling with skill points via onEquipItem and onUnequipItem is bad, I know. How could I at least prevent the 5th skill point from getting removed when unquipping the item with a maxed out skill (concentration lvl 5)? Permanent removal of a skill point seems pretty bad.
Code: Select all
onEquipItem = function(self, champion, slot) if slot == 1 or slot == 2 then champion:trainSkill("concentration", 1, false) end end, onUnequipItem = function(self, champion, slot) if slot == 1 or slot == 2 then champion:trainSkill("concentration", -1, false) end end,
Cant help with (1) but for (2), this is what you are looking for.
There are links to scripts that will manage traits and stat adding and removing too
viewtopic.php?f=22&t=9024&p=88389&hilit ... ger#p88389
Akroma
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
- Zo Kath Ra
- Posts: 937
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Ask a simple question, get a simple answer
This rock becomes gravity-less when thrown or launched.
But you can also do something when it lands, e.g. destroy the rock and create a new item at the rock's location.
The code works even when you set:
sharpProjectile = true
Code: Select all
defineObject{
name = "rock_weightless",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/rock.fbx",
},
{
class = "Item",
uiName = "Rock",
gfxIndex = 45,
impactSound = "impact_blunt",
stackable = true,
projectileRotationSpeed = 10,
projectileRotationZ = -30,
weight = 0.7,
traits = { "throwing_weapon" },
--sharpProjectile = true,
},
{
class = "ThrowAttack",
attackPower = 4,
cooldown = 4,
},
{
class = "AmmoItem",
ammoType = "rock",
},
{
class = "Timer",
currentLevelOnly = true,
timerInterval = 0,
onActivate = function(self)
if (self.go.counter:getValue() == 0) and self.go.projectile then
print("projectile launched", Time.currentTime())
self.go.projectile:setGravity(0)
elseif (self.go.counter:getValue() == 1) and (self.go.projectile == niL) then
print("projectile landed", Time.currentTime())
end
if self.go.projectile then
self.go.counter:setValue(1)
else
self.go.counter:setValue(0)
end
end,
},
{
class = "Counter",
},
},
tags = { "weapon", "weapon_throwing" },
}
Re: Ask a simple question, get a simple answer
How would you go about using multiple auto map icons for an object? Like water for example.