Frictional Games Forum (read-only)

Full Version: Help Please with Scripting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello , i have recently purchased Amnesia and love it. I want to make a map but i have tried numurous times and i cant get the following scripts to work
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("OpenLockedDoor", "key_1", "level_celler_1", "UnlockLevelDoor", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

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

}
void UnlockLevelDoor(string &in item,string &in entity)
{
SetLevelDoorLocked(Entity, false);
// RemoveItem(Item);
}
and
<LANGUAGE>
<CATEGORY Name="TutorialStory">
<Entry Name="Description">nothing yet</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemDesc_studyKey_1">key for unlocking celler</Entry>
<Entry Name="ItemName_studyKey_1">Celler key</Entry>
</CATEGORY>
</LANGUAGE>
I would like to have a basic tutorial that works for me or a skype helper. All the tutorials dont work for me and i have tried lots.
Thank you
abelloyd
Help with scripting and mapping is supposed to be in the Development Support thread Smile

But have you named your key StudyKey_1 in both the name and the CustomSubItemName?

write the script like this,

Code:
////////////////////////////

// Run when the map starts

void OnStart()

{

AddUseItemCallback("", "NAMEOFKEY", "NAMEOFDOOR", "UnlockLevelDoor", true);

}

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

// Run when entering map

void OnEnter()

{

}



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

// Run when leaving map

void OnLeave()

{



}

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

{

SetLevelDoorLocked(asEntity, false);

RemoveItem(asItem);

}
Il check

yeah i did
some reson the door still dosent work?
hmm.. can you post the script you got now?
void OnEnter()

{

}


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

// Run when leaving map

void OnLeave()

{


}

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

{

SetLevelDoorLocked(asEntity, false);

RemoveItem(asItem);

}

soz heres the full thing
////////////////////////////

// Run when the map starts

void OnStart()

{

AddUseItemCallback("", "key_1", "level_celler_1", "UnlockLevelDoor", true);

}

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

// Run when entering map

void OnEnter()

{

}


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

// Run when leaving map

void OnLeave()

{


}

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

{

SetLevelDoorLocked(asEntity, false);

RemoveItem(asItem);

}
Try renaming the key to StudyKey_1 in both the name and the CustomSubItemName and then change

AddUseItemCallback("", "key_1", "level_celler_1", "UnlockLevelDoor", true);

to

AddUseItemCallback("", "StudyKey_1", "level_celler_1", "UnlockLevelDoor", true);
oh ok
Use this:


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

// Run when the map starts

void OnStart()

{

AddUseItemCallback("", "key_1", "level_celler_1", "UnlockLevelDoor", true);

}


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

{

SetLevelDoorLocked(asEntity, false);

RemoveItem(asItem);

}

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

// Run when entering map

void OnEnter()

{

}


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

// Run when leaving map

void OnLeave()

{


}

When scripting make sure that void OnStart() functions stay within the void OnStart() brackets and so on.
(03-31-2012, 04:36 PM)flamez3 Wrote: [ -> ]Use this:


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

// Run when the map starts

void OnStart()

{

AddUseItemCallback("", "key_1", "level_celler_1", "UnlockLevelDoor", true);

}


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

{

SetLevelDoorLocked(asEntity, false);

RemoveItem(asItem);

}

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

// Run when entering map

void OnEnter()

{

}


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

// Run when leaving map

void OnLeave()

{


}

When scripting make sure that void OnStart() functions stay within the void OnStart() brackets and so on.
It's not really necessary from what I know since FG wrote all their code above all the On's


Pages: 1 2