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
Display text message until...
iFondue Offline
Junior Member

Posts: 28
Threads: 6
Joined: Apr 2012
Reputation: 0
#1
Display text message until...

Hey, I'm still working on my custom Story, and i have a question.

I want to script that the player can open the door when he picked up the lantern.
That wasn't a problem to script, i just did it with OnPickup...
I also want that it displays a message when he interacts with the door saying "I should search for the lantern first."
That was no problem to script too, but the problem is, if he has the lantern, and than leaves the room by using the door, it displays the message again... I want to fix that but I dom't know how...

Thanks already!

Greets

-iFondue

Working on a Custom Story: "Untold Mysteries"
30% Complete!


07-27-2012, 10:46 AM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#2
RE: Display text message until...

Set a LocalInt which will change when you pick up the lantern. Then surround your display message script with a if check which will only run if the localint is the proper one.
07-27-2012, 10:58 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Display text message until...

When the player interacts with the door (and he doesn't have the lantern) it will set the message; if the player has the lantern, the door will unlock and no longer display the message.

void OnStart()
{
SetEntityPlayerInteractCallback("NAME_OF_DOOR", "FUNC", false);
SetEntityPlayerInteractCallback("NAME_OF_LANTERN", "FUNC_2", false);
}

void FUNC(string &in asEntity)
{
if(HasItem("NAME_OF_LANTERN") == true)
{
SetMessage("NAME_OF_TEXT_CATEGORY", "NAME_OF_TEXT_ENTRY", 0);
}
}

void FUNC_2(string &in asEntity)
{
SetSwingDoorLocked("NAME_OF_DOOR", false, false); ///by having abEffects false, the player won't suddenly hear an unlocking noise
}

Hope that Helped!

I rate it 3 memes.
07-27-2012, 11:02 AM
Find
iFondue Offline
Junior Member

Posts: 28
Threads: 6
Joined: Apr 2012
Reputation: 0
#4
RE: Display text message until...

Thank you! Smile It now works...

But I had to change the statement of:
if(HasItem("NAME_OF_LANTERN") == true)


to false, else it does exactly the opposite.

Thanks alot!

Greets

-iFondue

Working on a Custom Story: "Untold Mysteries"
30% Complete!


07-27-2012, 11:23 AM
Find
iFondue Offline
Junior Member

Posts: 28
Threads: 6
Joined: Apr 2012
Reputation: 0
#5
RE: Display text message until...

The first door I made this works perfect now, thanks again, but i have another problem *eyeroll* xD

Because on the second door, I want the player to use a hollow needle to open.
All works perfectly, if he interacts with the door with no Hollow Needle the message "It seems that the lock is jammed!" appears and when he has the hollow needle no text message appears. But problem is, as soon as he used the needle on the door, and than pushes it forward the message appears again, because if he doesn't have the entity the message will appear.

How can i make this statement "false" after he picked the needle up?

Thanks for taking the time for me! Tongue


Greets

-iFondue

Working on a Custom Story: "Untold Mysteries"
30% Complete!


07-27-2012, 04:58 PM
Find
Kreekakon Offline
Pick a god and pray!

Posts: 3,063
Threads: 70
Joined: Mar 2012
Reputation: 124
#6
RE: Display text message until...

In this case use my method I mentioned earlier =D

It nearly works the same as Andy's except that there's a LocalInt involved.

void OnStart()

{
SetEntityPlayerInteractCallback("NAME_OF_DOOR", "FUNC", false);
AddUseItemCallback("", "NAME_OF_NEEDLE", "NAME_OF_DOOR", "FUNC_2", true);
SetLocalVarInt("INT_NAME", 0);
}



void FUNC(string &in asEntity)

{
if(GetLocalVarInt("INT_NAME")==0)
{
SetMessage("NAME_OF_TEXT_CATEGORY", "NAME_OF_TEXT_ENTRY", 0);
}
}



void FUNC_2(string &in NAME_OF_NEEDLE, string &in NAME_OF_DOOR)

{
SetSwingDoorLocked("NAME_OF_DOOR", false, false);
AddLocalVarInt("INT_NAME", 1);
}
(This post was last modified: 07-28-2012, 12:51 AM by Kreekakon.)
07-28-2012, 12:40 AM
Find




Users browsing this thread: 1 Guest(s)