01-22-2012, 04:17 PM
Since I am an amateur at scripting, or I should say I have no scripting abilities at all besides Void Onstart, Etc.
I made a post asking how to make the custom story show up, and I have that working. But right now I'm trying to give you, the player the ability to see directions on the screen when I walk in front of my door that is locked.
Here is what my .Hps file looks like:
AddEntityCollideCallback("Player","AreaHelp","CollidePlayerWithAreaHelp");
void CollidePlayerWithAreaHelp()
{
if(HasItem("cellar_key") == true)
{
SetMessage("This key will unlock the door.", 5);
}
else
{
SetMessage("GAH! Locked... I will need a key.", 5);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
_______________________________________
As you can see I have everything above the OnStart or OnEnter (I was following the directions for scripting on the wiki). Near my locked door, or directly in front of it I have an area called AreaHelp, then near that area, I have a desk with a key inside of it with the name of (And yes the name that I gave it, not the actual name of the entity) cellar_key, but it's actually a key_study.
Does anyone see anything wrong with it? If someone could tell me how to take screenshots of my level editor on windows then please tell me (I've been too lazy to find out how), and if I have anything wrong please highlight them in bold, or just tell me.
Thanks
- Xero
I made a post asking how to make the custom story show up, and I have that working. But right now I'm trying to give you, the player the ability to see directions on the screen when I walk in front of my door that is locked.
Here is what my .Hps file looks like:
AddEntityCollideCallback("Player","AreaHelp","CollidePlayerWithAreaHelp");
void CollidePlayerWithAreaHelp()
{
if(HasItem("cellar_key") == true)
{
SetMessage("This key will unlock the door.", 5);
}
else
{
SetMessage("GAH! Locked... I will need a key.", 5);
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
_______________________________________
As you can see I have everything above the OnStart or OnEnter (I was following the directions for scripting on the wiki). Near my locked door, or directly in front of it I have an area called AreaHelp, then near that area, I have a desk with a key inside of it with the name of (And yes the name that I gave it, not the actual name of the entity) cellar_key, but it's actually a key_study.
Does anyone see anything wrong with it? If someone could tell me how to take screenshots of my level editor on windows then please tell me (I've been too lazy to find out how), and if I have anything wrong please highlight them in bold, or just tell me.
Thanks
- Xero