Page 116 of 400

Re: Ask a simple question, get a simple answer

Posted: Wed Mar 30, 2016 6:26 pm
by Zo Kath Ra
zimberzimber wrote:
minmay wrote:They aren't. Custom conditions were added in 2.2.4.
Alright, is there somewhere I can view an example of a condition to use as a reference for creating a new one? (if possible)
The only example I've been able to find:
https://github.com/JKos/log2doc/wiki/Asset-Definitions

Re: Ask a simple question, get a simple answer

Posted: Wed Mar 30, 2016 7:57 pm
by zimberzimber
Zo Kath Ra wrote:The only example I've been able to find:
https://github.com/JKos/log2doc/wiki/Asset-Definitions
Oh this is perfect, thanks a lot!

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 6:47 pm
by AndakRainor
Is it possible to combine a beach_ocean object and the under water effect of the water_surface object ? The goal is to build a map with water and no border walls.

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 8:01 pm
by Isaac
AndakRainor wrote:Is it possible to combine a beach_ocean object and the under water effect of the water_surface object ? The goal is to build a map with water and no border walls.
For an Island with a full beach perimeter? (and/or inland underwater areas?)

I have one of those; but I did not add underwater areas inland.

I have used both water objects at once before, but IRRC, the Ocean waves interfere when they overlap submerged inland areas. On one map, I handled this by rotating the Ocean object ~to prevent overlaps while submerged; though one could enable/disable the model component I suppose.

The full 360° beach will likely require at least two Ocean objects. For my island, I had to use shipwrecks to cover the seams.

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 8:15 pm
by AndakRainor
I use a scaled up model of ocean_water.model in my mod, with doubled dimensions. It is enough to cover an open island map, and the waves size is not bad.

What is missing for the map I try to build, is under water zones rendering. I should get the very dense blue fog effect of normal water tiles and the water_surface_underwater material when looking at the water surface from below. For the fog I am currently messing with sky fog dynamic updating.

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 10:26 pm
by minmay
Use a WaterSurfaceComponent with no WaterSurfaceMeshComponent and make sure your tiles have "underwater = true".
minmay wrote:Whether the party (or a monster or item) is considered underwater or not actually has nothing to do with the water surface or water surface mesh object. It is tied solely to whether they are in a tile with the "underwater" flag and at a low enough world y position at the same time. You can even use the heightmap to let the party wade slowly into water (although the water shader looks incredibly bad when camera y is close to the plane y, so you don't want to do that).
What often trips people up is that the planeY value in the WaterSurfaceComponent determines the y position of the reflection plane. Generally you want this to be the same as the y position of the water plane, since objects are supposed to appear to reflect off the water, but I can imagine exceptions.
You might need to add an underwater side to your mesh, I forget.

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 10:51 pm
by THOM
I am trying to remove all weappons from my party.

Am am using the following function but it won't work.

I am sure I am missing something obvious again, but I can't figure out, what:

Code: Select all

function removeWeappons()

local weaptrait = { "light_weapon", "sword", "daggers", "weapon", "heavy_weapon", "mace", "axe", "two_handed", "firearm", "spear", "missile_weapon", "throwing_weapon", "wand" }

	for i=1,4 do
		local ch = party.party:getChampion(i)
		for a=1,32 do
			local cItem = ch:getItem(a)
			if cItem and cItem.go.item:hasTrait(weaptrait) ~= nil then	
				cItem:destroyDelayed()
			end
		end
	end
end

*next step would be to remove also weappons inside of containers, but that's another story...

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 11:31 pm
by AndakRainor
A few things:
- your cItem variable references an item component, so "cItem.go.item" is just cItem, more direct that way :)
- so cItem:hasTrait(weaptrait) return a boolean for your test, "~= nil" is useless!
- destroying an item will work only for game objects (=> cItem.go:destroyDelayed(), not cItem directly) on the map (or in containers on the map iirc) so this won't work for champions inventories; you should use "ch:removeItemFromSlot(a)"

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 11:33 pm
by Zo Kath Ra
You're passing a table to cItem.go.item:hasTrait(weaptrait)
but hasTrait expects a string (AFAIK, might be wrong)

cItem.go.item:hasTrait(weaptrait)
is the same as
cItem:hasTrait(weaptrait)

Re: Ask a simple question, get a simple answer

Posted: Thu Mar 31, 2016 11:38 pm
by AndakRainor
minmay wrote:Use a WaterSurfaceComponent with no WaterSurfaceMeshComponent and make sure your tiles have "underwater = true".
minmay wrote:Whether the party (or a monster or item) is considered underwater or not actually has nothing to do with the water surface or water surface mesh object. It is tied solely to whether they are in a tile with the "underwater" flag and at a low enough world y position at the same time. You can even use the heightmap to let the party wade slowly into water (although the water shader looks incredibly bad when camera y is close to the plane y, so you don't want to do that).
What often trips people up is that the planeY value in the WaterSurfaceComponent determines the y position of the reflection plane. Generally you want this to be the same as the y position of the water plane, since objects are supposed to appear to reflect off the water, but I can imagine exceptions.
You might need to add an underwater side to your mesh, I forget.
I did it that way for the water surface, and used the sky object for the fog (not ideal I think):

Code: Select all

defineObject{
  name = "big_ocean",
  components = {
    {
      class = "Model",
      model = "mod_assets/models/env/ocean_water_big.fbx",
      offset = vec(0, -1.2, 0),
      renderHack = "ForceZWrite",
      sortOffset = 100000,  -- force water rendering before other transparent surfaces
    },
    {
      class = "Model",
      name = "bottom",
      model = "assets/models/env/water_bottom.fbx",
      offset = vec(0, -2, 0),
    },
    {
      class = "WaterSurface",
      planeY = -1.2,
      fogColor = vec(0.042, 0.09, 0.26) * 0.5,
      fogDensity = 0.2,
      reflectionColor = vec(0.77, 0.9, 1.0) * 0.9,
      refractionColor = vec(1,1,1),
    },
    {
      class = "Timer",
      timerInterval = 0,
      triggerOnStart = true,
      onActivate = function(self)
        if party:getWorldPositionY() < self.go:getWorldPositionY()-1.2 then
          if self.go.model:getMaterial() ~= "water_surface_underwater" then
            self.go.model:setMaterial("water_surface_underwater")
          end
        else
          if self.go.model:getMaterial() ~= "ocean_water" then
            self.go.model:setMaterial("ocean_water")
          end
        end
      end,
    },
  },
  placement = "floor",
  dontAdjustHeight = true,
  editorIcon = 264,
  reflectionMode = "never",
}