Page 229 of 396

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 06, 2018 11:49 pm
by minmay
Looks like the UV map for your bushes goes from the bottom of the texture to the very top. This is causing the texture to wrap around slightly when viewed at some angles from some distances. You can fix this by changing the textureAddressMode of the material to clamp on that axis. For example, the blue_beam material in the standard assets uses textureAddressMode = "WrapU_ClampV_ClampW".

Re: Ask a simple question, get a simple answer

Posted: Sat Apr 07, 2018 10:59 pm
by kelly1111
Thanks minmay the textureadressmode fixed my problem.

Re: Ask a simple question, get a simple answer

Posted: Sat Apr 07, 2018 11:17 pm
by Zo Kath Ra
Khollik wrote: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
What makes a boss fight a boss fight?

Without the health bar, it's just the bossName and music.
When all monsters are dead, or when you go to another level, the bossName disappears and the music stops playing.

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 09, 2018 2:43 pm
by Khollik
Hello Zo Kath Ra

Thanks for your answer. I suppose, indeed that I could do without launching a bossfight, but precisely I like the idea of changing the music during the fight and I didn't figure out yet how to change the music track in a dungeon whithout using the bossfight. Besides, I didn't find anything in the bossfight asset that could help me understand how it works.

Code: Select all

defineObject{
	name = "boss_fight",
	components = {
		{
			class = "BossFight",
		},
		{
			class = "Controller",
			onActivate = function(self)
				self.go.bossfight:activate()
			end,
			onDeactivate = function(self)
				self.go.bossfight:deactivate()
			end,
		},
	},
	placement = "floor",
	tags = { "scripting" },
	editorIcon = 280,
}

So one question leading to another one, is it something hardcoded or is there a way to change the ambient track directly?

Cheers
Khollik

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 09, 2018 3:48 pm
by lostsol

So one question leading to another one, is it something hardcoded or is there a way to change the ambient track directly?

Cheers
Khollik
GameMode.playStream(name)

Re: Ask a simple question, get a simple answer

Posted: Mon Apr 09, 2018 6:00 pm
by Khollik
Great, thanks a lot Iostsol!! :P

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 19, 2018 2:01 am
by Mysterious
Hi all.

There is a problem with: GameMode.setEnableControls(false) . If you activate this function while sleeping eg: pressing the movement keys it stops the rest cycle but you still cannot move or use the mouse until you do this: GameMode.setEnableControls(true).

When the rest cycle is stopped you can see daylight or night but your still resting until you use the above function again.

What im trying to do is make a bed when clicked on player goes into the rest function and it plays a snoring sound. I don't want the player to move or unrest till the sound has finished. The sound runs for 7 seconds. It all works but when you click on the bed and rest it goes dark but, if you hit any of the movement keys you wake up and you can see the daylight but, you still see the zzzzzz's like your still resting.

Code: Select all

defineObject{
	name = "grim_bed_2",
	baseObject = "base_obstacle",
	tags = { "furniture" },
	components = {
		{
			class = "Model",
			model = "mod_assets/grim_assets/grim_bed_2.fbx",
			staticShadow = true,
		},
		{
			class = "Clickable",
			offset = vec(0, 0, 0), --0,1.375,0
			size = vec(2.5, 1, 1), ---0.5,0.2,0.2
			maxDistance = 1,
			debugDraw = true,
			onClick = function(self)
			GameMode.setEnableControls(false)
			delayedCall("miscel_script", 6, "sleep1")
				playSound("snor1")
					party.party:rest()
			end,
			},
		}
	}
Script in Mod:

Code: Select all

function sleep1()
GameMode.setEnableControls(true)
end

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 19, 2018 8:04 pm
by Zo Kath Ra
I don't know if you can prevent the player from waking up the party.
But you can make it so that waking up always re-enables the controls.

Connect a button to sleepStart.
Connect timer_1 to counter_1.
Connect counter_1 to sleepEnd.

You wanted the party to sleep for 7 seconds.
Time runs faster while you're sleeping, so you'll have to experiment with timerInterval and counter value.

edit:
This code only prevents the player from waking up with mouse clicks.

Code: Select all

function initParty()
	party.party:addConnector("onWakeUp", self.go.id, "partyWakeUp")
end

function sleepStart()
	GameMode.setEnableControls(false)
	party.party:rest()
	
	counter_1.counter:reset()
	timer_1.timer:start()
end

function sleepEnd()
	party.party:wakeUp(false)
end

function partyWakeUp()
	timer_1.timer:stop()
	GameMode.setEnableControls(true)
	hudPrint("The party has woken up!")
end

initParty()

Re: Ask a simple question, get a simple answer

Posted: Thu Apr 19, 2018 11:20 pm
by Curunir
How would I go about checking to see if the party is within a certain range of map coordinates (let's say a 4x4 grid at x16-19 and y16-19, one tile away from a fountain model) and if they are, execute a script?

The purpose is to have something similar to how the horn works, but have Action X trigger Y when party is in a looser, simply "close proximity" to an object in the world.

Re: Ask a simple question, get a simple answer

Posted: Fri Apr 20, 2018 6:00 am
by Isaac
Curunir wrote:How would I go about checking to see if the party is within a certain range of map coordinates (let's say a 4x4 grid at x16-19 and y16-19, one tile away from a fountain model) and if they are, execute a script?
One way is to place party-only activated floor-triggers in every tile in the region; tiles that all connect to the same script. You can inspect the the triggers to learn the exact location, if useful to you.

An alternative scripted method:

Code: Select all

--Place script_entity at top left of region.
--Set values of regionX, and regionY to the number of columns & rows to check 


party.party:addConnector('onMove', self.go.id, "positionCheck")
region_active = true
regionX, regionY = 7,7 

function positionCheck() 
	if region_active then
		local width, height = party.x +regionX, party.y +regionY
	
		if (party.x >= self.go.x and party.x <= width) and (party.y >= self.go.y and party.y <= height)
		 then
			--=======================================[ triggered actions ]
			
			
			print('Party is in region.')
			party:spawn("shockburst").tiledamager:setAttackPower(1)
			
			
			--============================================================
		end
	end
end

function setActive(self, bool)
	if type(bool)=="boolean" then region_active = bool return end
	if type(self)=="boolean" then region_active = self return end
	region_active = not region_active
end