Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help scripting an event when looking at an area
Author Message
Tryed Offline
Junior Member

Posts: 10
Joined: Feb 2011
Reputation: 0
Post: #1
Help scripting an event when looking at an area
Hello
I'm trying to script an event that happens when you LOOK AT an area, but with no success. Actually I have no clue if its possible/how its done Sad

I've been trying these lines

* Callback syntax: MyFunc(string &in entity, int alState) state: 1=looking, -1=not looking
*/
void  SetEntityPlayerLookAtCallback(string& asName, string& asCallback, bool abRemoveWhenLookedAt);

But with no success. I'm completely lost here.
Any help would be appreciated Shy
02-11-2011 09:07 AM
Find all posts by this user Quote this message in a reply
Akasu Offline
Member

Posts: 61
Joined: Aug 2010
Reputation: 2
Post: #2
RE: Help scripting an event when looking at an area
void OnStart ()
{
SetEntityPlayerLookAtCallback("name", "EVENT01", true);
}

void EVENT01 (string &in entity, int alState)
{
(stuff that happens)
}

That should work.
02-11-2011 11:39 AM
Find all posts by this user Quote this message in a reply
Tryed Offline
Junior Member

Posts: 10
Joined: Feb 2011
Reputation: 0
Post: #3
RE: Help scripting an event when looking at an area
That worked, thanks a lot.
But I have another question. How do I trigger an event when holding an object/grabbing a door? I want it to show a message when the player tries to open a locked door.
02-11-2011 05:33 PM
Find all posts by this user Quote this message in a reply
Akasu Offline
Member

Posts: 61
Joined: Aug 2010
Reputation: 2
Post: #4
RE: Help scripting an event when looking at an area
The functions for that are
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction)
; (you know the drill. It's done the same way as in the 'SetEntityPlayerLookAtCallback'. The 'bool abRemoveOnInteraction' is true if you want the message to show only once and false if the message is displayed every time you interact with the door.)

and
SetMessage("Crap","Door",-1);

Plus, you'll need to make a text file called "extra_english.lang" into your custom story folder and write these lines in it:
<LANGUAGE>
<CATEGORY Name="Crap">
<Entry Name="Door">It's locked</Entry>
</CATEGORY>
</LANGUAGE>
That is just an example. You can name the category and other stuff anything you want.

Also check out this page if you haven't yet.
(This post was last modified: 02-11-2011 06:54 PM by Akasu.)
02-11-2011 06:52 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)