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

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#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
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#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
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#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
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#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
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#9
RE: Randomize door message

Not really Huh

Hi.
06-27-2012, 12:00 PM
Website Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#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
Website Find




Users browsing this thread: 5 Guest(s)