Jump to content

Generating Random Events For A Quest


Rendril

Recommended Posts

Simply gets a random number and outputs the quest info.

[php]
@vb = rand(1, 4);
echo @content[@vb];
[/php]

Gives/removes a key depending on certain event
[php]
@vz = "rendrilrevant-";//define key prefix
//make sure user cannot retrigger the events
if(!mds_has_rpcq_keys(@vz . "random-event-triggered")){
@vb = rand(1, 4);//generate random number from 1 to 4 inclusive
if(@vb == 2)//event in case of 2
{
mds_give_rpcq_keys(@vz . "second-event-key");
}
else if(@vb == 3)//event in case of 3
{
mds_remove_rpcq_keys(@vz . "third-event-key")
}
mds_give_rpcq_keys(@vz . "random-event-triggered");
echo @content[@vb];//display event's content
}
else
{
echo "You have already been here...move along."
}
[/php]

Sometimes the user might want to retrace their steps to look for clues in the quest where they have been, in that case barring them from revisiting might not be the best choice. But this was a random event, better remember it next time :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Forum Statistics

    17.5k
    Total Topics
    182.5k
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...