Page 265 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 03, 2018 1:10 pm
by Pompidom
This is my script of the buildings rising from the ground:

https://youtu.be/mTkSqOZgYro

Code: Select all

startHeight = 0
dir = 0
posY = -1

function risingbuilding()
	
	local spinner = findEntity("mausoleum_stairs_down_3")
	
	if posY < startHeight then
		posY = posY + 0.002
		spinner:setPosition(script_entity_78.x, script_entity_78.y, dir, posY, script_entity_78.level)
	
	end
end
Now I want this movement script converted to a script that moves stuff horizontally so I can let a ship float by

https://youtu.be/YvP8WzlJX08

But I have no idea how to, I tried changing posY into posX, doesn't work offcourse and the ship keeps floating upwards instead of horizontally. I'm out of ideas :) Help!

Code: Select all

startHeight = -1
dir = 0
posX = 0

function shipmove1()
	
	local spinner = findEntity("sx_ship_rear_hull_2")
	
	if posX > startHeight then
		posX = posX + 0.002
		spinner:setPosition(script_entity_131.x, script_entity_131.y, dir, posX, script_entity_131.level)
	
	end
end
Any kind of code to let me move objects horizontally will do as long it's not too complicated.
It's just for visual from a distance, no need to walk on it or savestate compatibility or any other interaction.

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 03, 2018 2:18 pm
by Pompidom
minmay wrote: Sat Nov 03, 2018 2:59 am

Code: Select all

function earthquake()
	if forest_plant_cluster_01_109 then
		forest_plant_cluster_01_109:spawn("particle_system")
			.particle:setParticleSystem("earthquake_dust")
	end
end
Excellent!

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 03, 2018 8:49 pm
by Isaac
Pompidom wrote: Sat Nov 03, 2018 1:10 pm But I have no idea how to, I tried changing posY into posX, doesn't work offcourse and the ship keeps floating upwards instead of horizontally. I'm out of ideas :) Help!
The variable posX (or Y) is just a name for the value. The operative change in the function is where posX is given to setPosition. As the fourth argument, it is changing the object's elevation. If you want to instead move it East & West, add posX to script_entity_131.x . For North & South add it to script_entity_131.y; diagonals require adding it to both.

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 03, 2018 9:57 pm
by Pompidom

Code: Select all

posY = 0

function moving boat()
	
	posY = posY + 0.01
	sx_ship_rear_hull_2:setWorldPosition(posY,-3,30,0)

end
This is what I was looking for all along :lol: lol :)

You could have saved me the trouble by snipping off all the useless code :p

It took me 2 hours to turn all that useless junk into this simple thing lol.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 04, 2018 2:38 am
by Isaac
Pompidom wrote: Sat Nov 03, 2018 9:57 pm You could have saved me the trouble by snipping off all the useless code :p

It took me 2 hours to turn all that useless junk into this simple thing lol.
That will crash if if cannot find sx_ship_rear_hull_2

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 04, 2018 3:15 am
by minmay
It also won't work properly because it doesn't account for the variable framerate. You need to multiply velocities by Time.deltaTime(), otherwise they will move at different speeds at different framerates.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 04, 2018 10:58 am
by Pompidom
Isaac wrote: Sun Nov 04, 2018 2:38 am
That will crash if if cannot find sx_ship_rear_hull_2
[/quote]

Every timer/script/button/counter etc... Gets disabled once the puzzle/construction/visual shows are done.
I'm careful about that stuff.
They can't be picked up or destroyed or used, when the script is running.
And I bugtest immediately once I have made a construction for possible random stuff a player might do that is not intentional.
I should be fine :)

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 04, 2018 12:25 pm
by Pompidom
Boat sailing down a river.

I still have to add moving floors to it to cover up the water.

https://youtu.be/OsTiI2zhnzM

I was thinking about making a static boat like the one I'm standing on now.
This one doesn't move at all in a body of water, but all the rest moves backwards.

So rocks and another boat move backwards alongside the boat in a map with only sea around you giving you the illusion that you're actually making a sea trip on a boat. Add a thunderstorm, make it night, add some lightning :)
You walk around on the boat, talk to some npc's. Then your boat crashes against a big rock.
Screen shake, fade out and you wake up on a deserted island, this would be a great interactive intro for anyone that makes a mod where you are shipwrecked.

You can even make a pirate ship attack your boat with ratlings firing cannons where your boat starts sinking :D

Or an airship with balloons. Make trees and hilltops move backwards underneath you. Just introduce some fog so you can't see too far, so the illusion doesn't break. you can keep the voyage last endlessly since the boat/airship doesn't move and make the same rocks loop alongside the transport ad infinitum. You need to solve a puzzle on the boat or airship. As soon the puzzle is solved the "landing scene" is initiated. Out of the fog comes your destination towards the boat. Big items like background_hill and a dock or something with an exotic castle facade.

as soon the boat is landed you're instantly teleported to an identical looking real map by an invisible teleporter.

EDIT: Quickly made something in 5 minutes time :) Enjoy!

https://youtu.be/HHk44J67Z_M

Sidestepping that rock at 0:44 gave me another idea.

A minigame/puzzle where you have to sidestep left and right with spiked contraptions moving towards you or walls and ceilings comming down on you.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 04, 2018 8:08 pm
by Pompidom
G1 asset pack contains mine materials like for example a minecart.
I have activated the entire G1 pack in my mod.
I can't find the minecart in my editor

Do I need to create a defineobject with the material or something?

Edit: in the g1.lua file the connection is made to the folder Mine_weapons?

https://ibb.co/e20dQ0

please tell me how to proceed :)

Re: Ask a simple question, get a simple answer

Posted: Mon Nov 05, 2018 10:30 pm
by Pompidom
When you create a map that's bigger than 32x32

https://ibb.co/m0QoA0

Is it compatible with the ingame map in the .dat file?