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
Look At
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#1
Look At

i want to set an entity active, when the player looks at an area. i saw this http://www.frictionalgames.com/forum/thread-18368.html

but i didnt understand it. i always get fatal error.

my code now:

SetEntityPlayerLookAtCallback("area_lookat_1", true, 1);



void area_lookat_1(string &in asEntity, int alState)
{
SetEntityActive ("armour_nice_complete_4", true);
SetEntityActive ("armour_nice_complete_5", true);
SetEntityActive ("armour_nice_complete_6", true);
SetEntityActive ("armour_nice_complete_7", true);
SetEntityActive ("armour_nice_complete_8", true);
}

When you are looking for someone, to do the scripting for your Custom Story, ask me!
11-13-2012, 04:44 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Look At

You are close.

If you know basic scripting then you should know that a .hps file should have

void OnEnter()
{

}


void OnLeave()
{

}


void OnStart()
{

}

What you need now is to place the first line in void OnStart() and then add the rest of the script like this:

EDIT: I just realized you haven't specified what entity you want to look at. The script line is:


SetEntityPlayerLookAtCallback("ENTITY", "CALLBACK", "false/true")

void OnStart()
{
SetEntityPlayerLookAtCallback("area_lookat_1", "LookAtFunction", true);

}

void LookAtFunction(string &in asEntity, int alState)
{
if(alState == 1)
{
SetEntityActive ("armour_nice_complete_4", true);
SetEntityActive ("armour_nice_complete_5", true);
SetEntityActive ("armour_nice_complete_6", true);
SetEntityActive ("armour_nice_complete_7", true);
SetEntityActive ("armour_nice_complete_8", true);
}

}


I added a little but to the script, so it works better. What i did was saying, if > only when the player crosshair goes into the area > call the script
(Not when it goes outside)
This can always be useful later on Wink

Trying is the first step to success.
(This post was last modified: 11-13-2012, 05:11 PM by FlawlessHappiness.)
11-13-2012, 04:59 PM
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#3
RE: Look At

sure i know that i need void on start enter leave etc. i just piceked up the needed lines for this thread Wink but thanks i will try it out

When you are looking for someone, to do the scripting for your Custom Story, ask me!
11-14-2012, 05:18 PM
Find




Users browsing this thread: 1 Guest(s)