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
Solved Randomize door message
Author Message
MaZiCUT Offline
Senior Member

Posts: 542
Joined: Jun 2012
Reputation: 17
Post: #1
Randomize door message
How do i randomize a door message? When a door's locked, and i touch it, it activates the playerinteract and in that script i want it to choose between random messages to display instead of one.


For example instead of just showing "It's locked" how do i manage to make it display random ones?

For example "It's not going to open" "It's useless" etc.



Not solved, i decided it would be best not to have random messages at that door.

Hi.
(This post was last modified: 06-27-2012 12:40 PM by MaZiCUT.)
06-27-2012 11:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #2
RE: Randomize door message
PHP Code: (Select All)
SetMessage("Category""Entry_"+RandInt(1,3), 0); 

Tutorials: From Noob to Pro
06-27-2012 11:25 AM
Visit this user's website Find all posts by this user Quote this message in a reply
MaZiCUT Offline
Senior Member

Posts: 542
Joined: Jun 2012
Reputation: 17
Post: #3
RE: Randomize door message
SetMessage("Category", "Entry_"+RandInt(1,3), 0);




What do i put after entry?

Hi.
06-27-2012 11:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #4
RE: Randomize door message
(06-27-2012 11:28 AM)CrazyArts Wrote:  What do i put after entry?

An int: integer; number; not a decimal.

Tutorials: From Noob to Pro
06-27-2012 11:32 AM
Visit this user's website Find all posts by this user Quote this message in a reply
MaZiCUT Offline
Senior Member

Posts: 542
Joined: Jun 2012
Reputation: 17
Post: #5
RE: Randomize door message
Will this work?


void DinnerMessage(string &in entity)
{
if(GetSwingDoorLocked("DinnerDoor") == true)
{
SetMessage("DoorMessages", "Entry_"+RandInt(1,3), 0);
}
}

.lang


<CATEGORY Name="DoorMessages">
<Entry Name="DinnerMSG">It won't budge.</Entry>
<Entry Name="DinnerMSG2">It's not going to open.</Entry>
<Entry Name="DinnerMSG3">I might aswell give up on this door.</Entry>

Hi.
06-27-2012 11:33 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #6
RE: Randomize door message
"It won't budge." won't show up if you use that entry. You have to understand RandInt before you can work with it.

Tutorials: From Noob to Pro
06-27-2012 11:39 AM
Visit this user's website Find all posts by this user Quote this message in a reply
MaZiCUT Offline
Senior Member

Posts: 542
Joined: Jun 2012
Reputation: 17
Post: #7
RE: Randomize door message
How do i do it then? I want it to pick between those 3 messages on the door by the way.

Hi.
06-27-2012 11:47 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #8
RE: Randomize door message
http://wiki.frictionalgames.com/hpl2/amn...ns#general

Look at the argument for minimum value and look at the argument for maximum value. RandInt generates a random number no greater than maximum value and no lesser than minimum value. Do you understand now why the entry without a number at the end won't show up in game?

Tutorials: From Noob to Pro
06-27-2012 11:52 AM
Visit this user's website Find all posts by this user Quote this message in a reply
MaZiCUT Offline
Senior Member

Posts: 542
Joined: Jun 2012
Reputation: 17
Post: #9
RE: Randomize door message
Not really Huh

Hi.
06-27-2012 12:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Your Computer Offline
SCAN ME!

Posts: 3,267
Joined: Jul 2011
Reputation: 223
Post: #10
RE: Randomize door message
RandInt(1,3) means minimum value is 1 and maximum value is 3. That means the only possible values that will be returned by that call are: 1, 2 or 3.

0, 4, etc, will not be returned from that call. This means only DinnerMSG1, DinnerMSG2, and DinnerMSG3 are possible since we are appending RandInt(1,3) to the end of the entry name.

Tutorials: From Noob to Pro
06-27-2012 12:11 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




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