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
Sub-text?
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#18
RE: Sub-text?

How I understand what you want:
There is a note in your level.
When the player looks at that note, his sanity is drained.
If the player looks at the note again, his sanity drains again(?).

You want to create a LookAtCallback.
You can already find this in the API: https://wiki.frictionalgames.com/doku.ph..._functions

PHP Code: (Select All)
void SetEntityPlayerLookAtCallback(stringasNamestringasCallbackbool abRemoveWhenLookedAt); 

Calls a function when the player looks at a certain entity.
Callback syntax: void MyFunc(string &in asEntity, int alState)
alState: 1 = looking, -1 = not looking

asName - internal name
asCallback - function to call
abRemoveWhenLookedAt - determines whether the callback should be removed when the player looked at the entity

So what it says here is that you want to create the callback in your OnStart().

PHP Code: (Select All)
void OnStart()
{
    
void SetEntityPlayerLookAtCallback("note_room_1_3""note_room_1_4"false);
}

void note_room_1_4(string &in asEntitystring &in alState)
{
    
GiveSanityDamage (25true);


Now, this script only works if the player looks DIRECTLY at the note, meaning the crosshair is ON the note.
If what you really want is when the note is only visible on the screen it is going be a bit harder.
You can work around this by creating a ScriptArea instead, and use that the entity of which you look at.

Trying is the first step to success.
(This post was last modified: 10-23-2016, 03:38 PM by FlawlessHappiness.)
10-23-2016, 03:38 PM
Find


Messages In This Thread
Sub-text? - by Verkehr - 10-21-2016, 01:52 PM
RE: Sub-text? - by Mudbill - 10-21-2016, 02:43 PM
RE: Sub-text? - by Romulator - 10-22-2016, 02:59 AM
RE: Sub-text? - by FlawlessHappiness - 10-22-2016, 12:42 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 01:20 PM
RE: Sub-text? - by Romulator - 10-22-2016, 01:45 PM
RE: Sub-text? - by Mudbill - 10-22-2016, 02:40 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 03:34 PM
RE: Sub-text? - by Mudbill - 10-22-2016, 05:23 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 05:34 PM
RE: Sub-text? - by Mudbill - 10-22-2016, 05:50 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 06:05 PM
RE: Sub-text? - by Mudbill - 10-22-2016, 06:52 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 07:04 PM
RE: Sub-text? - by Mudbill - 10-22-2016, 09:42 PM
RE: Sub-text? - by Verkehr - 10-22-2016, 10:48 PM
RE: Sub-text? - by Verkehr - 10-23-2016, 02:33 PM
RE: Sub-text? - by FlawlessHappiness - 10-23-2016, 03:38 PM
RE: Sub-text? - by Verkehr - 10-23-2016, 05:04 PM
RE: Sub-text? - by FlawlessHappiness - 10-23-2016, 07:10 PM
RE: Sub-text? - by Verkehr - 10-23-2016, 08:21 PM



Users browsing this thread: 1 Guest(s)