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?
Verkehr Offline
Member

Posts: 60
Threads: 13
Joined: Oct 2016
Reputation: 1
#19
RE: Sub-text?

(10-23-2016, 03:38 PM)FlawlessHappiness Wrote: 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.

It drains only once, making it lok like the note just appeared, as it's normally not active, until the other note is picked up. So in fact I use the areas? That is already better, can you just give me for that the command(s)? Thanks.

Also, how do you insert PHP Codes like that?

Hey, you don't have to tell me how to make it with the area, I did it myself. Just now to make it look by force at the player, I think I've seen it at the engine scripts. Thanks for helping me. Smile
(This post was last modified: 10-23-2016, 05:18 PM by Verkehr.)
10-23-2016, 05:04 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: 5 Guest(s)