MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Randomize door message
SetMessage("Category", "Entry_"+RandInt(1,3), 0);
|
|
06-27-2012, 11:25 AM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
RE: Randomize door message
SetMessage("Category", "Entry_"+RandInt(1,3), 0);
What do i put after entry?
Hi.
|
|
06-27-2012, 11:28 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
06-27-2012, 11:32 AM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
06-27-2012, 11:39 AM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
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 |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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?
|
|
06-27-2012, 11:52 AM |
|
MaZiCUT
Senior Member
Posts: 536
Threads: 31
Joined: Jun 2012
Reputation:
17
|
RE: Randomize door message
Not really
Hi.
|
|
06-27-2012, 12:00 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
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.
|
|
06-27-2012, 12:11 PM |
|
|