Randomize door message - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Randomize door message (/thread-16530.html) |
Randomize door message - MaZiCUT - 06-27-2012 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. RE: Randomize door message - Your Computer - 06-27-2012 PHP Code: SetMessage("Category", "Entry_"+RandInt(1,3), 0); RE: Randomize door message - MaZiCUT - 06-27-2012 SetMessage("Category", "Entry_"+RandInt(1,3), 0); What do i put after entry? RE: Randomize door message - Your Computer - 06-27-2012 (06-27-2012, 11:28 AM)CrazyArts Wrote: What do i put after entry? An int: integer; number; not a decimal. RE: Randomize door message - MaZiCUT - 06-27-2012 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> RE: Randomize door message - Your Computer - 06-27-2012 "It won't budge." won't show up if you use that entry. You have to understand RandInt before you can work with it. RE: Randomize door message - MaZiCUT - 06-27-2012 How do i do it then? I want it to pick between those 3 messages on the door by the way. RE: Randomize door message - Your Computer - 06-27-2012 http://wiki.frictionalgames.com/hpl2/amnesia/script_functions#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? RE: Randomize door message - MaZiCUT - 06-27-2012 Not really RE: Randomize door message - Your Computer - 06-27-2012 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. |