Page 228 of 396

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 05, 2018 8:31 pm
by kelly1111
Does anyone know why this is happening? Why do I get the black tiles behind my object? .. not from all sides when I walk around it.

Image

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 05, 2018 8:47 pm
by Isaac
I don't see it in the image you've posted.

EDIT:
**Aha... The image you've posted gets the right half cut off in the forums. You might post it again at half size.

Just looking at it, my guess is that you've modified an existing object to make your new one, but without changing its original occlusion mesh to match the new appearance. Occlusion meshes (more or less) tell the engine to not bother rendering anything behind the contour of the foreground
model.

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 05, 2018 10:04 pm
by akroma222
lostsol wrote: Here is what I'm working with:
SpoilerShow

Code: Select all

defineTrait{
     name = "no_regen",
     uiName = "",
     icon = 0,
     description = "",
     hidden = true,
     onRecomputeStats = function(champion, level)
          if level > 0 then
               champion:addStatModifier("energy_regeneration_rate", -100)
               champion:addStatModifier("health_regeneration_rate", -100)
         end
     end,
}
Also, I did not mention this in my original post. Focusing on Energy, with a Willpower attribute score of 10, this function works perfectly. Below 10 and the champion actually slowly loses energy. Beyond 10 and regeneration starts happening again, although at a very slow rate, like 1 point every 1-2 minutes. I really, really hope I'm doing something boneheaded here..
Hey lostsol,
Im half way through writing (and now testing) my reply but wont be able to finish everything up in time (vacation time :) )
I will PM you what I have done so far though 8-)

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 2:21 am
by lostsol
I have a script in the works and have a question regarding variables.

Have a look:
SpoilerShow

Code: Select all

onAttack = function(self, champion, slot)
				local clip = self.go.firearmattack:getClipSize()
				local load = self.go.firearmattack:getLoadedCount()
				local count = (self.go.firearmattack:getClipSize() - self.go.firearmattack:getLoadedCount())
				local item
				local stack
				for i=1,ItemSlot.MaxSlots do
					item = champion:getItem(i)
					if item and item:hasTrait("arc") then
						stack = item.go.item:getStackSize()
					break
					end
					end
					if stack and stack > count then
						self.go.firearmattack:setLoadedCount(clip)
						item.go.item:setStackSize(stack - count) elseif
					stack and stack <= count then
						self.go.firearmattack:setLoadedCount(load + stack)
						item.go.item:setStackSize(0)
					end
				playSound("firearm_jammed")	
			end,
My concern is with serialization. I have read all I could find on these forums regarding serialization but it's still a little unclear. From my understanding, what I've got going on here is some up values to variables. I'm not sure if doing this is "safe".

With my mod exported, I have tested this script as much as I could stomach. Trying different combinations of firing off rounds, reloading the firearm, saving the game, loading the game. I have yet to produce an error, however, I am not 100% convinced that the potential for error does not exist, and I do not want to implement the script if that is the case.

Thanks !

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 3:16 am
by minmay
The code you posted does not contain any functions with upvalues. An upvalue is a local variable that is declared outside of a function that references it.

Code: Select all

function a() -- Function does not have upvalues
  local x = "cat"
  print(x)
end

y = "dog"
function b() -- Function does not have upvalues
  print(y)
end

local z = "goat"
function c() -- Function has an upvalue!
  print(z)
end

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 3:19 am
by Mysterious
Hi all :)

Ok im trying to create and candle that acts like a torch. With the below script I have the candle model thxs (THOM) and the 2d icon. The problem im having is when you pick up the candle it goes invisible there is no candle 2d icon on the mouse. If I place the candle on the handle icon there is no candle icon and the hand picture disappears. I'm not sure what's going wrong please help ty :)

I think it has something to do with:
{
class = "TorchItem",
fuel = 1100,
},

Candle Script:

Code: Select all

defineObject{
	name = "candle",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/objects/models/candle.fbx",
			staticShadow = true,
		},
		{
			class = "Item",
			uiName = "Candle",
			description ="Candle.",
			gfxAtlas = "mod_assets/textures/other_items_atlas/custom_icon_atlas.tga",
			gfxIndex = 25,
			weight = 3.0,
			fitContainer = false,
		},
		{
			class = "TorchItem",
			fuel = 1100,
		},
		{
			class = "Light",
			range = 3.5,
			color = vec(1.1, 0.68, 0.35),
			brightness = 7,
			castShadow = true,
			staticShadows = true,
			staticShadowDistance = 0,
			shadowMapSize = 256,
			fillLight = true,
			--offset = vec(0, 0.46, 0),
			onUpdate = function(self)
				local noise = math.noise(Time.currentTime()*3 + 123) * 0.5 + 0.9
				self:setBrightness(noise * 10)
			end,
		},
		{
			class = "Particle",
			particleSystem = "single_candle",
		},
	},
}

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 6:43 am
by lostsol
minmay wrote:The code you posted does not contain any functions with upvalues. An upvalue is a local variable that is declared outside of a function that references it.
Ahh I see now, my thinking was way off. I thought that "local stack", and then later "stack = ..." was an upvalue. Anyway, thanks for the explanation and examples.

Mysterious wrote:Hi all :)
Ok im trying to create and candle that acts like a torch. With the below script I have the candle model thxs (THOM) and the 2d icon. The problem im having is when you pick up the candle it goes invisible there is no candle 2d icon on the mouse. If I place the candle on the handle icon there is no candle icon and the hand picture disappears. I'm not sure what's going wrong please help ty :)
I would guess that your gfxAtlas and / or gfxIndex is pointing to the wrong place.

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 5:35 pm
by Khollik
Hello

I'm looking for a way to not make the health bar appear during a boss fight (so the fight would be more stressful...). Does anyone know how to do it? Until now, I didn't find out :roll:

Thanks
Khollik

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 10:38 pm
by kelly1111
Hello guys... another texture /blender question. Why am I seeing these lines (black lines) on top of my billboard bushes..
and how to get rid of them

Image


Image

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 10:58 pm
by Isaac
Do you have doubled vertices in those models?