Frictional Games Forum (read-only)

Full Version: Activate Monster When I Pick Key
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
How activate monster, (which is in room opposite my room, where is key) after pick key.

The idea is that when you pick up a monster from the other room will start to pry the door to get to my room, where I picked up the key , and then to come out and disappear.
you make a function that makes the monster come into the room.
You add an interact callback to the key, that calls said function.

For further specifics check out the dev wiki, reference existing scripts from frictionalgames or mods, threads with similar questions, or look up the video tutorials from people such as mudbill or thisisyourcomputer on youtube.
Hello, Abihishi,
I see you're making progress. I would divide your question into multiple sub-questions.
  • Calling a function OnPickUp
  • Hinting The Enemy
  • (optional) Enemy Path Nodes

From your question I understand that you want the monster to be a hallucination.
[Image: QROKuRL.png]
You achieve that in Level Editor, by selecting the enemy and checking the Hallucination CheckBox. Keep in mind that the value under it represents the distance at which the monster disappears.
  • Calling a function OnPickUp
This is a function specified on the Dev Wiki as:

PHP Code:
SetEntityPlayerInteractCallback("NameOfEntity""FunctionToCall"true); 
You put that command usually in OnStart() function.
The new function would then be:
PHP Code:
void FunctionToCall(string &in asEntity)
{



or you could use the Callback for an entity:
PHP Code:
SetEntityCallbackFunc("NameOfEntity""FunctionToCall"); 
You put that command usually in OnStart() function.

PHP Code:
void FunctionToCall(string &in asEntitystring &in type
{


  • Hinting The Enemy

A simple command like:
PHP Code:
ShowEnemyPlayerPosition("NameOfEnemy"); 
Makes the enemy charge towards the player even if it doesn't see him.
You put that into the FuctionToCall of your choice.

  • (optional) Enemy Path Nodes

If the enemy has trouble getting through your level, try searching for Enemy Path Nodes on Wiki or on Google, it might help you out.

There's even a great video by Mudbill.
Hmm, yes. Before 2 weeks i see video when guy make monster paths, so i watch Mudbill video and i try make this paths.

Mhmhhm..... i made how in video, but i changed scriptarea in my key but this not work. I does not want scriptarea, when my character must enter in this area.
Ok i try make this Calling a function OnPickUp but, this is good script?

SetEntityCallbackFunc("servant_grunt_1", "key0");
(02-21-2016, 08:30 PM)Abihishi Wrote: [ -> ]Ok i try make this Calling a function OnPickUp but, this is good script?

SetEntityCallbackFunc("servant_grunt_1", "key0");

figure it out by testing.
This not work ;p
It does not work - then what happens? Do you get an error?
No, its no error information, but in game this not work. When i pick key, monster not work. I no see him, and no hear.
The command you chose refers to a Function that you will need to create.
PHP Code:
SetEntityCallbackFunc("servant_grunt_1""key0"); 
In plain words you are saying:
If player touches servant_grunt_1, then run key0 function.
That's not what you want.

The script you most likely want is:
PHP Code:
void OnStart()
{
    
SetEntityCallbackFunc("NameOfEntity""MonsterAppearanceFunc"); //NameOfEntity = Name of the key
}

void MonsterAppearanceFunc(string &in asEntitystring &in type//The name of this function was in the callback earlier
{
    
SetEntityActive("NameOfEnemy"true); //Remember to change NameOfEnemy
    
ShowEnemyPlayerPosition("NameOfEnemy"); //Remember to change NameOfEnemy


If you have no idea what you're supposed to change to what, you can use the
I don't know what I'm supposed to change version:
Spoiler below!

PHP Code:
string EnemyName "Servant_grunt_1"//Change this to your monster's name;ยจ
string ItemName "key_0"//Change this to your key's name;

void OnStart()
{
    
SetEntityCallbackFunc(ItemName"MonsterAppearanceFunc");
}

void MonsterAppearanceFunc(string &in asEntitystring &in type)
{
    
SetEntityActive(EnemyNametrue);
    
ShowEnemyPlayerPosition(EnemyName);


I dont know why, but when i start game i see error.
https://scr.hu/0unb/gl2sm
Pages: 1 2