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?
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#11
RE: Sub-text?

Does anything else in your script work? Can you post the entire script file? Instead of adding the callback in the level editor, you can add this script in OnStart

PHP Code: (Select All)
SetEntityPlayerInteractCallback("key_name""damage_key_1"true); 

(This post was last modified: 10-22-2016, 05:51 PM by Mudbill.)
10-22-2016, 05:50 PM
Find
Verkehr Offline
Member

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

(10-22-2016, 05:50 PM)Mudbill Wrote: Does anything else in your script work? Can you post the entire script file? Instead of adding the callback in the level editor, you can add this script in OnStart

PHP Code: (Select All)
SetEntityPlayerInteractCallback("key_name""damage_key_1"true); 

I realized the mistake, when I made the PlayerOnInteract thing, I didn't enter, resulting in itself not saving properly, so the script didn't work. Now I got it fixed, just please tell me how to open debug mode for any needs and what sound I can use for when someone picks up the key and he gets damaged, it's pointless to have a damage source without a sound.

Now you can see my Hell, where I make basic mistakes. X3
(This post was last modified: 10-22-2016, 06:06 PM by Verkehr.)
10-22-2016, 06:05 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#13
RE: Sub-text?

You can use PlayGuiSound to play a sound along with the damage. Find a sound file in the /sounds/player folder. You can use VLC to play .ogg files.

As for debug mode, go to Documents\Amnesia\Main\<your user>\user_settings.cfg and edit ScriptDebugOn="false" to be true. You can also edit other things in that config, along with main_settings.cfg in the folder above. Use F1 in-game to open the debug menu.

(This post was last modified: 10-22-2016, 06:54 PM by Mudbill.)
10-22-2016, 06:52 PM
Find
Verkehr Offline
Member

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

(10-22-2016, 06:52 PM)Mudbill Wrote: You can use PlayGuiSound to play a sound along with the damage. Find a sound file in the /sounds/player folder. You can use VLC to play .ogg files.

As for debug mode, go to Documents\Amnesia\Main\<your user>\user_settings.cfg and edit ScriptDebugOn="false" to be true. You can also edit other things in that config, along with main_settings.cfg in the folder above. Use F1 in-game to open the debug menu.

I thought to use the slime attack sounds, and also thanks for telling me that! Big Grin

The In-Game Debug doesn't work! Just that you know, I use a laptop. Here's the file of my user. What is wrong inside of it? :/
(This post was last modified: 10-22-2016, 07:13 PM by Verkehr.)
10-22-2016, 07:04 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#15
RE: Sub-text?

Try setting LoadDebugMenu="false" to true as well inside the main_settings.cfg file.

10-22-2016, 09:42 PM
Find
Verkehr Offline
Member

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

(10-22-2016, 09:42 PM)Mudbill Wrote: Try setting LoadDebugMenu="false" to true as well inside the main_settings.cfg file.

Thanks, it works now! :D
10-22-2016, 10:48 PM
Find
Verkehr Offline
Member

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

Just one more question: I am now making one part where when you take a note, another one becomes active, and it drains your sanity. This is the script I made:
void note_room_1_4 (string &in asEntity, int alState)
{
GiveSanityDamage (25, true);
}
How do I make it drain the sanity whenever the player looks at the new note from any distance, not just when it's pickupable? Just that and I will be fine for a while. X) Also the note that triggers the appearing is called note_room_1_3, and the note that appears is called all along note_room_1_4.

With "all along", I mean that wherever it's supposed to trigger something, I call it the same as it's in Editor name, so the string used.
(This post was last modified: 10-23-2016, 02:34 PM by Verkehr.)
10-23-2016, 02:33 PM
Find
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
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
FlawlessHappiness Offline
Posting Freak

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

Glad you got it figured out yourself.

You can insert php code simply by writing

[ php ] without spaces, to start.
and
[/ php ] without spaces, to end.

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




Users browsing this thread: 1 Guest(s)