Page 226 of 396

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 12:07 am
by Badgert
Many thanks! This is exactly what I need!

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 10:03 am
by kelly1111
I have a newbisch question about posting images on this forum. Somehow I cannot get it to work. I can get a link working to a picture (see my dirt cave post) but not the picture directly on the forum.
I want to post some more pictures. How to do this?

I am using imgur.

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 10:08 am
by Isaac
Image

If you can see this image, then depending on your browser, you can copy the image link by right-clicking the image (and choosing the correct option), or taking it from the URL address bar. On the imgur website, clicking the image (to zoom) takes you to a direct file URL. You can copy that from the address bar, and paste it into an img tag, on the forum.

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 10:23 am
by Mysterious
Hi all again.

Ok im trying the Script from Skuggs for night and day time actions. What I would like to do is if its 6Pm then the doors shut and if its 7am the doors open.

The Door Code Object:

Code: Select all

defineObject{
	name = "sx_swingdoor_clickable",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/doors/swingdoor.fbx",
			offset = vec(0,1.375,0),
		},
		{
			class = "Model",
			name = "door_logic",
			model = "assets/models/env/dungeon_secret_door.fbx",
			enabled = false
		},
		{
			class = "Animation",
			animations = {
				activate = "mod_assets/animations/swingdoor_open.fbx",
				deactivate = "mod_assets/animations/swingdoor_close.fbx",
			},
		},
		{
			class = "Door",
			sparse = true,
			killPillars = false,
			openVelocity = 10,
			closeVelocity = 0,
			closeAcceleration = -10,
			openSound = "silent",
			closeSound = "silent",
			lockSound = "silent"
		},
		{
			class = "Clickable",
			maxDistance = 1,
			-- offset vector is the point where begin the clickable box
			offset = vec(0,1.3,0),
			-- size is the size of our clickable box
			size = vec(2.5,2.5,0.3),
			onClick = function(self)
				if self.go.door:isClosed() then
					self.go.controller:open()
				else
					self.go.controller:close()
				end
			end
		},
		{
			class = "Controller",
			onOpen = function(self)
				self.go.door:open()
				playSound("lever") --Change to what you want
				self.go.animation:play("activate")
			end,
			onClose = function(self)
				self.go.door:close()
				playSound("lever") --Change to what you want
				self.go.animation:play("deactivate")
			end,
			onToggle = function(self)
				if self.go.door:isClosed() then
					self.go.controller:open()
				else
					self.go.controller:close()
				end
			end,
		},
	},
	placement = "wall",
	editorIcon = 124,
	tags = { "doors" },
}

Night and Day Code (in editor):

Code: Select all

function nightdoors2() 
    if GameMode.getTimeOfDay() > 1.04 and GameMode.getTimeOfDay() < 1.97 then
   		sx_swingdoor_clickable_3.clickable:disable()
  		sx_swingdoor_clickable_3.controller:disable()
else
  		sx_swingdoor_clickable_3.clickable:enable()
  		sx_swingdoor_clickable_3.controller:activate()
   end
end
What happens is the door is unuseable at night but when the day cycle come back I cannot open the door. I have set a timer on to check 0.1 seconds. I don't know what I have done wrong here?

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 9:27 pm
by Zo Kath Ra
Mysterious wrote:Night and Day Code (in editor):

Code: Select all

function nightdoors2() 
    if GameMode.getTimeOfDay() > 1.04 and GameMode.getTimeOfDay() < 1.97 then
   		sx_swingdoor_clickable_3.clickable:disable()
  		sx_swingdoor_clickable_3.controller:disable()
else
  		sx_swingdoor_clickable_3.clickable:enable()
  		sx_swingdoor_clickable_3.controller:activate()
   end
end
What happens is the door is unuseable at night but when the day cycle come back I cannot open the door. I have set a timer on to check 0.1 seconds. I don't know what I have done wrong here?
Replace
sx_swingdoor_clickable_3.controller:activate()
with
sx_swingdoor_clickable_3.controller:enable()

Or you can just leave out the calls to the sx_swingdoor_clickable_3.controller methods.

Re: Ask a simple question, get a simple answer

Posted: Mon Mar 26, 2018 11:05 pm
by Isaac
I think that rather than have it set to 0.1, that you could probably just as well set your timer to 180, or 360.
It could save an awful lot of —guaranteed failure— time checks.

Or you could perhaps check or set the time when the game loads, and set the timer to the exact delay that you need.

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 27, 2018 12:44 am
by minmay
Isaac wrote:I think that rather than have it set to 0.1, that you could probably just as well set your timer to 180, or 360.
It could save an awful lot of —guaranteed failure— time checks.
The performance impact of this is utterly irrelevant.
Isaac wrote:Or you could perhaps check or set the time when the game loads, and set the timer to the exact delay that you need.
Except time of day doesn't work that way. It increments when the party moves or turns, not with real-time.

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 27, 2018 1:00 am
by Isaac
minmay wrote:
Isaac wrote:I think that rather than have it set to 0.1, that you could probably just as well set your timer to 180, or 360.
It could save an awful lot of —guaranteed failure— time checks.
The performance impact of this is utterly irrelevant.
Is it? I will take your word for it; it still seems a waste to make that check ten times a second for half of the day.
Isaac wrote:Or you could perhaps check or set the time when the game loads, and set the timer to the exact delay that you need.
Except time of day doesn't work that way. It increments when the party moves or turns, not with real-time.
I never liked that part about it. It seems to me that the time should pass even when squandered by loitering. I suppose it is to obfuscate the —much faster than realistic— passage of time during the game.

Re: Ask a simple question, get a simple answer

Posted: Tue Mar 27, 2018 5:55 pm
by bongobeat
minmay wrote:
bongobeat wrote:Well I didn't know that you can have (and should) only one. But what is the matter when using 5 water_surface_component on the same map? Except for the issue of reflection.
The game only has one reflection buffer. The only things you accomplish by having multiple WaterSurfaceComponents on the same level are:
1. You make it difficult to know which WaterSurfaceComponent will be used to calculate the reflection buffer. This is bad.
2. You make performance slightly worse. This is also bad.

Note that WaterSurfaceComponent isn't really affected by disabling it. You should remove the components entirely, not just disable them.
ok, understood!
well this is corriged then. Thank you!

Re: Ask a simple question, get a simple answer

Posted: Fri Mar 30, 2018 4:25 am
by Mysterious
Hi al.

Thank you for the (door) help :) Someone said to me there was a way you could load a save game into your new mod eg: Legends 1 - and when you finish this game you can continue to Legends 2 - with the same equipment, skils etc....

My question is. Is it possible and where might I find the code for this function?
Than you :)