Frictional Games Forum (read-only)

Full Version: Need help!!! Script...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello i cant get this to work ! :'( A Locked Key to be open by a key on the floor but cant get it to work please help and cant get the key to get name "Cell Key" Here is the scripts...

PHP Code:
////////////////////////////
// Run first time starting map
 
void OnEnter()
{
void AddUseItemCallback("""cellkey_1""celldoor_1"UsedKeyOnDoor", True);
}

void MyFunc(string &in asItem, string &in asEntity)
{
  SetSwingDoorLocked("
celldoor_1", "false", true);
  PlaySoundAtEntity("", "
unlock_door", "celldoor_1", 0, false);
  RemoveItem(cellkey_1);
}
    
////////////////////////////
// Run when Leaving map
void onleave 
{




And here is Lang script

PHP Code:
<Main
    Name
="The Espace From Caslte"
    
Author="Hasse951 Aka Jesseh Music"
        
StartMap="00.intro.map"
    
StartPos=""
/>
<
LANGUAGE>
   <
CATEGORY Name="The Esapace From Castle">
      <
Entry Name="Jonah is escaping from the castle in a middle of no were ">
     
   </
CATEGORY>
</
LANGUAGE>

<
CATEGORY Name ="Inventory">
        <
Entry Name="Itemdeac_cellkey_1">"Cell key to the locked Cell door"</Entry>
        <
Entry Name="ItemName_cellkey_1">Cell Key</Entry
        
    
</CATEGORY>
</
LANGUAGE
im new on scripts first day im working with it! please answer!
Use this:
Quote:void OnEnter()
{
void AddUseItemCallback("", "cellkey_1", "celldoor_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("celldoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "celldoor_1", 0, false);
RemoveItem("cellkey_1");
}

////////////////////////////
// Run when Leaving map
void onleave
{
}
The mistakes were that you used a captiel T in true, you didn't put the other quotation mark on UsedKeyOnDoor in void onEnter. Some other mistakes you made in the rest of the script were missing quotations from RemoveItem("cellkey_1");, you also didn't name your function right.. If that doesn't work post it again.
okey ty testing
It dosnt work :S it comes error and game closing.. :S
And i think this lang is wrong :S
PHP Code:
<Main
    Name
="The Espace From Caslte"
    
Author="Hasse951 Aka Jesseh Music"
        
StartMap="00.intro.map"
    
StartPos=""

    
<LANGUAGE>
   <
CATEGORY Name="The Esapace From Castle">
      <
Entry Name="Jonah is escaping from the castle in a middle of no were ">
     
   </
CATEGORY>
</
LANGUAGE>

<
CATEGORY Name ="Inventory">
        <
Entry Name="Itemdeac_cellkey_1">"Cell key to the locked Cell door"</Entry>
        <
Entry Name="ItemName_cellkey_1">Cell Key</Entry
        
    
</CATEGORY>
</
LANGUAGE
Ok. Make a new text document file and rename it to: custom_story_settings, now make it a .cfg file. After that put this into that file (through opening it with notepad):


Quote:<Main

Name = ""
Author = ""
ImgFile = ""

MapsFolder = ""
StartMap = ""
StartPos = ""
/>

Fill out what you want and save it to your custom story directory.

Now make another text document and name it: extra_english and make it a .lang file. After that go into it by using notepad and put this in:
Quote:<LANGUAGE>


<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You need to turn off the generator. Do it fast. What a great story</Entry>
</CATEGORY>

<CATEGORY Name ="Inventory">
<Entry Name="Itemdeac_cellkey_1">"Cell key to the locked Cell door"</Entry>
<Entry Name="ItemName_cellkey_1">Cell Key</Entry

</CATEGORY>
</LANGUAGE>

Save to your custom story directory as well. It should work now.
ffs!! why does it not work hps file is wrong ...
Code:
void OnEnter()
{
void AddUseItemCallback("", "cellkey_1", "celldoor_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("celldoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "celldoor_1", 0, false);
RemoveItem("cellkey_1");
}

////////////////////////////
// Run when Leaving map
void onleave
{
}
Code:
<Main

Name = "The Castle"
Author = "Hasse951    "
ImgFile = ""

MapsFolder = "K:\Amnesia - The Dark Descent\redist\custom_stories\Lets go to darkness\maps"
StartMap = "00.intro.map"
StartPos = ""
/>

<LANGUAGE>


<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You need to turn off the generator. Do it fast. What a great story</Entry>
</CATEGORY>

<CATEGORY Name ="Inventory">
<Entry Name="Itemdeac_cellkey_1">"Cell key to the locked Cell door"</Entry>
<Entry Name="ItemName_cellkey_1">Cell Key</Entry

</CATEGORY>
</LANGUAGE>

Try this to your .lang file
Spoiler below!


<LANGUAGE>


<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You need to turn off the generator. Do it fast. What a great story</Entry>
</CATEGORY>

<CATEGORY Name ="Inventory">
<Entry Name="ItemDesc_cellkey_1">"Cell key to the locked Cell door"</Entry>
<Entry Name="ItemName_cellkey_1">Cell Key</Entry

</CATEGORY>
</LANGUAGE>




And this to your .cfg file

Spoiler below!


<Main
Name = "The Castle"
Author = "Hasse951 "
ImgFile = ""
MapsFolder = "maps/"
StartMap = "00.intro.map"
StartPos = ""
/>



do you know the script to unlock a door...
Is this right
PHP Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
 
AddUseItemCallback("""key_1""celldoor_1""UsedKeyOnDoor"true);
 
}
{
   
UsedKeyOnDoor(string &in asItemstring &in asEntity)
}
   
SetSwingDoorLocked("celldoor_1"falsetrue);
 
PlaySoundAtEntity("""unlock_door""celldoor_1"0false);
 
RemoveItem("key_1");
 
////////////////////////////
// Run when leaving map
void OnLeave()
{
 


Have Made new key

Click the key on level editor, open second tab on the right.
There is "CallbackFunc", type there "usekey" and then use this to your .hps file:

Spoiler below!


void OnEnter()
{
void AddUseItemCallback("usekey", "cellkey_1", "celldoor_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("celldoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "celldoor_1", 0, false);
RemoveItem("cellkey_1");
}

////////////////////////////
// Run when Leaving map
void onleave
{
}



Now cant i even find the map in the Custom storyies in game :'( this is what i have in CFG

[code<Main
Name = "The Castle"
Author = "Hasse951 "
ImgFile = "story.png"
MapsFolder = "maps/"
StartMap = "00.intro.map"
StartPos = ""
/>][/code]

this LAng
PHP Code:
<LANGUAGE>


 <
CATEGORY Name="CustomStoryMain">
 <
Entry Name="Description">This is the story about Jonah was prisoner in the castle in middle of now were.</Entry>
 </
CATEGORY>

 <
CATEGORY Name ="Inventory">
 <
Entry Name="ItemDesc_key_1">"Cell Key"</Entry>
 <
Entry Name="ItemName_ckey_1">Cell Key</Entry

 
</CATEGORY>
 </
LANGUAGE

And this ph File in Intro

[php////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "celldoor_1", "UsedKeyOnDoor", true);

}
{
UsedKeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("celldoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "celldoor_1", 0, false);
RemoveItem("key_1");

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

}

[/php]
Btw What i gonna set on Callback func on The door...
Pages: 1 2