Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Im sure this is easier than i am making it...
kevinsme2005isme13 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#1
Im sure this is easier than i am making it...

Please help! I have an error when i run my custom map. Its in the last line and character of this script, and i cant figure it out, please point me in the right direction. Thank you in advance!

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_cabinet_1", "cabinet_1", "KeyOnDoor2", true);
AddUseItemCallback("", "exitkey_1", "exitdoor_1", "KeyOnDoor3", true);
AddUseItemCallback("", "exitkey_2", "exitdoor_2, "KeyOnDoor4", true);
AddUseItemCallback("", "exitkey_3", "exitdoor_3", "KeyOnDoor5", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "MonsterFunction2", true, 1);
}

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

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cabinet_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_cabinet_1");
}

void KeyOnDoor3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("exitdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "exitdoor_1", 0, false);
RemoveItem("exitkey_1");
}

void KeyOnDoor4(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("exitdoor_2", false, true);
PlaySoundAtEntity("", "unlock_door", "exitdoor_2", 0, false);
RemoveItem("exitkey_2");
}

void KeyOnDoor5(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("exitdoor_3", false, true);
PlaySoundAtEntity("", "unlock_door", "exitdoor_3", 0, false);
RemoveItem("exitkey_3");
}

void MonsterFunction1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_1", true);
SetSwingDoorLocked("trapdoor_1", true, true);
}

void MonsterFunction2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_2", true);
SetSwingDoorLocked("trapdoor_1", true, true);
}
////////////////////////////
//Run when entering map
void OnEnter()
{

}

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

}
07-31-2012, 05:13 AM
Find
Kazakarumariou Away
An angry man.

Posts: 283
Threads: 8
Joined: Jul 2012
Reputation: 14
#2
RE: Im sure this is easier than i am making it...

It says it's the last line in the script, but it's really not. What's the error? is it "Unexpected end of file"?
07-31-2012, 05:20 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Im sure this is easier than i am making it...

AddUseItemCallback("", "exitkey_2", "exitdoor_2", "KeyOnDoor4", true); ///here

You were missing a quotation after "exitdoor_2".

In addition, I modified your callbacks a bit using some "shortcuts"; this will greatly reduce excess lines of script and make it less cluttered; be sure to remove all of the other functions for the keys/doors that aren't "UseKeyOnDoor". If you can't get this to work, you can just use the one fix I pointed out.



////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "key_1", "door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_cabinet_1", "cabinet_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "exitkey_1", "exitdoor_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "exitkey_2", "exitdoor_2", "UseKeyOnDoor", true); ///here
AddUseItemCallback("", "exitkey_3", "exitdoor_3", "UseKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "MonsterFunction2", true, 1);
}


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




void MonsterFunction1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_1", true);
SetSwingDoorLocked("trapdoor_1", true, true);
}


void MonsterFunction2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("enemy_2", true);
SetSwingDoorLocked("trapdoor_1", true, true);
}


////////////////////////////
//Run when entering map
void OnEnter()
{


}


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


}
Hope that helped!

I rate it 3 memes.
(This post was last modified: 07-31-2012, 05:24 AM by Adny.)
07-31-2012, 05:21 AM
Find
kevinsme2005isme13 Offline
Junior Member

Posts: 2
Threads: 1
Joined: Jul 2012
Reputation: 0
#4
RE: Im sure this is easier than i am making it...

Ahh thank you very much! How silly of me to miss a quote. Also, thanks for helping clean up that script, it was looking quite messy. Its my first few hours into this, and i really do appreciate the help!
07-31-2012, 05:34 AM
Find




Users browsing this thread: 1 Guest(s)