Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - keozeo

#1
Quote from: Khris on Tue 25/08/2015 08:53:12

Go to other room randomly: (code here)

Now call GoToRoom(3, 12); instead of player.ChangeRoom(3);
Sorry, I wond quote the entire post anymore. Thanks man. This has been a big help, and I hope you all enjoy what comes out of it
#2
Thanks, this was massively helpful. I think I can do it now.
Edit: Ok so here's what I did so you can imitate or do the same.
Code: ags
function Check_Sanity (int)  
{
if (player_Sanity< 45)
{
    int dice_roll = Random(100);
    if (dice_roll < 25)
    {
       (Display "I'm a bit tense.")
       
    }
}
I'm not only going to make that one function, I'm going to make 1 other one for door ways that, when your sanity gets low enough, a random dice roll could make the door lead somewhere else. I think I know how to do this so it should be simple.

Edited by mod: Removed unnecessary quote.
#3
Ok so I made a sanity meter and now I'm working on some basic effects. I want for when the player examines/picks up/uses an item or opens a door it has a chance of displaying a message if your sanity is below 45. I have the randomizer and sanity variable displayed here:
Code: ags
if (player_Sanity< 45)
{
    int dice_roll = Random(100);
    if (dice_roll < 25)
    {
       (Display "I'm a bit tense.")
       
    }
}
but I'm missing the "flag" or trigger for it if you will. I have the variable as a global. I'm pretty sure this is incredibly simple.
#4
Quote from: Crimson Wizard on Mon 24/08/2015 23:00:46
It is not clear for me which exactly part of the task was a problem for you, is it getting random number, or setting a condition? Maybe drawing meter on screen too? Please be more precise.

Regarding dice rolls, Random function is usually the solution:

Code: ags

if (Sanity < 10)
{
    int dice_roll = Random(100);
    if (dice_roll < 25)
    {
        // do something
    }
}


Reference: http://www.adventuregamestudio.co.uk/wiki/Game_/_Global_functions#Random
Dice Roll mainly. Also linking certain effects to certain numbers (Basically making the dice rolls act as "flags" for things like hallucinations or teleporting you into other rooms). Thanks, this was a pretty big help. When I get everything in what I'm planning done, I'll make a template of it and put it up as contribution to the community. I have other questions about making variables, but I think I can find that on the wiki.

Edit: I THINK I did it, not sure.
Code: ags

int player_Sanity=50



if (player_Sanity< 10)
{
    int dice_roll = Random(100);
    if (dice_roll < 25)
    {
        // do something
    }
}
#5
I've been looking into this for a while but I can't seem to find much. Basically what I'm trying to do is when a certain variable ("Sanity") is below a certain number, a dice roll or random number is pulled up every time you enter a room. Certain numbers pull up an effect and certain numbers do not. Is this possible? I don't know how particularly advanced something like this is. Think something like the morality meter in "I have no mouth" but instead of changing the ending, it makes certain things happen at random.
SMF spam blocked by CleanTalk