10-15-2010, 02:02 AM
I tried getting these two things in it to work, but it just seems broken. And by the way, I was attempting to replace a "needle" for a "key". I worked with both of these scripts on my other custom story and it work perfectly. Also for some reason, it won't set the lamp oil to 0...
The entities in my game are: CastleDoor, CastleDoor2, and Needle.
Code:
void Onstart()
{
AddUseItemCallback("" , "Needle" , "CastleDoor2" , "UsedNeedleOnDoor" , false);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "Collide01" , true , 1);
SetPlayerLampOil(0);
}
void Collide01(string &in asParent , string &in asChild , int alState)
{
SetSwingDoorClosed("CastleDoor" , true , true);
GiveSanityDamage(10 , true);
}
void UsedNeedleOnDoor(string &in asItem , string &in asEntity)
{
PlaySoundAtEntity("UnlockSound" , "unlock_door.snt" , asEntity , 0.0f , false);
SetSwingDoorLocked(asEntity , false , true);
SetLevelDoorLocked(asEntity , false);
}
void OnEnter()
{
}
void OnLeave()
{
}
Code:
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You awaken in a castle, not knowing of where you are. Some dark presence is following you, yet you cannot stop it.[br][br]You are alone...</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_Needle">Sewing Needle</Entry>
<Entry Name="ItemDesc_Needle">A simple needle that could be used to pick a lock.</Entry>
</CATEGORY>
</LANGUAGE>
The entities in my game are: CastleDoor, CastleDoor2, and Needle.
Code:
void Onstart()
{
AddUseItemCallback("" , "Needle" , "CastleDoor2" , "UsedNeedleOnDoor" , false);
AddEntityCollideCallback("Player" , "ScriptArea_1" , "Collide01" , true , 1);
SetPlayerLampOil(0);
}
void Collide01(string &in asParent , string &in asChild , int alState)
{
SetSwingDoorClosed("CastleDoor" , true , true);
GiveSanityDamage(10 , true);
}
void UsedNeedleOnDoor(string &in asItem , string &in asEntity)
{
PlaySoundAtEntity("UnlockSound" , "unlock_door.snt" , asEntity , 0.0f , false);
SetSwingDoorLocked(asEntity , false , true);
SetLevelDoorLocked(asEntity , false);
}
void OnEnter()
{
}
void OnLeave()
{
}
Code:
<LANGUAGE>
<RESOURCES>
</RESOURCES>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">You awaken in a castle, not knowing of where you are. Some dark presence is following you, yet you cannot stop it.[br][br]You are alone...</Entry>
</CATEGORY>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_Needle">Sewing Needle</Entry>
<Entry Name="ItemDesc_Needle">A simple needle that could be used to pick a lock.</Entry>
</CATEGORY>
</LANGUAGE>