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 Need help with several scripts.
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#7
RE: Need help with several scripts.

--How do I make a message using the if/else command appear when trying to open a swing door after an event occured? (door slammed shut behind the player and got locked).
I think you should go for this:
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);
Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity)

asName - internal name
asCallback - function to call
abRemoveOnInteraction - determines whether the callback should be removed when the player interacts with the entity

Paste that callback in the same function as the door slam occurs. make sure to replace the variables.
asName for the door name
asCallback for the name of function which will happen below
abRemoveOnInteraction should be on false, since you want to always see that text.

now for the function, for this we use the callback syntax void MyFunc(string &in asEntity) :

void YourFunctionNameHere(string &in asEntity)
{
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
}

Now for the SetMessage one:
asTextCategory and TextEntry: for those you have to edit the .lang file. Choose any category name and any Entry name, you can for example choose "Locked" as Category and "Basement" as the Entry name, it's all up to you.
afTime: How long the message will be displayed. A "0" will cause the life time to be calculated using the string length.

So, in the end, it may look like this:
//Inside the door slam function:
void Doorslamfunction(whatever callback you used)
{
SetEntityPlayerInteractCallback("DoorNameHere", "DisplayText", false);
}
//Anywhere not inside a function, like OnStart():
void DisplayText(string &in asEntity)
{
SetMessage("Locked", "Basement", 0);
}
for the .lang file:
<LANGUAGE>
<CATEGORY Name="Locked">
<Entry Name="Basement">The door is locked. Damn!</Entry>
</CATEGORY>
</LANGUAGE>

Sorry for the lang post, but wanted to make sure you understand it. You can ask me/us if you still got a question on this one.
06-26-2012, 09:54 PM
Find


Messages In This Thread
Need help with several scripts. - by Randael - 06-22-2012, 11:28 PM
RE: Need help with several scripts. - by Randael - 06-23-2012, 03:05 PM
RE: Need help with several scripts. - by Randael - 06-23-2012, 06:09 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 09:19 PM
RE: Need help with several scripts. - by Cruzore - 06-26-2012, 09:54 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 10:04 PM
RE: Need help with several scripts. - by Cruzore - 06-26-2012, 11:04 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 11:31 PM
RE: Need help with several scripts. - by Cruzore - 06-27-2012, 12:46 PM
RE: Need help with several scripts. - by Cruzore - 06-28-2012, 12:15 AM
RE: Need help with several scripts. - by Randael - 06-28-2012, 09:43 AM



Users browsing this thread: 5 Guest(s)