Frictional Games Forum (read-only)
Help Please with Scripting - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Help Please with Scripting (/thread-14380.html)

Pages: 1 2


Help Please with Scripting - abe.lloyd - 03-31-2012

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



RE: Help Please with Scripting - SilentStriker - 03-31-2012

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);

}



RE: Help Please with Scripting - abe.lloyd - 03-31-2012

Il check

yeah i did



RE: Help Please with Scripting - abe.lloyd - 03-31-2012

some reson the door still dosent work?


RE: Help Please with Scripting - SilentStriker - 03-31-2012

hmm.. can you post the script you got now?



RE: Help Please with Scripting - abe.lloyd - 03-31-2012

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);

}



RE: Help Please with Scripting - SilentStriker - 03-31-2012

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);



RE: Help Please with Scripting - abe.lloyd - 03-31-2012

oh ok


RE: Help Please with Scripting - flamez3 - 03-31-2012

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.


RE: Help Please with Scripting - SilentStriker - 03-31-2012

(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