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
Activate Monster When I Pick Key
Abihishi Offline
Junior Member

Posts: 44
Threads: 8
Joined: Feb 2016
Reputation: 0
#1
Activate Monster When I Pick Key

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.
02-21-2016, 05:59 PM
Find
WALP Offline
Posting Freak

Posts: 1,221
Threads: 34
Joined: Aug 2012
Reputation: 45
#2
RE: Activate Monster When I Pick Key

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.
02-21-2016, 06:07 PM
Find
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#3
RE: Activate Monster When I Pick Key

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: (Select All)
SetEntityPlayerInteractCallback("NameOfEntity""FunctionToCall"true); 
You put that command usually in OnStart() function.
The new function would then be:
PHP Code: (Select All)
void FunctionToCall(string &in asEntity)
{



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

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


  • Hinting The Enemy

A simple command like:
PHP Code: (Select All)
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.
(This post was last modified: 02-21-2016, 06:30 PM by Spelos.)
02-21-2016, 06:24 PM
Find
Abihishi Offline
Junior Member

Posts: 44
Threads: 8
Joined: Feb 2016
Reputation: 0
#4
RE: Activate Monster When I Pick Key

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");
(This post was last modified: 02-21-2016, 08:01 PM by Abihishi.)
02-21-2016, 07:28 PM
Find
WALP Offline
Posting Freak

Posts: 1,221
Threads: 34
Joined: Aug 2012
Reputation: 45
#5
RE: Activate Monster When I Pick Key

(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.
02-21-2016, 08:50 PM
Find
Abihishi Offline
Junior Member

Posts: 44
Threads: 8
Joined: Feb 2016
Reputation: 0
#6
RE: Activate Monster When I Pick Key

This not work ;p
02-22-2016, 03:44 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#7
RE: Activate Monster When I Pick Key

It does not work - then what happens? Do you get an error?

Discord: Romulator#0001
[Image: 3f6f01a904.png]
02-22-2016, 03:57 PM
Find
Abihishi Offline
Junior Member

Posts: 44
Threads: 8
Joined: Feb 2016
Reputation: 0
#8
RE: Activate Monster When I Pick Key

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.
02-22-2016, 04:08 PM
Find
Spelos Away
Banned

Posts: 231
Threads: 19
Joined: Sep 2014
#9
RE: Activate Monster When I Pick Key

The command you chose refers to a Function that you will need to create.
PHP Code: (Select All)
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: (Select All)
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: (Select All)
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);


(This post was last modified: 02-22-2016, 05:23 PM by Spelos.)
02-22-2016, 04:46 PM
Find
Abihishi Offline
Junior Member

Posts: 44
Threads: 8
Joined: Feb 2016
Reputation: 0
#10
RE: Activate Monster When I Pick Key

I dont know why, but when i start game i see error.
https://scr.hu/0unb/gl2sm
02-22-2016, 04:56 PM
Find




Users browsing this thread: 1 Guest(s)