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
Message on locked doors[SOLVED]
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#1
Message on locked doors[SOLVED]

Ok so i was just wondering how to script in both the .lang file and in the .hps file to get a text saying something like "this door is locked".

I have tried and tried but i cant get it to work... help!

[WIP] Recidivus
(This post was last modified: 05-17-2011, 11:50 AM by Greven.)
05-16-2011, 06:14 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#2
RE: Message on locked doors

This is a ctrl-c, ctrl-v from my map script:

Spoiler below!

void OpenLevelDoor(string &in asItem, string &in asEntity)
{
CompleteQuest("Passage", "The_Passage");
SetLevelDoorLocked("level_wood_2", false);
PlayGuiSound("unlock_door.snt", 1.0f);
SetLocalVarInt("LevelLockedX", 1);
}

void LevelDoorLocked(string &in asEntity)
{
if(GetLocalVarInt("LevelLockedX")==0)
{
SetMessage("TheHall", "LevelLocked", 0);
PlaySoundAtEntity("", "locked_door.ogg", "level_wood_2", 0.0f, false);
return;
}
}

It displays the message when variable "LevelLockedX" is set to 0 (which it is by default).
When using a key on it however, that variable is set to 1. Thus interaction after unlocking will no longer display the message.

Note that this is for a leveldoor and not a swingdoor, so if you are using a swingdoor replace the "SetLevelDoorLocked("level_wood_2", false);" with the swingdoor command.

[Image: mZiYnxe.png]


(This post was last modified: 05-16-2011, 06:22 PM by Acies.)
05-16-2011, 06:22 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#3
RE: Message on locked doors

uhm im not to familiar with the whole "if" things, can you simplify the whole procedure?

[WIP] Recidivus
05-16-2011, 08:11 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#4
RE: Message on locked doors

Uhm, I could explain it better - or copy you OnStart() parts too. Right now I can't think of another way.

The "if" part says:
Spoiler below!

if(GetLocalVarInt("LevelLockedX")==0)
{
//Then do stuff
return;
}

if(GetLocalVarInt("LevelLockedX")==0)
The GetLocalVarInt is a command which checks a variable, VarInt meaning it's a number without decimals.
The "LevelLockedX" is the name, which I have made up (you can name it whatever you want.)
The "==0" part means equal to zero.

I am using this variable as a bool, 0 means true / 1 means false. Thus if the variable is equal to 0 the door is considered locked and if it is equal to 1 it is considered unlocked.

The "//Then do stuff" part is only done IF "LevelLockedX" = 0, otherwise nothing is done.

When using the key on the door the variable is set to 1 and therefore when you interact with the door, nothing is done.


[Image: mZiYnxe.png]


05-16-2011, 09:14 PM
Find
Russ Money Offline
Senior Member

Posts: 360
Threads: 25
Joined: Dec 2010
Reputation: 4
#5
RE: Message on locked doors

The longer way:
Void OnStart()
{
SetEntityPlayerInteractCallback(string& asName, string& asCallback, bool abRemoveOnInteraction);

//RemoveOnInteraction true, message once, false, message repeats each time you touch the door.
}

//Callback for message

void MyFunc(string &in entity)
{
SetMessage(string& asTextCategory, string& asTextEntry, float afTime);
}

(This post was last modified: 05-16-2011, 09:24 PM by Russ Money.)
05-16-2011, 09:24 PM
Find
dragonlordsd Offline
Member

Posts: 112
Threads: 7
Joined: May 2011
Reputation: 0
#6
RE: Message on locked doors

how is the message scripted in the english.lang file?
05-17-2011, 02:36 AM
Find




Users browsing this thread: 1 Guest(s)