04-24-2012, 11:19 PM
Ok hi! I know you hear this a lot but I am new to the whole making of customstories and Im not good with scripting. I tried to read some about it but i get dizzy and get headaches so I figured you guys might help me and teach me a thing about this problem of mine.
So what I have done is that I have created an area that closes a door behind me on collision and what I wanted to do next was to make a sound play as i enter the new room.
Script as it looks like so far:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "Unlock_door", "door_1", 0, false);
RemoveItem("keyl_1");
}
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "DoorCloseFunc1" , true , 1);
}
void DoorCloseFunc1(string &in asParent , string &in asChild , int alState)
{
SetSwingDoorClosed("door_1", true, true);
}
void OnStart()
{
PreloadSound("00_laugh.snt");
AddEntityCollideCallback("Player", "ScriptArea_1", "Sound", true, 1);
}
void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "00_laugh.snt", "ScriptArea_1", 0.0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I get the error 21,1 : a funtion with the same name and parameter already exists
So what should I do? I want to learn more.
So what I have done is that I have created an area that closes a door behind me on collision and what I wanted to do next was to make a sound play as i enter the new room.
Script as it looks like so far:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "Unlock_door", "door_1", 0, false);
RemoveItem("keyl_1");
}
void OnStart()
{
AddEntityCollideCallback("Player" , "ScriptArea_1" , "DoorCloseFunc1" , true , 1);
}
void DoorCloseFunc1(string &in asParent , string &in asChild , int alState)
{
SetSwingDoorClosed("door_1", true, true);
}
void OnStart()
{
PreloadSound("00_laugh.snt");
AddEntityCollideCallback("Player", "ScriptArea_1", "Sound", true, 1);
}
void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sound", "00_laugh.snt", "ScriptArea_1", 0.0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I get the error 21,1 : a funtion with the same name and parameter already exists
So what should I do? I want to learn more.