Forum Logo Welcome, Guest. Please login or register.
Did you miss your activation email?
September 21, 2018, 02:02:04 | See new unread posts
Home Help Search Arcade Chat Login Register

nifflas.ni2.se  |  Nifflas' Support Forum  |  Level Editing Support  |  Knytt Stories Level Editing Support  |  Knytt Stories - Custom Content  |  Topic: Template objects for KS Ex « previous next »
Pages: [1] 2 Print
Author Topic: Template objects for KS Ex  (Read 14723 times)
GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« on: October 15, 2011, 21:00:32 »

Object templates introduced in KS Ex 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.
  • Put the object somewhere in the world folder. For example, create Objects sub-folder and copy the "Angry Fish" folder there.
  • Create [Templates] section in your World.ini file. Add this line there:
1=Objects\Angry Fish\Object.ini
  • Open Bank 254 and you'll see the angry fish as the object number 1. To define object number 2 you would write "2=" instead of "1=" in [Templates] section, and so on.
  • Some objects may take parameters. For example, you can change height of Angry Fish jumps by adding this line to [Templates] section:
Params1=60, 80
Now the fish will jump higher.

Objects List

Collectables

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

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

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

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
;
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

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

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

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

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

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

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

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

Ini file: Objects\Touch Save Spot\Object.ini
Save spot triggered by touch.

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

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

Ini file: Objects\Water Wheel\Object.ini
Solid rotating wheel.
Optional parameters:
1) Rotation speed (defaults to 1)
Author: GrayFace

Smasher

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

Ini file: Objects\Combined Fog\Object.ini
Combination of two fog adders made by Nifflas, turned into an object.
Authors: Nifflas, GrayFace

Machine Cylinder

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

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:
[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. 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 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
thread.
« Last Edit: June 07, 2018, 02:48:59 by GrayFace » Logged

Salmoneous


Total My honestly gotten stars: 25
Offline Offline



View Profile WWW
« Reply #1 on: October 18, 2011, 08: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)
Logged

GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #2 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.
Logged

LordMarzog


Total My honestly gotten stars: 3
Offline Offline


[interesting text goes here]


View Profile
« Reply #3 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?
« Last Edit: January 08, 2012, 08:40:10 by LordMarzog » Logged

Run the Gauntlet: Prologue | Run the Gauntlet: Part 1 I'll add more interesting stuff here when I have more interesting stuff to add. (duh)
GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #4 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.
Logged

LordMarzog


Total My honestly gotten stars: 3
Offline Offline


[interesting text goes here]


View Profile
« Reply #5 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?
Logged

Run the Gauntlet: Prologue | Run the Gauntlet: Part 1 I'll add more interesting stuff here when I have more interesting stuff to add. (duh)
LordMarzog


Total My honestly gotten stars: 3
Offline Offline


[interesting text goes here]


View Profile
« Reply #6 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 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

* Smasher.zip (114.41 KB ~ Downloads: 219)
Smasher.png 
* Smasher.png  
Logged

Run the Gauntlet: Prologue | Run the Gauntlet: Part 1 I'll add more interesting stuff here when I have more interesting stuff to add. (duh)
GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #7 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:
Params=100, 120
Fixed Params Count=0
Logged

LordMarzog


Total My honestly gotten stars: 3
Offline Offline


[interesting text goes here]


View Profile
« Reply #8 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?

Logged

Run the Gauntlet: Prologue | Run the Gauntlet: Part 1 I'll add more interesting stuff here when I have more interesting stuff to add. (duh)
GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #9 on: April 18, 2012, 11: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.
« Last Edit: April 18, 2012, 11:34:21 by GrayFace » Logged

GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #10 on: November 07, 2012, 14:44:47 »

I've updated the 1st post and added 2 little objects.
Logged

GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #11 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:
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:
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.
« Last Edit: November 12, 2012, 20:38:47 by GrayFace » Logged

GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #12 on: November 23, 2012, 07:35:08 »

I've added 2 objects:
  • Falling Platform object, I've also made a little level with it: http://nifflas.lpchip.nl/index.php?topic=5652
  • Moving Bouncer is like the bouncer seen in Extended Version Example. It requires KS Ex 1.5.3 which I'm releasing within an hour.
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.
« Last Edit: November 23, 2012, 08:01:20 by GrayFace » Logged

GrayFace


Total My honestly gotten stars: 54
Offline Offline



View Profile WWW
« Reply #13 on: November 03, 2013, 17:46:16 »

I've added collectables and locks for them.
Logged

egomassive


Total My honestly gotten stars: 232
Offline Offline



View Profile WWW
« Reply #14 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.
Logged
Pages: [1] 2 Print 
nifflas.ni2.se  |  Nifflas' Support Forum  |  Level Editing Support  |  Knytt Stories Level Editing Support  |  Knytt Stories - Custom Content  |  Topic: Template objects for KS Ex « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2013, Simple Machines