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
Level door text
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#1
Level door text

Hello!
How do i make a text appear in the screen when the player looks at a level door? Here is my script file:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "Khii", "Lockedd", "KeyOnDoor", true);
SetEntityCallbackFunc("Khii", "OnPickup");
AddEntityCollideCallback("Player", "FlyingJesus_1", "HolyJesus", true, 1);
AddEntityCollideCallback("Jesus1", "FlyingJesus_1", "Sound", true, 1);
AddEntityCollideCallback("Player", "Closett", "Monstar", true, 1);
AddEntityCollideCallback("Player", "Slam1", "func_slam", true, 1);
SetEntityCallbackFunc("Avain", "OnPickup");
}

void HolyJesus(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus1", true);
AddPropForce("Jesus1", 0, 0, 20000, "World");
}

void Sound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, false);
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_4", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_5", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_6", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_7", 1, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_8", 2, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_9", 1, "");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Slammer", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(10.0f, true);
}

void Monstar(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Closet", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Lockedd", false, true);
PlaySoundAtEntity("", "unlock_door", "Lockedd", 0, false);
RemoveItem("Khii");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}

And here is my extra_english.lang file:

<LANGUAGE>
<CATEGORY Name="CustomStoryMain">
<Entry Name="Description">It is year 1898 and your name is John Martin.You are a crazy torturer,who doesnt feel mercy.Now the spirits of the dead people are haunting you and causing strange events.You need to find a potion that will free you from the spirits.</Entry>
</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_Test01_Name">Secret Passage</Entry>
<Entry Name="Note_Test01_Text">I've succesfully hidden the hole with a carpet that leads to my torture chambers.Unfortunately my door that was leading there collapsed.So i had to dig a tunnel because the rocks were too heavy to be moved.</Entry>
</CATEGORY>
</LANGUAGE>

(This post was last modified: 01-19-2012, 06:15 PM by Datguy5.)
01-19-2012, 04:38 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Level door text

SetMessage(string& asTextCategory, string& asTextEntry, float afTime);


asTextCategory - the category in the .lang file
asTextEntry - the entry in the .lang file
afTime - determines how long the message is displayed. If time is < =0 then the life time is calculated based on string length

(This post was last modified: 01-19-2012, 04:43 PM by flamez3.)
01-19-2012, 04:43 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#3
RE: Level door text

Ok.What about the language file?And does the text appear when i look at the door?
(This post was last modified: 01-19-2012, 04:52 PM by Datguy5.)
01-19-2012, 04:52 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Level door text

Do you mean like a sign? Like it appears every time you look at it?

01-19-2012, 05:16 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#5
RE: Level door text

Yes,whenever the player looks at it.
01-19-2012, 05:26 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#6
RE: Level door text

Sorry, the only thing I would know is to add a script area over it and make it a "sign". That's all I know about it :/

01-19-2012, 05:29 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#7
RE: Level door text

Should there be this script in the hps file? SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);
01-19-2012, 05:41 PM
Find
oscar1007 Offline
Member

Posts: 64
Threads: 24
Joined: Oct 2011
Reputation: 0
#8
RE: Level door text

http://www.youtube.com/watch?v=2BNFw7PR6d4

Easy Smile

Money can't buy you happiness. But I rather cry in my ferrari.

PROJECT:
http://www.moddb.com/mods/oscar1007
01-19-2012, 05:45 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#9
RE: Level door text

(01-19-2012, 05:45 PM)oscar1007 Wrote: http://www.youtube.com/watch?v=2BNFw7PR6d4

Easy Smile
Thanks!


01-19-2012, 06:12 PM
Find




Users browsing this thread: 5 Guest(s)