ResetDaily

Just a general discussion forum.
User avatar
Aeeria
Junior
Junior
Posts: 16
Joined: Tue Sep 01, 2015 6:30 am

ResetDaily

Postby Aeeria » Tue Sep 01, 2015 4:44 pm

How does ResetDaily() and DoneDaily() work, anyone know?
User avatar
john
Legend
Legend
Posts: 770
Joined: Fri Nov 25, 2011 11:02 am
Location: England
Contact:

RE: ResetDaily

Postby john » Mon May 23, 2016 3:47 pm

I guess I will answer my own question then, in case someone needs this info later!

An example daily quest including the roll function:

Main
{
questname "Intensive Training (Daily)"
version 1
}

state Begin
{
desc "Talk to Trainer (Daily)"

action AddNpcChat(11, "You need to be level 20 or above to start your Intensive Training!");
if IsLevel(20) goto Begin1
else Reset();
}
state Begin1
{
desc "Talk to Trainer (Daily)"

action AddNpcText( 11 , "Greetings, [name]! Once per day, you can come to me for Intensive Training!");
action AddNpcText( 11 , "The price for this service, is 25 Gold Coins per day.");
action AddNpcText( 11 , "You can choose which statistic we will target for each training session!");
action AddNpcText( 11 , "With my help, you can increase your desired stat between 10 - 15 points each day!");
action AddNpcInput( 11 , 1 , "Okay!");

rule InputNpc ( 1 ) goto title1
}
State title1
{
desc "Choose Stat?"
action ShowHint("You will be charged if you proceed with training...");

action AddNpcText( 11 , "Which statistic shall we focus on for your Intensive Training today?" );
action AddNpcInput( 11 , 1 , "Strength.");
action AddNpcInput( 11 , 2 , "Intelligence.");
action AddNpcInput( 11 , 3 , "Agility.");
action AddNpcInput( 11 , 4 , "Constitution.");
action AddNpcInput( 11 , 5 , "Wisdom.");
action AddNpcInput( 11 , 6 , "Charisma.");



rule InputNpc( 1 ) goto check1
rule InputNpc( 2 ) goto check2
rule InputNpc( 3 ) goto check3
rule InputNpc( 4 ) goto check4
rule InputNpc( 5 ) goto check5
rule InputNpc( 6 ) goto check6
}
State check1
{
if GotItems(3, 25) goto checkstr
else SetState("nofunds");
}
State check2
{
if GotItems(3, 25) goto checkint
else SetState("nofunds");
}
State check3
{
if GotItems(3, 25) goto checkagi
else SetState("nofunds");
}
State check4
{
if GotItems(3, 25) goto checkcon
else SetState("nofunds");
}
State check5
{
if GotItems(3, 25) goto checkwis
else SetState("nofunds");
}
State check6
{
if GotItems(3, 25) goto checkcha
else SetState("nofunds");
}
state checkstr
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Str1
rule Rolled(2) goto Str2
rule Rolled(3) goto Str3
rule Rolled(4) goto Str4
rule Rolled(5) goto Str5
}
state Str1
{
action RemoveItem(3, 25);
action GiveStat("str", 11);
action ShowHint("Your Strength has increased by 11 today!");
action SetState("GetReward");
}
state Str2
{
action RemoveItem(3, 25);
action GiveStat("str", 12);
action ShowHint("Your Strength has increased by 12 today!");
action SetState("GetReward");
}
state Str3
{
action RemoveItem(3, 25);
action GiveStat("str", 13);
action ShowHint("Your Strength has increased by 13 today!");
action SetState("GetReward");
}
state Str4
{
action RemoveItem(3, 25);
action GiveStat("str", 14);
action ShowHint("Your Strength has increased by 14 today!");
action SetState("GetReward");
}
state Str5
{
action RemoveItem(3, 25);
action GiveStat("str", 15);
action ShowHint("Your Strength has increased by 15 today!");
action SetState("GetReward");
}
state checkint
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Int1
rule Rolled(2) goto Int2
rule Rolled(3) goto Int3
rule Rolled(4) goto Int4
rule Rolled(5) goto Int5
}
state Int1
{
action RemoveItem(3, 25);
action GiveStat("int", 11);
action ShowHint("Your Intelligence has increased by 11 today!");
action SetState("GetReward");
}
state Int2
{
action RemoveItem(3, 25);
action GiveStat("int", 12);
action ShowHint("Your Intelligence has increased by 12 today!");
action SetState("GetReward");
}
state Int3
{
action RemoveItem(3, 25);
action GiveStat("int", 13);
action ShowHint("Your Intelligence has increased by 13 today!");
action SetState("GetReward");
}
state Int4
{
action RemoveItem(3, 25);
action GiveStat("int", 14);
action ShowHint("Your Intelligence has increased by 14 today!");
action SetState("GetReward");
}
state Int5
{
action RemoveItem(3, 25);
action GiveStat("int", 15);
action ShowHint("Your Intelligence has increased by 15 today!");
action SetState("GetReward");
}
state checkagi
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Agi1
rule Rolled(2) goto Agi2
rule Rolled(3) goto Agi3
rule Rolled(4) goto Agi4
rule Rolled(5) goto Agi5
}
state Agi1
{
action RemoveItem(3, 25);
action GiveStat("agi", 11);
action ShowHint("Your Agility has increased by 11 today!");
action SetState("GetReward");
}
state Agi2
{
action RemoveItem(3, 25);
action GiveStat("agi", 12);
action ShowHint("Your Agility has increased by 12 today!");
action SetState("GetReward");
}
state Agi3
{
action RemoveItem(3, 25);
action GiveStat("agi", 13);
action ShowHint("Your Agility has increased by 13 today!");
action SetState("GetReward");
}
state Agi4
{
action RemoveItem(3, 25);
action GiveStat("agi", 14);
action ShowHint("Your Agility has increased by 14 today!");
action SetState("GetReward");
}
state Agi5
{
action RemoveItem(3, 25);
action GiveStat("agi", 15);
action ShowHint("Your Agility has increased by 15 today!");
action SetState("GetReward");
}
state checkcon
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Con1
rule Rolled(2) goto Con2
rule Rolled(3) goto Con3
rule Rolled(4) goto Con4
rule Rolled(5) goto Con5
}
state Con1
{
action RemoveItem(3, 25);
action GiveStat("con", 11);
action ShowHint("Your Constitution has increased by 11 today!");
action SetState("GetReward");
}
state Con2
{
action RemoveItem(3, 25);
action GiveStat("con", 12);
action ShowHint("Your Constitution has increased by 12 today!");
action SetState("GetReward");
}
state Con3
{
action RemoveItem(3, 25);
action GiveStat("con", 13);
action ShowHint("Your Constitution has increased by 13 today!");
action SetState("GetReward");
}
state Con4
{
action RemoveItem(3, 25);
action GiveStat("con", 14);
action ShowHint("Your Constitution has increased by 14 today!");
action SetState("GetReward");
}
state Con5
{
action RemoveItem(3, 25);
action GiveStat("con", 15);
action ShowHint("Your Constitution has increased by 15 today!");
action SetState("GetReward");
}
state checkwis
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Wis1
rule Rolled(2) goto Wis2
rule Rolled(3) goto Wis3
rule Rolled(4) goto Wis4
rule Rolled(5) goto Wis5
}
state Wis1
{
action RemoveItem(3, 25);
action GiveStat("wis", 11);
action ShowHint("Your Wisdom has increased by 11 today!");
action SetState("GetReward");
}
state Wis2
{
action RemoveItem(3, 25);
action GiveStat("wis", 12);
action ShowHint("Your Wisdom has increased by 12 today!");
action SetState("GetReward");
}
state Wis3
{
action RemoveItem(3, 25);
action GiveStat("wis", 13);
action ShowHint("Your Wisdom has increased by 13 today!");
action SetState("GetReward");
}
state Wis4
{
action RemoveItem(3, 25);
action GiveStat("wis", 14);
action ShowHint("Your Wisdom has increased by 14 today!");
action SetState("GetReward");
}
state Wis5
{
action RemoveItem(3, 25);
action GiveStat("wis", 15);
action ShowHint("Your Wisdom has increased by 15 today!");
action SetState("GetReward");
}
state checkcha
{

action Roll(5)

rule DoneDaily( 1 ) goto EndWithoutReset
rule Rolled(1) goto Cha1
rule Rolled(2) goto Cha2
rule Rolled(3) goto Cha3
rule Rolled(4) goto Cha4
rule Rolled(5) goto Cha5
}
state Cha1
{
action RemoveItem(3, 25);
action GiveStat("cha", 11);
action ShowHint("Your Charisma has increased by 11 today!");
action SetState("GetReward");
}
state Cha2
{
action RemoveItem(3, 25);
action GiveStat("cha", 12);
action ShowHint("Your Charisma has increased by 12 today!");
action SetState("GetReward");
}
state Cha3
{
action RemoveItem(3, 25);
action GiveStat("cha", 13);
action ShowHint("Your Charisma has increased by 13 today!");
action SetState("GetReward");
}
state Cha4
{
action RemoveItem(3, 25);
action GiveStat("cha", 14);
action ShowHint("Your Charisma has increased by 14 today!");
action SetState("GetReward");
}
state Cha5
{
action RemoveItem(3, 25);
action GiveStat("cha", 15);
action ShowHint("Your Charisma has increased by 15 today!");
action SetState("GetReward");
}
state GetReward
{
action ShowHint("Your Intensive Training is completed for today! (DAILY)");
action PlaySound(17);
action GiveExp(500000)
action ResetDaily();
}
state EndWithoutReset
{
desc "Intensive Training (Daily)"
action ShowHint("You can only complete your Intensive Training once a day.");
action AddNpcText( 11 , "You have already completed your training today, please come back tomorrow." );
rule TalkedToNpc( 11 ) goto Reset
}
state Reset
{
action ShowHint("Intensive Training (Daily) aborted...")
action Reset();
}
State nofunds
{
action AddNpcChat(11, "Insufficient funds, [name].");
action Reset();
}

Return to “Lounge”

Who is online

Users browsing this forum: No registered users and 3 guests