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
Need help with scripts
NumsefisK Offline
Junior Member

Posts: 10
Threads: 1
Joined: Aug 2011
Reputation: 0
#1
Need help with scripts

Hey. I'm new to modding/making custom maps and I was wondering how you make a key match a door and I'm also trying to make the monster spawn when you pick up the key. And when the monster enters the room and checks it, how can I make him walk out after a while and despawn? Does the monster make the sound itself, or do i have to find the sound file too?

And how do you make a note that can be picked up and read by the player?

I heard theres something that has to be done in the .hps file, but isn't there something in Callback in the level editor too?

Edit: typos
(This post was last modified: 08-17-2011, 07:16 PM by NumsefisK.)
08-17-2011, 07:12 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Need help with scripts

http://www.frictionalgames.com/forum/thread-9264.html

Peruse this thread, it should answer all of your questions Smile

08-17-2011, 08:54 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#3
RE: Need help with scripts

To make keys, use this:
void AddUseItemCallback(string& asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy);

asName - (Leave this as "" all the time)
asItem - (Name of the item)
asEntity - (Name of the door to use on)
asFunction - (Name of what to do when you use the key)
abAutoDestroy - determines whether the item is destroyed when used

EXAMPLE:
AddUseItemCallback("", "YourKey", "YourDoor", "UsedKeyOnDoor", true);
**ONLY CHANGE "YourKey" to the name of your key, and only change "YourDoor" to the name of the door.**

To make a monster spawn when you pick up an item, place the monster with the level editor, and make it "inactive." Then use this script:

{
SetEntityCallbackFunc("Name_of_item", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("Name_of_monster", true);
}

Just change Name of Item, and Name of Monster above, to the names that they are in the level editor. You will need to program Nodes for the monster to walk around, and thats something I have yet to learn.

Notes:
Just place a note in the editor, NOTE: IT MUST SAY "note" in the start. Example: "note_paper" so that it is able to be picked up. And then name it what ever you like.

Then the rest is in the Extra_eng.lang file. Use this:

<Entry Name="NAME_OF_YOUR_NOTE">This is the title of the note</Entry>
<Entry Name="NAME_OF_YOUR_NOTE">Everything here is what the note will say.</Entry>

Ask any questions! Big Grin

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 08-17-2011, 09:00 PM by JetlinerX.)
08-17-2011, 08:55 PM
Website Find
NumsefisK Offline
Junior Member

Posts: 10
Threads: 1
Joined: Aug 2011
Reputation: 0
#4
RE: Need help with scripts

Nothing I've done seems to work.

I'll put in my .hps and .lang file below.

Quote:////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Bedroom_Key", "Bedroom_Door", "UsedKeyOnDoor", true);
}

{
SetEntityCallbackFunc("Name_of_item", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_01", true);
}
///////////////////////////////////
//Run when entering map
void OnEnter()
{

}


////////////////////////////
// Run when leaving map
void OnLeave()
{

}

The monster doesn't seem to spawn, and the key doesn't work with the door, nor does the key have any name or text attached to it in-game.

Quote:<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You wake up an unknown castle you must escape quickly before darkness will kill you!</Entry>
</CATEGORY>
<CATEGORY Name="Journal">

<Entry Name="Note_diary_1">Diary Entry 1</Entry>
<Entry Name="Note_diary_1_Text">I sometimes wake up in the middle of the night, because of the noises coming from the closet, but as I wake up, they suddenly dissapear. I think I'm going to have to leave this place soon...</Entry>
</CATEGORY>
<CATEGORY>
<Entry Name ="Inventory"
<Entry Name="ItemDesc_Bedroom_Key">The Key to the Bedroom"</Entry>
<Entry Name="ItemDesc_Bedroom_Key">Bedroom Key"</Entry>
</CATEGORY>
</LANGUAGE>

The note does not have any name it is just a blank piece of paper when i pick it up in-game.

I saw someone else put the key thing in the .lang file too, but I'm a little confused now.
(This post was last modified: 08-17-2011, 09:36 PM by NumsefisK.)
08-17-2011, 09:24 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#5
RE: Need help with scripts

make sure you add the same key name in the other tab of the level editor. I think its subitemname for something?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

08-17-2011, 09:33 PM
Website Find
NumsefisK Offline
Junior Member

Posts: 10
Threads: 1
Joined: Aug 2011
Reputation: 0
#6
RE: Need help with scripts

Yes, I have actually done that, it is in CustomSubItemTypeName.
08-17-2011, 09:35 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#7
RE: Need help with scripts

Then hit "Enter" after you type it in?
You also have 2 "Desc" in your Extra Eng so thats why the key isnt working.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 08-17-2011, 09:38 PM by JetlinerX.)
08-17-2011, 09:36 PM
Website Find
NumsefisK Offline
Junior Member

Posts: 10
Threads: 1
Joined: Aug 2011
Reputation: 0
#8
RE: Need help with scripts

(08-17-2011, 09:36 PM)JetlinerX Wrote: Then hit "Enter" after you type it in?
You also have 2 "Desc" in your Extra Eng so thats why the key isnt working.

Oops, i didn't hit Enter, i feel like a dork right now.
08-17-2011, 09:46 PM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#9
RE: Need help with scripts

Thats alright, I have done that a lot. Also, to fix your Extra Eng, use this:

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You wake up an unknown castle you must escape quickly before darkness will kill you!</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_diary_1_Name">Diary Entry 1</Entry>
<Entry Name="Note_diary_1_Text">I sometimes wake up in the middle of the night, because of the noises coming from the closet, but as I wake up, they suddenly disappear. I think I'm going to have to leave this place soon...</Entry>
</CATEGORY>
<CATEGORY>
<Entry Name ="Inventory"
<Entry Name="ItemName_Bedroom_Key">Bedroom Key</Entry>  
<Entry Name="ItemDesc_Bedroom_Key">The Key to the Bedroom</Entry>
</CATEGORY>
</LANGUAGE>

Let me know if that worked Wink

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 08-17-2011, 09:53 PM by JetlinerX.)
08-17-2011, 09:52 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Need help with scripts

You might want to fix the following syntax issue:
<Entry Name ="Inventory"

Tutorials: From Noob to Pro
08-17-2011, 09:59 PM
Website Find




Users browsing this thread: 1 Guest(s)