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


Thread Rating:
  • 5 Vote(s) - 3.8 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting, need urgent help!
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#41
RE: Scripting, need urgent help!

what about the key? Check and see if thats the same too. Did you remember to hit Enter after changing the name? Otherwise this might be a distance problem.. let me test it again and put the monster further away.
Tested it again and put the monster a lot further away.. it still worked. /:

Ba-da bing, ba-da boom.
(This post was last modified: 07-24-2011, 02:04 AM by JenniferOrange.)
07-24-2011, 01:58 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#42
RE: Scripting, need urgent help!

The key? One second, let me get all this right:

void OnStart()
{
AddUseItemCallback("", "upstairskey_1", "leveltransferdoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("leveltransferdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "leveltransferdoor_1", 0, false);
RemoveItem("upstairskey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}
void OnLeave ()
{

}

What are the other things I should change?

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 02:13 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#43
RE: Scripting, need urgent help!

Monster's name is correct. Everything else looks fine to me..

void OnStart()
{
AddUseItemCallback("", "upstairskey_1", "leveltransferdoor_1", "UsedKeyOnDoor", true);
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("leveltransferdoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "leveltransferdoor_1", 0, false);
RemoveItem("upstairskey_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}

void OnEnter()
{

}


void OnLeave ()
{

}

Just be sure the key name matches as well. I have no idea what's going on, and the only way I could try and fix it for you is to open your map. Sad
(BTW- while waiting for your replies, I'm watching you play Snowed In on YouTube. You're very entertaining, hehe. But do I spy Toby Turner references in there? Wink *gimme gimme*)

Ba-da bing, ba-da boom.
(This post was last modified: 07-24-2011, 02:23 AM by JenniferOrange.)
07-24-2011, 02:21 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#44
RE: Scripting, need urgent help!

I got the door break down on que working now! Big Grin

Now I am just struggling with trying to get the key from the cellar, to the foyer, and working... SO MANY FATAL ERRORS Sad

Yes, yes you do spot Toby Turner references, though they are totally accidental! XD

Glad you like the videos! I cant wait to do yours and Mr. C's when you guys are done!

What can you see wrong?
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
{
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

(This post was last modified: 07-24-2011, 02:39 AM by JetlinerX.)
07-24-2011, 02:34 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#45
RE: Scripting, need urgent help!

Fatal errors, oh dear. D: From what I know, if you pick up the key in the cellar, it will stay in your inventory when you go into the foyer. So, that being said..
You need to remove the 'using key' script from your cellar.hps and put it in your foyer.hps. As in..

void OnStart()
{
SetEntityCallbackFunc("upstairskey_1", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("*monsters name in editor*", true);
ShowEnemyPlayerPosition("*same as above*");
}

void OnEnter()
{

}

void OnLeave ()
{

}

THAT should be in your cellar.hps. Everything I removed shoud go into your foyer.hps, because that's where the door is located.


Let me see what your fatal errors say, along with your entire .hps file, including the OnStart() portion so I can see what it's getting mad at. I have a feeling it may be because of the repeating UsedKeyOnDoor function.
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "upstairskey", "upstairsdoor", "KeyOnDoor2", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
{
void KeyOnDoor2(string &in asItem, string &in asEntity)
}
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Everything I bolded is what I changed. Keys are sensitive, and using many in one map is always a pain in the butt. Smile You can't repeat functions or AngelScript will get pissed. xD
Ooh, whoops. Found another error. xD I see your void KeyOnDoor2 function has brackets around it.. that's a no-no! void is just there, it never means anything, therefore it doesn't need any brackets.

////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "KeyOnDoor", true);
AddUseItemCallback("", "upstairskey", "upstairsdoor", "KeyOnDoor2", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}

void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("upstairsdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "upstairsdoor", 0, false);
RemoveItem("upstairskey");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

That should work. Smile

Ba-da bing, ba-da boom.
(This post was last modified: 07-24-2011, 02:52 AM by JenniferOrange.)
07-24-2011, 02:40 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#46
RE: Scripting, need urgent help!

Okay! AWESOME! Sooooo...

This:
////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Should say what? The code that is already there, CAN NOT BE CHANGED! Thats for another door that I got right the first time. How do I add another door to unlock in here? It usually tells me you already have a code with that name retard! So just edit this script and paste it back how it should look and I will see if I can see what you did! LOL!

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 02:55 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#47
RE: Scripting, need urgent help!

////////////////////////////
// Run when entering map
void OnEnter ()
{
AddUseItemCallback("", "mainkey_1", "maindoor_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("maindoor_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "maindoor_1", 0, false);
RemoveItem("mainkey_1");
}
///////////////////////////
//Run when leaving map
void OnLeave ()
{

}

Adding the .snt is the only thing I would change in that script, otherwise that's fine. Is this your cellar script or your foyer script?

Ba-da bing, ba-da boom.
07-24-2011, 03:00 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#48
RE: Scripting, need urgent help!

1. Whats the SNT do? Because it works without it too.

2. Thats the foyer, but I need to know how to add the unlock for the upstairs door on that too. The current code is just for a door in the very begging.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 03:01 AM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#49
RE: Scripting, need urgent help!

And to add another key to that script, it depends, are you talking unlocking a normal swing door or unlocking a level door?
.snt isn't necessary, it's just the sound extension. You don't have to add it, it makes no difference, but I like to sometimes.

Ba-da bing, ba-da boom.
(This post was last modified: 07-24-2011, 03:04 AM by JenniferOrange.)
07-24-2011, 03:03 AM
Find
JetlinerX Offline
Senior Member

Posts: 599
Threads: 49
Joined: Jun 2011
Reputation: 19
#50
RE: Scripting, need urgent help!

Its a level transfer, its the one at the top of the stairs. Its unlocked by the key in the cellar... I just need to know how to add another unlock script in that page of code without fatal errors.

Lead Developer of "The Attic"
~Slade Mitchell

Chapter 3 (REL)

07-24-2011, 03:10 AM
Website Find




Users browsing this thread: 3 Guest(s)