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 post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Forum Statistics

    16,148
    Total Topics
    176,359
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...