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
Text ingame- Script help
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#1
Text ingame- Script help

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
- Huh Xero
01-22-2012, 04:17 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#2
RE: Text ingame- Script help

You'll need to do a category to the .lang file for your texts.

Replace this to yous .hps file:

Spoiler below!

SetMessage("Messages", "GAH", 5);



And this to your .lang file:
Spoiler below!

<CATEGORY Name="Messages">
<Entry Name="GAH">GAH! Locked... I will need a key. </Entry>
</CATEGORY>


It should work thenSmile

I fixed your .hps file a littleSmile
Spoiler below!


void OnStart()
{
AddEntityCollideCallback("Player ", "AreaHelp ", "CollideAreaHelp ", false, 1);
}


void CollideAreaHelp(string &in asParent, string &in asChild, int alState)
{
if(HasItem("cellar_key") == true)
{
SetMessage("Messages", "HasKey", 5);

}
else
{
SetMessage("Messages", "GAH", 5);
}


}

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

}

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

}



When Life No Longer Exists
Full-conversion mod
(This post was last modified: 01-22-2012, 04:47 PM by Unearthlybrutal.)
01-22-2012, 04:25 PM
Website Find
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#3
RE: Text ingame- Script help

Shall I simply copy the hps you put there and paste it into my .hps?
Thanks!

Lang file now (after edits):
______________________________________
<LANGUAGE>
<CATEGORY Name="Alone">
<Entry Name="Description">My part in history.</Entry>
</CATEGORY>

<CATEGORY Name="Journal">
<Entry Name="Note_Test01_Name">History.</Entry>
<Entry Name="Note_Test01_Text">I cannot wait any longer to get started with my experiments, this will give me the chance to actually try it on a human other than some animals, but this was made for humans, and humans only. Once I find my way out of this room, history shall be written. -1832 Thomas Reifk.</Entry>
<Entry Name="Note_Test02_Name">Fear.</Entry>
<Entry Name="Note_Test02_Text">Tonight I heard something walking outside my study, I know it was no human as I had my servant leave and lock the door. I am almost certain that I saw a shadow as well, may the haunting of my earlier years be returning? If this is true then I must find my old friend, for he may be my only hope at stopping this... Thing at haunting anyone else.</Entry>
<Entry Name="Note_Test03_Name">Grant.</Entry>
<Entry Name="Note_Test03_Text">Hello Thomas, congradulations on your discovery of this new drug, this will be a great use to the world. This letter grants you $15,000 to continue research and imrpove this drug. Meanwhile we have three voulenteers that would like to help you with this research, they would like to have the drug tested on themselves.
LIST OF VOULENTEERS:
Davind Rindol-
-Tyler Ornent-
-Neille Caferik.</Entry>
</CATEGORY>

<CATEGORY Name="Messages">
<Entry Name="GAH">GAH! Locked... I will need a key. </Entry>
</CATEGORY>

</LANGUAGE>

_______________
There are four spaces before <Entry Name="GAH">GAH! Locked... I will need a key. </Entry>
(This post was last modified: 01-22-2012, 04:45 PM by Xeronaile.)
01-22-2012, 04:39 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#4
RE: Text ingame- Script help

You can copy the .hps Smile

Put this to your .lang, I fixed the second message
<CATEGORY Name="Messages">
<Entry Name="GAH">GAH! Locked... I will need a key.</Entry>
<Entry Name="HasKey">This key will unlock the door.</Entry>
</CATEGORY>

I've fixed your .hps a couple of times. Make sure that you have the latest fixSmile

When Life No Longer Exists
Full-conversion mod
(This post was last modified: 01-22-2012, 04:46 PM by Unearthlybrutal.)
01-22-2012, 04:42 PM
Website Find
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#5
RE: Text ingame- Script help

Ahh Ok, I'll try that.

HPS:

void OnStart()
{
AddEntityCollideCallback("Player ", "AreaHelp ", "CollideAreaHelp ", false, 1);
}


void CollideAreaHelp(string &in asParent, string &in asChild, int alState)
{
if(HasItem("cellar_key") == true)
{
SetMessage("Messages", "HasKey", 5);

}
else
{
SetMessage("Messages", "GAH", 5);
}


}

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

}

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

}

_________________________
Lang:


<LANGUAGE>
<CATEGORY Name="Alone">
<Entry Name="Description">History.</Entry>
</CATEGORY>

<CATEGORY Name="Journal">
<Entry Name="Note_Test01_Name">History.</Entry>
<Entry Name="Note_Test01_Text">I cannot wait any longer to get started with my experiments, this will give me the chance to actually try it on a human other than some animals, but this was made for humans, and humans only. Once I find my way out of this room, history shall be written. -1832 Thomas Reifk.</Entry>
<Entry Name="Note_Test02_Name">Fear.</Entry>
<Entry Name="Note_Test02_Text">Tonight I heard something walking outside my study, I know it was no human as I had my servant leave and lock the door. I am almost certain that I saw a shadow as well, may the haunting of my earlier years be returning? If this is true then I must find my old friend, for he may be my only hope at stopping this... Thing at haunting anyone else.</Entry>
<Entry Name="Note_Test03_Name">Grant.</Entry>
<Entry Name="Note_Test03_Text">Hello Thomas, congradulations on your discovery of this new drug, this will be a great use to the world. This letter grants you $15,000 to continue research and imrpove this drug. Meanwhile we have three voulenteers that would like to help you with this research, they would like to have the drug tested on themselves.
LIST OF VOULENTEERS:
Davind Rindol-
-Tyler Ornent-
-Neille Caferik.</Entry>
</CATEGORY>

<CATEGORY Name="Messages">
<Entry Name="GAH">GAH! Locked... I will need a key.</Entry>
<Entry Name="HasKey">This key will unlock the door.</Entry>
</CATEGORY>


</LANGUAGE>
(01-22-2012, 04:42 PM)Unearthlybrutal Wrote: You can copy the .hps Smile

Put this to your .lang, I fixed the second message

GAH! Locked... I will need a key.
This key will unlock the door.


I've fixed your .hps a couple of times. Make sure that you have the latest fixSmile


The map loads but the messages will nto show up.

If this is important... Is there a script to apply a key to open a certain door?
(This post was last modified: 01-22-2012, 05:07 PM by Xeronaile.)
01-22-2012, 04:46 PM
Find
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#6
RE: Text ingame- Script help

It is put into the story- But I cannot see the words appear ingame (I have the area... Etc.)
01-22-2012, 07:22 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#7
RE: Text ingame- Script help

Try this:
Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}


void CollideAreaHelp(string &in asParent, string &in asChild, int alState)
{
if(HasItem("cellar_key") == true)
{
SetMessage("Messages", "HasKey", 5);
}
else
{
SetMessage("Messages", "GAH", 5);
}
}

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

}

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

}


When Life No Longer Exists
Full-conversion mod
(This post was last modified: 01-22-2012, 09:47 PM by Unearthlybrutal.)
01-22-2012, 07:26 PM
Website Find
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#8
RE: Text ingame- Script help

Will do-

Any spaces before them?
Cause I seem to get a crash when I use this .hps


01-22-2012, 09:31 PM
Find
Xeronaile Offline
Junior Member

Posts: 21
Threads: 2
Joined: Jan 2012
Reputation: 0
#9
RE: Text ingame- Script help

Quote: void OnStart()
{
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}


void CollideAreaHelp(string &in asParent, string &in asChild, int alState)
{
if(HasItem("cellar_key") == true)
{
SetMessage("Messages", "HasKey", 5);
}
else
{
SetMessage("Messages", "GAH", 5);
}
}

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

}

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

}

_________________
What I have highlighted in bold,is that supposed to be there?
01-22-2012, 11:24 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#10
RE: Text ingame- Script help

Quote:What I have highlighted in bold,is that supposed to be there?
Yes, it's supposed to be there.

I modified your script once again Smile

Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}


void CollideAreaHelp(string &in asParent, string &in asChild, int alState)
{
if (HasItem("cellar_key") == true) // I added one "space" after "if"
{
SetMessage("Messages", "HasKey", 5);
}
else
{
SetMessage("Messages", "GAH", 5);
}
}

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

}

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

}


When Life No Longer Exists
Full-conversion mod
01-23-2012, 12:02 PM
Website Find




Users browsing this thread: 1 Guest(s)