Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PLEEAASEE HELP?
Author Message
AirmanerX Offline
Junior Member

Posts: 14
Joined: May 2012
Reputation: 0
Post: #1
PLEEAASEE HELP?

Alright, Hello.



I love playing custom stories, so I decided to make one. After making a room and a door. I made a key. Now, in my HPS file ther is this script:

Is there anything wrog with it?



////////////////////////////

// Run first time starting map

void OnStart ()

{



}



////////////////////////////

// Run when entering map

void OnEnter()

{ AddUseItemCallback("", "IronKey_1", "mansion_1", "KeyOnDoor",

true);



}



void KeyOnDoor(string &in asItem, string &in asEntity)



{



SetSwingDoorLocked("mansion_1"­, false, true); PlaySoundAtEntity("",

"unlock_door", "mansion_1", 1, false); RemoveItem("IronKey_1");



}

///////////////////////////

// Run when leaving map

voin OnLeave

{



}



Also,

When i put the Door_frame02, its invisible. If i click on it i can see the outline and i can move it.

*Note*



I also havent gotten to test my map since i cant start it because of the scripting problem

Error is like this

FATAL ERROR: Could not load script file 'custom_stories/AirmanerX Custom Story/maps/00_firsttryairmaner.hps'!
main (27,1) : ERR : Expected '('
Any help is GREATLY appreciated!
05-06-2012 11:45 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 318
Joined: Mar 2012
Reputation: 8
Post: #2
RE: PLEEAASEE HELP?

AddUseItemCallback("", "IronKey_1", "mansion_1", "KeyOnDoor", true)


Put that inside the
OnStart()
===============
Also
SetSwingDoorLocked("mansion_1"­, false, true); PlaySoundAtEntity("",

"unlock_door", "mansion_1", 1, false); RemoveItem("IronKey_1");

CHANGE IT TO THIS
SetSwingDoorLocked("mansion_1"­, false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 1, false);
RemoveItem("IronKey_1");
=====================
Try not to space everything out. (I am not sure if that was a glitch with copying and pasting)
Put the script functions into these
{
SetSwingDoorLocked("mansion_1"­, false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 1, false);
RemoveItem("IronKey_1");
}

void OnStart()

{
AddUseItemCallback("", "IronKey_1", "mansion_1", "KeyOnDoor",true);
}

(This post was last modified: 05-06-2012 11:54 AM by Xanthos.)
05-06-2012 11:51 AM
Find all posts by this user Quote this message in a reply
Rownbear Offline
Member

Posts: 157
Joined: Apr 2011
Reputation: 2
Post: #3
RE: PLEEAASEE HELP?

you should read more up on scripting and maybe watch some videos on the wiki site to understand scripting more. If you just want to use a key on a door you would need a script like this

Spoiler below!

void OnStart()
{
/// use "castle_key_1" on "castle_door_1" door => calls "KeyOnDoor1"
AddUseItemCallback("", "castle_key_1", "castle_door_1", "KeyOnDoor1", true);
}

////Open Doors
void KeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_door_1", false, true);
RemoveItem("castle_key_1");
PlaySoundAtEntity("", "unlock_door.snt", "castle_door_1", 0.0f, true);
}

//Entering map\\
void OnEnter()
{
}

//Leaving map\\
void OnLeave()
{
}


if you use this as your new hps and call the key for castle_key_1 and the door for castle_door_1 or change it for what you have, it should work and not crash anymore.

Now, go watch some videos Smile

(This post was last modified: 05-06-2012 11:58 AM by Rownbear.)
05-06-2012 11:57 AM
Find all posts by this user Quote this message in a reply
AirmanerX Offline
Junior Member

Posts: 14
Joined: May 2012
Reputation: 0
Post: #4
RE: PLEEAASEE HELP?

(05-06-2012 11:57 AM)Rownbear Wrote:  you should read more up on scripting and maybe watch some videos on the wiki site to understand scripting more. If you just want to use a key on a door you would need a script like this

Spoiler below!

void OnStart()
{
/// use "castle_key_1" on "castle_door_1" door => calls "KeyOnDoor1"
AddUseItemCallback("", "castle_key_1", "castle_door_1", "KeyOnDoor1", true);
}

////Open Doors
void KeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_door_1", false, true);
RemoveItem("castle_key_1");
PlaySoundAtEntity("", "unlock_door.snt", "castle_door_1", 0.0f, true);
}

//Entering map\\
void OnEnter()
{
}

//Leaving map\\
void OnLeave()
{
}


if you use this as your new hps and call the key for castle_key_1 and the door for castle_door_1 or change it for what you have, it should work and not crash anymore.

Now, go watch some videos Smile


Thanks
The thing is, I changed all Castle Door and Key names into my key and door names (IronKey_1) and mansion_1
Also, in my extra_english.lang file (some guy told me to do that) it says

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">This is my first try at a custom story. I have no experience at at all.[br]Please send me feedback at airmanerx@live.com.[br] http://www.youtube.com/user/AirmanerX</Entry>
</CATEGORY>
<CATEGORY Name="Inventory"?
<Entry Name="ItemName_IronKey_1">Iron Key</Entry>
<Entry Name="ItemDesc_IronKey_1">Put it in THAT door. Yes, THAT one.</Entry>
</CATEGORY>
</LANGUAGE>
This is correct, right?
Sorry, i dont understand scripting at all. Its like alien science to me. If you have any videos to explain it, id watch them but probbaly not learn anything anyway.
05-06-2012 12:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 318
Joined: Mar 2012
Reputation: 8
Post: #5
RE: PLEEAASEE HELP?

Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang

05-06-2012 12:20 PM
Find all posts by this user Quote this message in a reply
AirmanerX Offline
Junior Member

Posts: 14
Joined: May 2012
Reputation: 0
Post: #6
RE: PLEEAASEE HELP?

(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Ok, thanks. Another thing (sorry about all the questions)

What do I add to the hps file if i want to make more doors + keys. where do i add it?

(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Also, when I put a doorframe02 its invisible. Is there a way to solve it?
(This post was last modified: 05-06-2012 12:25 PM by AirmanerX.)
05-06-2012 12:23 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rownbear Offline
Member

Posts: 157
Joined: Apr 2011
Reputation: 2
Post: #7
RE: PLEEAASEE HELP?

http://wiki.frictionalgames.com/hpl2/amn..._functions

Favorite it in your browser and check out the tutorials there.

EDIT: also if you want the key to display what you put in the extra_english you must first click on the key in the leveleditor. go to entity, then in the customsubitemtypename and write in IronKey_1. so when you pick it up it should properly show name/desc.

The doorframe thats invisible, you sure its just not faceing the wrong way? try rotating it.

(This post was last modified: 05-06-2012 12:31 PM by Rownbear.)
05-06-2012 12:26 PM
Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 318
Joined: Mar 2012
Reputation: 8
Post: #8
RE: PLEEAASEE HELP?

(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Ok, thanks. Another thing (sorry about all the questions)

What do I add to the hps file if i want to make more doors + keys. where do i add it?
You would add another Function in the OnStart.



Like So
void OnStart
{
AddEntityCollideCallback("Player", "Blah", "Blah", false, 1);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

}

Then you add another on of the script functions thingys. Directly under the OnStart Section



void blah(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_18", true, false);
}


void blah(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Blah", false);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("Key");

}


void blah(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("blah", false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("blah");
}

(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Also, when I put a doorframe02 its invisible. Is there a way to solve it?
Check the "Active" box under the name of it

(This post was last modified: 05-06-2012 12:30 PM by Xanthos.)
05-06-2012 12:29 PM
Find all posts by this user Quote this message in a reply
AirmanerX Offline
Junior Member

Posts: 14
Joined: May 2012
Reputation: 0
Post: #9
RE: PLEEAASEE HELP?

(05-06-2012 12:29 PM)Xanthos Wrote:  
(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Ok, thanks. Another thing (sorry about all the questions)

What do I add to the hps file if i want to make more doors + keys. where do i add it?
You would add another Function in the OnStart.



Like So
void OnStart
{
AddEntityCollideCallback("Player", "Blah", "Blah", false, 1);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

}

Then you add another on of the script functions thingys. Directly under the OnStart Section



void blah(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_18", true, false);
}


void blah(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Blah", false);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("Key");

}


void blah(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("blah", false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("blah");
}

(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Also, when I put a doorframe02 its invisible. Is there a way to solve it?
Check the "Active" box under the name of it
Sorry, not Door Frame. Door Way.
05-06-2012 12:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Xanthos Offline
Senior Member

Posts: 318
Joined: Mar 2012
Reputation: 8
Post: #10
RE: PLEEAASEE HELP?

(05-06-2012 12:33 PM)AirmanerX Wrote:  
(05-06-2012 12:29 PM)Xanthos Wrote:  
(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Ok, thanks. Another thing (sorry about all the questions)

What do I add to the hps file if i want to make more doors + keys. where do i add it?
You would add another Function in the OnStart.



Like So
void OnStart
{
AddEntityCollideCallback("Player", "Blah", "Blah", false, 1);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

AddUseItemCallback("", "Key", "Blah", "Blah", true);

}

Then you add another on of the script functions thingys. Directly under the OnStart Section



void blah(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_18", true, false);
}


void blah(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Blah", false);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("Key");

}


void blah(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("blah", false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem("blah");
}

(05-06-2012 12:23 PM)AirmanerX Wrote:  
(05-06-2012 12:20 PM)Xanthos Wrote:  Make sure that the subset name in the Level Editor for that key is corresponding with the one in the extra lang
Also, when I put a doorframe02 its invisible. Is there a way to solve it?
Check the "Active" box under the name of it
Sorry, not Door Frame. Door Way.
Check if you have any map_cache files hiding around in your custom story folder.
If so delete and try again with the test.

05-06-2012 12:38 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: