Nifflas' Support Forum

Level Editing Support => Knytt Stories Level Editing Support => Knytt Stories - Custom Content => Topic started by: GrayFace on October 15, 2011, 22:00:32

Title: Template objects for KS Ex
Post by: GrayFace on October 15, 2011, 22:00:32
Object templates introduced in KS Ex (http://nifflas.lpchip.nl/index.php?topic=4253.msg47407#msg47407) are like an advanced version of custom objects.
In this thread I'll explain how to use and make these objects and here will be a collection of template objects for public use. Please post your objects. When you post objects here and don't tell otherwise, it is assumed that anyone is free to use and modify them as long as proper credit is given and the derivative work is non-profit and KS-related.

Using Template Objects

First, download the archive of all objects: https://www.dropbox.com/s/juvg3yygsnrj8g4/Template%20Objects.rar?dl=1
Then copy objects you want to include into Objects subfolder of your levels folder (create it if it doesn't exist).
Copy the path(s) of Ini file(s) corresponding to the object(s).
Then in the editor select an unused template object (any object in Bank 254) and press "+" near object number.
Clipboard contents are automatically pasted into the dialog, so just press OK.

How to do it manually and/or set up optional parameters:
Say, you want to use Angry Fish object in you level.

1=Objects\Angry Fish\Object.ini

Params1=60, 80
Now the fish will jump higher.

Objects List

Collectables
(https://www.dropbox.com/s/abv1z1pav93moh1/Collectables.png?dl=1)
Spoiler: Ini files (click to show/hide)
Collectable items (except new keys) can be picked up more than once, you see their count in the power bar. Note that unlike KS+ here's no index attached to each individual coin or artifact and count is not limited.
Optional parameters:
1) Set this to 'true' to show power on power bar only after the item is picked up. This is how it's done in KS+, but in my mod by default all collectables used in the level are present in power bar.
2) Allow only one instance of collectable, like with ordinary powers. By default this is 'true' for keys, 'false' for other collectables.
Authors: egomassive, GrayFace, Nifflas

Collectables - Locks
(https://www.dropbox.com/s/ldaq8t4xi4im762/CollectablesLocks.png?dl=1)
Spoiler: Ini files (click to show/hide)
Locks for collectable items can have a number attached to them, telling how much items you need to collect to pass through. A negative number used for coins means that items count would be reduced by the number and lock would then be permanently open (that is, you pay once to open the lock).
Optional parameters:
1) Count needed to unlock. By default it's '0' for keys, which means that no count is shown on the lock and the lock acts normally. It's '5' for artifact locks, meaning that 5 artifacts are required to pass. It's '-5' for coins by default, meaning that you pay 5 coins to pass when you touch the lock.
2) Hide items count label.
Authors: GrayFace, Nifflas, egomassive

Golden Creatures
(https://www.dropbox.com/s/3yt0qfxta9zoybl/Golden%20Creatures.png?dl=1)
Spoiler: Ini files (click to show/hide)
Golden creatures are living collectable items. They're almost identical to ones from KS+ with 2 exceptions: creature 32 kills you if it drops on you and creature 49 kills you if you stand still.
Optional parameters:
1) Set this to 'true' to show power on power bar only after the item is picked up. This is how it's done in KS+, but in my mod by default all collectables used in the level are present in power bar.
2) Allow only one instance of each kind of creature, like in KS+. By default this is 'true'.
Authors: egomassive, GrayFace

Golden Creatures - Locks
(https://www.dropbox.com/s/ll2jdhylpnjhlq7/Golden%20Locks.png?dl=1)
Spoiler: Ini files (click to show/hide)
Locks act similar to those for collectable items. I decided to keep the count label by default, eventhough in KS+ these locks don't have it. It's intuitive this way. If you want to remove it, set the 2nd parameter to true.
Optional parameters:
1) Count needed to unlock. By default it's '0' for keys, which means that no count is shown on the lock and the lock acts normally. It's '5' for artifact locks, meaning that 5 artifacts are required to pass. It's '-5' for coins by default, meaning that you pay 5 coins to pass when you touch the lock.
2) Hide items count label.
Authors: egomassive, GrayFace

Force Keys
(https://www.dropbox.com/s/05dd8e75zb5j2wr/BlockKeys.png?dl=1) ; (https://www.dropbox.com/s/sgdpkz5e6gx9ekh/ForceKeys.png?dl=1)
Spoiler: Ini files (click to show/hide)
Again, all these except "Only Down" come from KS+. "Block User" fully blocks user control of Juni. Unlike in KS+, here it only works while Juni is touching it. "Only Down" blocks all control of Juni except Down key, so it's a replacement for Sticky-No Jump combination that also blocks hologram creation. The other objects force a single key when Juni is touching them.
Optional parameters of "Block User" and "Only Down":
1) Timeout after which the object releases player and possibly self-destructs.
2) Keep it alive after the timeout? "false" is default, so after the timeout the object is gone. In case of "true" you can re-enter the object and get stuck again.
Authors: GrayFace, egomassive

Map Power
(https://www.dropbox.com/s/k8uec8zm2rjrl5d/MapPower_1.png?dl=1)
Ini file:
Objects\Map Power\Object.ini

Another one from KS+. Enables you to see where you haven't been on the map.
Authors: egomassive, GrayFace

Angry Fish
(https://www.dropbox.com/s/uv1dyys2nu8p2vz/AngryFish.png?dl=1)
Ini file:
Objects\Angry Fish\Object.ini

A fish that jumps out of water and may kill the player.
Optional parameters:
1) Width of trajectory (defaults to 50)
2) Height of jump (defaults to 60)
3) Delay between jumps (defaults to 100)
4) Gravity (defaults to 45)
Author: GrayFace

Moving Bouncer
(https://www.dropbox.com/s/4br4y5osehmxtk4/Moving%20Bouncer_0_stopped_4.png?dl=1)
Ini file: Objects\Moving Bouncer\Object.ini
A bouncer that moves in player's direction, like the one seen in Extended Version Example, but blue. Avoids getting stuck in a wall reasonably well.
Optional parameters:
1) Delay, the opposite of speed at which the bouncer moves right and left (defaults to 2)
Author: GrayFace

Darkness
(https://www.dropbox.com/s/i9dxo7trrk0ekfw/Darkness.png?dl=1)
Ini file: Objects\Darkness\Object.ini
Makes the screen dark, leaving only a circle of light around player.
Optional parameters:
1) X offset from default position of light
2) Y offset from default position of light
3) Set this parameter to 'true' to make the darkness stay in its layer. Otherwise it appears on top of everything.
Author: GrayFace

Jump-Through Platform
(https://www.dropbox.com/s/3ijsy0p995g1oy7/PlatformL.png?dl=1) (https://www.dropbox.com/s/yjjkfq4gtlfnnpl/PlatformM.png?dl=1) (https://www.dropbox.com/s/kzkqauzof4ky6fw/PlatformR.png?dl=1)
Ini files:
Objects\Jump-Through Platform Left\Object.ini
Objects\Jump-Through Platform Middle\Object.ini
Objects\Jump-Through Platform Right\Object.ini
Objects\Jump-Through Platform Invisible\Object.ini

A platform that doesn't prevent the player from jumping through it from below, but lets the player stand on it.
Optional parameters:
1) Relative Y coordinate of player at which the object becomes solid (defaults to -18)
Authors: GrayFace, BloxMaster

Moving Platform
(https://www.dropbox.com/s/x2e3kg986fw6s5x/Moving%20Platform.png?dl=1) (https://www.dropbox.com/s/40kecte4sa4a7be/Moving%20Platform%20Big.png?dl=1)
Ini files:
Objects\Moving Platform\Object.ini
Objects\Moving Platform Big\Object.ini

A moving platform, jump-through by default.
Optional parameters:
1) X speed (defaults to 100)
2) Y speed (defaults to 0)
3) Hotspot X (defaults to 12)
4) Hotspot Y (defaults to 12)
5) Jump-through offset (defaults to -6, set it to 'false' to make the platform fully solid)
6) Jump-through offset with inverted gravity (defaults to 5 + 5)
7) Kills player when smashed against a wall (defaults to 'false')
Author: GrayFace

Falling Platform
(https://www.dropbox.com/s/vnfpcey8tdonw9d/Falling%20Platform%20Small.png?dl=1) (https://www.dropbox.com/s/kupa37rvdef8tg0/Falling%20Platform.png?dl=1)
Ini files:
Objects\Falling Platform Small\Object.ini
Objects\Falling Platform\Object.ini

A platform that descends while you stand on it.
Optional parameters:
1) Delay, the opposite of speed at which the platform moves down (defaults to 2)
2) Hotspot X (defaults to 12)
3) Hotspot Y (defaults to 12)
Author: GrayFace

Touch Save Spot
(https://www.dropbox.com/s/lwtws7prp8yxc5p/Touch%20Save%20Spot.png?dl=1)
Ini file: Objects\Touch Save Spot\Object.ini
Save spot triggered by touch.
(https://www.dropbox.com/s/hhwwplgdwqjjz0j/Touch%20Save%20Spot%20Up.png?dl=1)
Ini file: Objects\Touch Save Spot\Up.ini
Upside-down save spot triggered by touch when gravity is inverted.
Optional parameters:
1) (if 'true' is passed) Trigger by Down key press, acting like a normal save spot.
Author: GrayFace

Visible Spikes
(https://www.dropbox.com/s/aqwe0jo5s4x5sj8/Spikes%201.png?dl=1) (https://www.dropbox.com/s/8mgahpy720mt8ex/Spikes%202.png?dl=1) (https://www.dropbox.com/s/e1a4tzn8awnaqkq/Spikes%203.png?dl=1) (https://www.dropbox.com/s/jl4eh7iotxb5c7t/Spikes%204.png?dl=1)
Ini files:
Objects\Visible Spikes\Spikes 1.ini
Objects\Visible Spikes\Spikes 2.ini
Objects\Visible Spikes\Spikes 3.ini
Objects\Visible Spikes\Spikes 4.ini

Spikes that are always visible. You can also call load.lua script to replace all standard spikes with ones that are always visible.
Author: GrayFace

Water Wheel
(https://www.dropbox.com/s/cit6mykj5w3hcfi/WheelIcon.png?dl=1)
Ini file: Objects\Water Wheel\Object.ini
Solid rotating wheel.
Optional parameters:
1) Rotation speed (defaults to 1)
Author: GrayFace

Smasher
(https://www.dropbox.com/s/24716l6emo6sqa5/Smasher_11.png?dl=1)
Ini file: Objects\Smasher\Object.ini
It smashes Juni if she gets caught under it. (Or if she touches it at all) It looks best when placed at the top of the screen, otherwise it looks like it's unfolding from nothing.
Author: LordMarzog

Combined Fog
(https://www.dropbox.com/s/21fdn879pcjozjo/Combined%20Fog.png?dl=1)
Ini file: Objects\Combined Fog\Object.ini
Combination of two fog adders made by Nifflas, turned into an object.
Authors: Nifflas, GrayFace

Machine Cylinder
(https://www.dropbox.com/s/y9rbkypnwih0h4z/Cylinder1.png?dl=1)
Ini file: Objects\Machine Cylinder\Object.ini
Semi-transparent cylinder for machine from tileset 5. To be placed above Juni
Authors: LPChip, LordMarzog, GrayFace

Machine
(https://www.dropbox.com/s/07qhhay7354hrlx/Machine1.png?dl=1)
Ini file: Objects\Machine\Object.ini
Machine from tileset 5 turned into an object.
Authors: LPChip, GrayFace

Making Template Objects

The simplest example of template object is Combined Fog from the archive above. If your object only has one frame, you don't need a script that would load it. Here's the important part of Object.ini of Combined Fog:
Code: [Select]
[Object]
Image=Combined Fog.png
Offset X=48
Offset Y=-84
"Image" is the image displayed in level editor and used in the game if no loading script is specified.
"Offset X" and "Offset Y" are image offsets, similar to corresponding fields of custom objects.
"Icon" is the image displayed in objects palette. Combined Fog doesn't have one, because it's too big to be displayed there.
"Load" is the script of the object. Combined Fog doesn't need it.
"DoesHurt=1" will make the object kill Juni when she touches it.
"DetectRed=1" will make the object trigger red light of detector.
"Solid=1" will make the object solid.
"CanClimb=1" will make the object climbable.

You can turn custom objects into template objects with this tool (https://www.dropbox.com/s/ryk5w1pqvuvg2kq/CO%20to%20Template.rar?dl=1). You may want to use it because template objects can be made solid or dangerous for the player. There also isn't a 1 tick delay before they are shown on the screen.

Standard Objects

If you want to replace graphics of a standard object I can extract frames and generate a replacement script for you. Standard Frames (https://www.dropbox.com/s/euyzbaoqdt4r3uo/Standard%20Frames.rar?dl=1) archive contains scripts and graphics for some objects. It also contains a script for Juni's sound replacement (Player Sounds). Graphics of any object or in-game interface element can be replaced this way. Shape of objects changes together with graphics. Custom characters can be found in     
Custom Characters collection (http://nifflas.lpchip.nl/index.php?topic=5635) thread.
Title: Re: Template objects for KS Ex
Post by: Salmoneous on October 18, 2011, 09:13:36
This is great stuff grayface you have to make a level! I've been messing around with ksex a bit, you can do a lot of awesome stuff beyond ks. Like that code you did which changes the color of Junis clothes:
Spoiler: (click to show/hide)

I have to check this out, especially solid and deadly objects. You're the boss man  8)
Title: Re: Template objects for KS Ex
Post by: GrayFace on January 06, 2012, 11:47:24
I've added a moving platform object to the archive, I think it's pretty neat. You can make platforms that carry player horizontally or you can make elevators with it. A script can control SpeedX and SpeedY parameters of the object.

Thanks for feedback, Salmoneous.
Title: Re: Template objects for KS Ex
Post by: LordMarzog on January 08, 2012, 08:16:55
Dagum! Sure wish I had payed more attention to this! I am soooo making a deadly custom object for my next level project. 2 questions. 1: Is there a thorough tutorial on how to do this? More specifically, are the parameters universal for all template objects? Or do you have to specify them yourself? 2: Can I make an enemy that fires projectiles and only the projectiles are deadly?
Title: Re: Template objects for KS Ex
Post by: GrayFace on January 09, 2012, 11:07:01
Dagum! Sure wish I had payed more attention to this! I am soooo making a deadly custom object for my next level project. 2 questions. 1: Is there a thorough tutorial on how to do this? More specifically, are the parameters universal for all template objects? Or do you have to specify them yourself?
Parameters of "CO to Template" tool are mostly the ones you specify in ini for custom object. If you prefer working with separate images rather than a spritesheet, making object script would be easy without the tool, I'll make an example for that. So, what parameters do you mean?

2: Can I make an enemy that fires projectiles and only the projectiles are deadly?
Yes. It won't be too easy ATM though.
Title: Re: Template objects for KS Ex
Post by: LordMarzog on January 09, 2012, 18:42:47
Dagum! Sure wish I had payed more attention to this! I am soooo making a deadly custom object for my next level project. 2 questions. 1: Is there a thorough tutorial on how to do this? More specifically, are the parameters universal for all template objects? Or do you have to specify them yourself?
Parameters of "CO to Template" tool are mostly the ones you specify in ini for custom object. If you prefer working with separate images rather than a spritesheet, making object script would be easy without the tool, I'll make an example for that. So, what parameters do you mean?

2: Can I make an enemy that fires projectiles and only the projectiles are deadly?
Yes. It won't be too easy ATM though.
Like for the angry fish. If I wanted my template object to move higher or farther would I still enter params1=(whatever number I wanted) or would I have to say in the ini file what params1 means?
Title: Re: Template objects for KS Ex
Post by: LordMarzog on January 16, 2012, 01:44:31
Well, here is my Smasher template object. I made it for my latest level. Run the Gauntlet: Part 1 (http://nifflas.lpchip.nl/index.php?topic=5131.0) It does exactly what it names implies. It smashes Juni if she gets caught under it. (Or if she touches it at all) It looks best when placed at the top of the screen, otherwise it looks like it's unfolding from nothing. Your choice.

I'm guessing it's okay to attach it to this post. The object itself is the zip file. But I also attached the sprite sheet so you can see what it looks like.
Just follow standard installation instructions to use it. Enjoy  :D
Title: Re: Template objects for KS Ex
Post by: GrayFace on January 16, 2012, 06:01:34
Like for the angry fish. If I wanted my template object to move higher or farther would I still enter params1=(whatever number I wanted) or would I have to say in the ini file what params1 means?
If you create a template object based on the angry fish, there are 2 options:
1) Modify the Lua script. Look for "Width or 50, Height or 60". These are the default values.
2) Change default values in Object.ini like this:
Code: [Select]
Params=100, 120
Fixed Params Count=0
Title: Re: Template objects for KS Ex
Post by: LordMarzog on January 23, 2012, 19:23:53
Thanks. I'll have to toy around with that when I get the chance.

Out of curiosity, is it possible to make an enemy that responds only when Juni touches it? Like, say if I wanted to make a custom enemy that behaves similar to the green chomper thing. (Only my idea would behave more like a mouse trap) So that when Juni reaches the middle (or any part of it) it triggers?

Title: Re: Template objects for KS Ex
Post by: GrayFace on April 18, 2012, 12:28:04
Out of curiosity, is it possible to make an enemy that responds only when Juni touches it? Like, say if I wanted to make a custom enemy that behaves similar to the green chomper thing. (Only my idea would behave more like a mouse trap) So that when Juni reaches the middle (or any part of it) it triggers?
Yes, sure. I can't think of any non-system standard object that can't be recreated as KS Ex template. Although performance might become a problem if many such objects are present in a screen. I've never tried that. Tell me if you need the code.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 07, 2012, 14:44:47
I've updated the 1st post and added 2 little objects.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 12, 2012, 17:13:15
I've updated Template Objects, Standard Frames archives and CO to Template tool.

Now it's time for a few scripts that may become proper objects if someone makes graphics for them. Here's how you can check them out:
First, add this to Data\UserScript.lua:
Code: [Select]
OnKeyPress(mmf.VK_F12, function()
local ok, err = pcall(dofile, AppPath.."Data/debug.lua")
if not ok then
print(err)
end
end)
Then create Data\debug.lua file and paste one of these scripts there:




Now, when you press F12 an object would be spawned at (0, 0) or at Juni's position.
I also have this line in my debug.lua because it's often useful:
Code: [Select]
ShowText("x"..Game.MapX.."y"..Game.MapY)
These scripts I've made can serve as good examples of using movement functions added in the last version of KS Ex. Note though that NewTemplate function shouldn't be used like that in real life, because it can only be called up to 255 times, instead all same objects should use the same template index, like it's done in objects from the archive in the 1st post.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 23, 2012, 07:35:08
I've added 2 objects:

I've updated Darkness object too. Now it can be set not to cover what's in layers above it. This way you can put it into layer 4 (or at x0y0 of layer 5) and put objects that show candles with a part of the wall lighted by them into layer 5 and it would look as if they also light the place. This may be pretty time consuming to do and candles won't be able to light any moving objects, but it should look nice. You can also put creepy objects on top of it, like in deesgeega's Torchlight.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 03, 2013, 17:46:16
I've added collectables and locks for them.
Title: Re: Template objects for KS Ex
Post by: egomassive on November 03, 2013, 23:31:05
I like those artifact locks. Coin locks that permanently open sound more platformer friendly than the coin-shifts in KS+. I can imagine some interesting levels where the player decides which way to go and is bound to that decision until they find more coins.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 04, 2013, 14:29:39
I came to them thinking how I'd simplify shifts for collectables, because doing them in Lua certainly wouldn't be easy to grasp for most people. The only thing I'm worried about is save time. If 100 coins are used I'm afraid each saving would take too long.
Title: Re: Template objects for KS Ex
Post by: egomassive on November 04, 2013, 23:39:00
The only thing I'm worried about is save time. If 100 coins are used I'm afraid each saving would take too long.
You could possibly use a .bin file for this information. The mini-map data in KS+ is stored in a .bin. I generated a file with 1000 entries and I couldn't discern any loading/saving slowing.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 05, 2013, 15:03:29
I'd rather speed up save file ini handling at some point,but a .bin file can also be a good solution.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 08, 2013, 16:06:35
Here come golden creatures! If you used the previous version of Collectables, update them, there was a bug.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 12, 2013, 20:56:06
Turns out saving time is not a problem.
And now there are also Force Keys objects from KS+, but a bit different.
Title: Re: Template objects for KS Ex
Post by: GrayFace on November 14, 2013, 02:09:57
Another important update for golden creatures. There was a bug that was nagated by another bug in KS Ex itself.
Title: Re: Template objects for KS Ex
Post by: Fubaka on November 14, 2017, 00:04:00
Any chance we can get these links refurbished?
Title: Re: Template objects for KS Ex
Post by: GrayFace on June 07, 2018, 03:55:03
I've updated the links. Stupid Dropbox.