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
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Is there a way to avoid the burning condition animation on already dead monsters ?

I have a few spells that burn monsters to fix, for example:

Code: Select all

defineObject{
  name = "volcanic_eruption",
  baseObject = "base_spell",
  components = {
    {
      class = "Particle",
      particleSystem = "volcanic_eruption",
      offset = vec(0, 1.3, 0),
      destroyObject = true,
    },
    {
      class = "Light",
      color = vec(1, 1, 1),
      brightness = 10,
      range = 6,
      offset = vec(0, 1.3, 0),
      fadeOut = 0.75,
      disableSelf = true,
      fillLight = true,
    },
    {
      class = "TileDamager",
      attackPower = 10,
      damageType = "fire",
      onHitMonster = function(self, monster)
        if monster:isAlive() then
          monster:setCondition("burning", 5)
          -- mark condition so that exp is awarded if monster is killed by the condition
          local burning = monster.go.burning
          local ordinal = self:getCastByChampion()
          if burning and ordinal then burning:setCausedByChampion(ordinal) end
  
          monster:setCondition("poisoned", 25)
          -- mark condition so that exp is awarded if monster is killed by the condition
          local poisonedCondition = monster.go.poisoned
          if poisonedCondition and ordinal then poisonedCondition:setCausedByChampion(ordinal) end
        end
      end,
    },
  },
}
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Is there a way to get the current condition of a monster? In my case I want to do something if a certain type of monster is burning.

I could use a timer and check for the condition of a all living monster of that type but is there a more elegant, more resource saving way? Is there some kind of onUpdate event with monsters that could trigger my script?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

THOM wrote:Is there a way to get the current condition of a monster? In my case I want to do something if a certain type of monster is burning.
Is this for a specific monster, or any random monster that's on fire?

If a random target, the Projectile, Bomb, and Tiledamager components each have hooks that can tell you what monster was hit by them, and from there those can be checked for the burning condition.

If it's a specific monster, then you can use the onDamage hook to check for the burning condition, (each time it's damaged).
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Monster conditions are all implemented as Components. Just check the monster's object for the existence of a component called "blinded", "burning", "entangled", "frozen", "poisoned", "sleep", or "stunned".
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
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

Was playing on a custom dungeon, and I received a D3DError, but only when the 'Texture Resolution' option was set to low.
What's causing this?
My asset pack [v1.10]
Features a bit of everything! :D
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Texture with missing mipmaps.
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.
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

I have a question about:

the swamp dungeon fog object.
When I disable the fog particles I get a nice green haze all across the level. how is this haze replicated in another object?
what i want is an object that doesnt fill the whole level with the haze, like the swamp dungeon fog does.
anyone have any suggestions on how to make it ?
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Well - why don't you copy over the Definition of the swamp-fog-object, rename it and delete the particle-component, that you don't want?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

You want FogParamsComponent.
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
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Is it possible to search for enteties not on the current level?

Because this

Code: Select all

for e in party.map:allEntities() do
would search on the level the party is on. What do I have to use if I want to search in a specific other level?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Post Reply