Custom Object sub folders

  • 5 Replies
  • 2656 Views
Custom Object sub folders
« on: April 21, 2010, 01:52:07 »
Yes, this is a tutorial on how to place custom objects in a sub folder. For example, you could have a separate folder for your foreground custom objects, a folder for your critter objects, etc. All these folders must still go in the Custom Objects folder, though. Here's how it works: When KS retrieves the object name, it takes the string after "image=". It then tags than onto the application path > Custom Objects. Assume your KS folder is at C:\Users\Pineapple\Games\Nifflas\KS\. It will take that pathname and add "Custom Objects\" on the end to find the custom objects folder thus: C:\Users\Pineapple\Games\Nifflas\KS\Custom Objects\. Finally, it takes the string after "image=" and places it on the end. If you put image=flower.png in the ini, it will put flower.png on the end to get C:\Users\Pineapple\Games\Nifflas\KS\Custom Objects\flower.png. Surely now you see what happens. If you add a sub folder called wildlife in the Custom Objects folder, and put flower.png in that, you simply tell the game to look for "image=wildlife\flower.png," thereby producing C:\Users\Pineapple\Games\Nifflas\KS\Custom Objects\wildlife\flower.png! Tadaa!

In summary:
Create sub folder "example" and put the object in with name "ex.png" Put this code in the ini:
Code: [Select]
[Custom Object #]
image=example\ex.png
Further examples can be found in my level here.
Lurk more.

*

Offline Firecat

  • 370
  • 52
  • Every bit is important.
    • View Profile
Re: Custom Object sub folders
« Reply #1 on: April 21, 2010, 02:29:32 »
Wow. That its interesing.
There's 110011 kinds of people in the world. Those who understand binary, Those who don't, and those who confuse it with ASCII.

*

Offline AA

  • 510
  • 23
  • Was ITA84
    • View Profile
    • Insight on Videogames
Re: Custom Object sub folders
« Reply #2 on: April 21, 2010, 08:40:37 »
You can also use the parent directory - i.e. '..' - in the image path, as in '..\..\otherlevel\Custom Objects\CO1.png'; it's mostly useless, but you could share Custom Objects between levels like that if you wanted.
Videogames are for everyone, by everyone

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: Custom Object sub folders
« Reply #3 on: April 21, 2010, 09:01:13 »
You can also use the parent directory - i.e. '..' - in the image path, as in '..\..\otherlevel\Custom Objects\CO1.png'; it's mostly useless, but you could share Custom Objects between levels like that if you wanted.

I would strongly avoid doing this (use CO's from other worlds).

I'm failry sure that by doing so, the custom object will not be packed into your knytt.bin file, and it will break your level if someone else doesn't have this other level, or have a modified(corrputed?) version of it.

CO's are not big files, so copying them is easy enough. Besides, would you make another level dependent of a CO, it means you can never alter it again, or it will be altered in both.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

Re: Custom Object sub folders
« Reply #4 on: April 22, 2010, 01:28:46 »
You can also use the parent directory - i.e. '..' - in the image path, as in '..\..\otherlevel\Custom Objects\CO1.png'; it's mostly useless, but you could share Custom Objects between levels like that if you wanted.
I was thinking about that, but I couldn't find a good reason to use it (until now)

You can do an automatic check if someone else has a level with custom objects in it. For example "..\..\mr person - blah\Custom Objects\whatever.png" and then make a little arrow or something pointing out an otherwise nearly impossible secret area to find. In that secret area you could say, "Hey! You have mr person's level! That makes you cool." :P
Lurk more.

*

Offline AA

  • 510
  • 23
  • Was ITA84
    • View Profile
    • Insight on Videogames
Re: Custom Object sub folders
« Reply #5 on: April 22, 2010, 13:38:20 »
Cool idea! Very 'Psycho Mantis'-esque.
Videogames are for everyone, by everyone