Its my new scripting research
NPC will give you one randomly selected quest
Result: game will be never twice the same
Global.h
Vault13.gam
Quests.txt
Quests.msg
Dialogue script from NPC who will give you the quest
And example content file.msg of that dialogue
NPC will give you one randomly selected quest
Result: game will be never twice the same
Global.h
Code:
#define GVAR_QUEST1 (699)
#define GVAR_QUEST2 (700)
#define GVAR_QUEST3 (701)
Vault13.gam
Code:
GVAR_QUEST1 :=0; // (699)
GVAR_QUEST2 :=0; // (700)
GVAR_QUEST3 :=0; // (701)
Quests.txt
Code:
# 1A Bring knife
1500, 141, 699, 1, 2
# 1B Bring leather armour
1500, 142, 700, 1, 2
# 1C Bring hunting riffle
1500, 143, 701, 1, 2
Quests.msg
Code:
{141}{}{Bring knife person X}
{142}{}{Bring leather armour person X}
{143}{}{Bring hunting riffle person X}
Dialogue script from NPC who will give you the quest
Code:
procedure start;
procedure talk_p_proc;
procedure Node999;
procedure Node001;
procedure Node002;
procedure Node003;
procedure Node004;
procedure Node005;
procedure Node006;
procedure Node007;
procedure Node008;
procedure start begin
end
procedure talk_p_proc begin
start_gdialog(NAME,self_obj,4,-1,-1);
gSay_Start;
if (global_var(GVAR_QUEST1) == 1) then begin
call Node002;
end else
if (global_var(GVAR_QUEST2) == 1) then begin
call Node004;
end else
if (global_var(GVAR_QUEST3) == 1) then begin
call Node006;
end else
if ((global_var(GVAR_QUEST1) == 2) or (global_var(GVAR_QUEST2) == 2) or (global_var(GVAR_QUEST3) == 2)) then begin
call Node008;
end else begin
call Node001;
end
gSay_End;
end_dialogue;
end
procedure Node001 begin
variable los;
los := random(1,3);
if (los == 1) then begin
Reply(122);
set_global_var(GVAR_QUEST1,1);
NOption(101,Node999,003);
end else
if (los == 2) then begin
Reply(123);
set_global_var(GVAR_QUEST2,1);
NOption(101,Node999,003);
end else
if (los == 3) then begin
Reply(124);
set_global_var(GVAR_QUEST3,1);
NOption(101,Node999,003);
end else begin
Reply(125);
NOption(126,Node999,003);
end
end
procedure Node002 begin
if (obj_is_carrying_obj_pid(dude_obj, 4) >=1) then begin
Reply(102);
NOption(103,Node003,003);
end else begin
Reply(104);
NOption(105,Node999,003);
end
end
procedure Node003 begin
Reply(106);
remove_pid_qty(dude_obj, 4, 1)
item_caps_adjust(dude_obj,150);
give_exp_points(100);
set_global_var(GVAR_QUEST1,2);
NOption(107,Node999,003);
end
procedure Node004 begin
if (obj_is_carrying_obj_pid(dude_obj, 1) >=1) then begin
Reply(108);
NOption(109,Node005,003);
end else begin
Reply(110);
NOption(111,Node999,003);
end
end
procedure Node005 begin
Reply(112);
remove_pid_qty(dude_obj, 1, 1)
item_caps_adjust(dude_obj,300);
give_exp_points(200);
set_global_var(GVAR_QUEST2,2);
NOption(113,Node999,003);
end
procedure Node006 begin
if (obj_is_carrying_obj_pid(dude_obj, 10) >=1) then begin
Reply(114);
NOption(115,Node007,003);
end else begin
Reply(116);
NOption(117,Node999,003);
end
end
procedure Node007 begin
Reply(118);
remove_pid_qty(dude_obj, 10, 1)
item_caps_adjust(dude_obj,200);
give_exp_points(400);
set_global_var(GVAR_QUEST3,2);
NOption(119,Node999,003);
end
procedure Node008 begin
Reply(120);
NOption(121,Node999,003);
end
procedure Node999 begin
end
And example content file.msg of that dialogue
Code:
{100}{}{do something for me, bring me knife}
{101}{}{ok i will do it}
{102}{}{i see you got knife i searching}
{103}{}{yes, find it was easy}
{104}{}{do you find that knife?}
{105}{}{no i working on that}
{106}{}{here is you reward}
{107}{}{thanx}
{108}{}{i see you got armour, how you do it?}
{109}{}{i got some problems but i found it}
{110}{}{did you find that armour?}
{111}{}{no but i made some progress on that}
{112}{}{gratulations, here is your reward}
{113}{}{thanx}
{114}{}{incredible, you found that riffle!}
{115}{}{yes, but this was hard}
{116}{}{did you found that riffle?}
{117}{}{uh its hard, but i try do it}
{118}{}{gratulations, here is you big reward}
{119}{}{wow, thanx, many money}
{120}{}{thanx again for this item}
{121}{}{it was interesting adventure}
{122}{}{here is your quest, bring me knife}
{123}{}{here is your quest, bring me leather armour}
{124}{}{here is your quest, bring me hunting riffle}
{125}{}{nothing1}
{126}{}{nothing2}