Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Scripts?
schwem00 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Sep 2013
Reputation: 0
#1
Question  Adding Scripts?

I have been trying to make my first CS and I have gone through the wiki looking for this. It may sound like a stupid question, but how do I add scripts to my level? I have already copied down the code for locked doors and I have the inventory spots in the lang file but I have no idea where to put my code. I downloaded a few custom maps to try to find out how to add scripts but I just cant figure it out.Huh Thanks in advance!
(This post was last modified: 09-24-2013, 11:37 PM by schwem00.)
09-24-2013, 09:42 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Adding Scripts?

Oh, haha Smile

See, when you downloaded the maps, did you notice these .hps files?

These are what you're looking for. I recommend having a program like Geany. It'll help you with colors and such when you're scripting, but notepad is ok too. Download Geany though. It'll help you.

What you do is, you start with an empty text file.
Then you write this:
PHP Code: (Select All)
void OnStart()
{

}
void OnEnter()
{

}
void OnLeave()
{




This has to be in the file, for it to work.

Now save the file, but change the extension from .txt to .hps.
Save it in the maps folder of your custom story and call it the same as the corresponding map.

A script is always defined inside brackets like these { }
It's important to keep all script lines inside brackets.
These scripts can only be triggered if they're in a function.

NOTE: A function is one sequence of script lines, created by a name, parameters and two brackets.
Help with parameters: http://www.frictionalgames.com/forum/thread-18368.html

If you're having any more problems with scripting, please DO ask!


Also... Questions about scripting and Level Editing usually goes here: http://www.frictionalgames.com/forum/forum-39.html

Trying is the first step to success.
(This post was last modified: 09-24-2013, 10:13 PM by FlawlessHappiness.)
09-24-2013, 10:07 PM
Find
schwem00 Offline
Junior Member

Posts: 4
Threads: 2
Joined: Sep 2013
Reputation: 0
#3
RE: Adding Scripts?

(09-24-2013, 10:07 PM)Darth FlawlessHair Wrote: Oh, haha Smile

See, when you downloaded the maps, did you notice these .hps files?

These are what you're looking for. I recommend having a program like Geany. It'll help you with colors and such when you're scripting, but notepad is ok too. Download Geany though. It'll help you.

What you do is, you start with an empty text file.
Then you write this:
PHP Code: (Select All)
void OnStart()
{

}
void OnEnter()
{

}
void OnLeave()
{




This has to be in the file, for it to work.

Now save the file, but change the extension from .txt to .hps.
Save it in the maps folder of your custom story and call it the same as the corresponding map.

A script is always defined inside brackets like these { }
It's important to keep all script lines inside brackets.
These scripts can only be triggered if they're in a function.

NOTE: A function is one sequence of script lines, created by a name, parameters and two brackets.
Help with parameters: http://www.frictionalgames.com/forum/thread-18368.html

If you're having any more problems with scripting, please DO ask!


Also... Questions about scripting and Level Editing usually goes here: http://www.frictionalgames.com/forum/forum-39.html

Thanks so much! I didn't think the .hps files did anything other then load the map, this solves my problems!
09-24-2013, 11:37 PM
Find
CarnivorousJelly Offline
Posting Freak

Posts: 1,196
Threads: 41
Joined: Dec 2012
Reputation: 80
#4
RE: Adding Scripts?

Of course it didn't do anything :p you haven't added any functions to it! This is a list of all the different engine scripts you can use and what they do. BeeKayK Darth FlawlessHair might have given that link earlier, but I didn't see it, so I felt the need to add c:

And just like he said - if you have any questions at all, ask (make sure you ask in this thread)! If you can, searching the forum for FAQs is also a good idea.

Also, I generally don't bite, but I'm not fantastic with scripting. If you have relatively simple questions (ie: what's a bool/string/float/whatever, or how do I add pictures to loading screens) I can answer them. I like to think I'm good with the level editor though, so if you ever need help in that area, don't be shy! Being shy was a bit of a mistake I made when I joined the forum - well, I was actually lurking for several months before I joined - and I wasted a lot of time because I was too shy to ask 'noob' questions.



Edit: remembered BeeKayK is now Darth FlawlessHair
Edit: Added a bit

[Image: quote_by_rueppells_fox-d9ciupp.png]
(This post was last modified: 09-25-2013, 04:00 AM by CarnivorousJelly.)
09-25-2013, 03:57 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Adding Scripts?

(09-25-2013, 03:57 AM)Kia Wrote: Edit: remembered BeeKayK is now Darth FlawlessHair

You'll still be Kiandra in my head... Smile

Trying is the first step to success.
09-25-2013, 07:08 AM
Find




Users browsing this thread: 2 Guest(s)