procedure start;
procedure map_enter_p_proc;
procedure map_update_p_proc;
import variable Staple_Box_Ptr; //Footlocker that's holding her Barter stuff
variable OnlyOnce := 1;
variable NumBooks;// Number of each book to generate every SpawnWait
variable SpawnWait;// Time until new books spawn. [ WEEKS * DAYS * HOURS * MINUTES * SECONDS ]
variable StartingCaps := 500;
variable StartingBooks := 5;
variable BigBookOfScience;
variable DeansElectronics;
variable FirstAidBook;
variable ScoutHandbook;
variable GunsAndBullets;
//////////////////////////////////////////////
//variable ChemistryJournals;// NOT USED (yet)
//////////////////////////////////////////////
procedure start
begin
if (OnlyOnce) then begin //Generate pointer to self, initial inventory, and initial value for next spawn time
//
//"I am Jack's footlocker of books":
//
Staple_Box_Ptr := self_obj;
//Book types:
BigBookOfScience := create_object_sid(73, 0, 0, -1);
DeansElectronics := create_object_sid(76, 0, 0, -1);
FirstAidBook := create_object_sid(80, 0, 0, -1);
ScoutHandbook := create_object_sid(86, 0, 0, -1);
GunsAndBullets := create_object_sid(102, 0, 0, -1);
//Once per week:
SpawnWait := (1 * 7 * 24 * 60 * 60);// [ WEEKS * DAYS * HOURS * MINUTES * SECONDS ]
//Initial $$$:
item_caps_adjust(self_obj, StartingCaps);
//Initial inven:
add_mult_objs_to_inven(self_obj, BigBookOfScience, StartingBooks);
add_mult_objs_to_inven(self_obj, DeansElectronics, StartingBooks);
add_mult_objs_to_inven(self_obj, FirstAidBook, StartingBooks);
add_mult_objs_to_inven(self_obj, ScoutHandbook, StartingBooks);
add_mult_objs_to_inven(self_obj, GunsAndBullets, StartingBooks);
//Begin tracker:
set_global_var(636, game_time); //Tracks game_time for comparing to SpawnWait
OnlyOnce := 0;
end
if (script_action == 15) then begin
call map_enter_p_proc;
end
else begin
if (script_action == 23) then begin
call map_update_p_proc;
end
end
end
procedure map_enter_p_proc
begin
if ((game_time - global_var(636)) > SpawnWait) then begin //<Time> SpawnWait) then begin //<--Time for new stuff!
item_caps_adjust(self_obj, random(125, 250) + (random(1, 6) * get_critter_stat(dude_obj, 6)); //Stat=LUCK
NumBooks := (random(0, 2));
add_mult_objs_to_inven(self_obj, BigBookOfScience, NumBooks);
NumBooks := (random(0, 2));
add_mult_objs_to_inven(self_obj, DeansElectronics, NumBooks);
NumBooks := (random(0, 2));
add_mult_objs_to_inven(self_obj, FirstAidBook, NumBooks);
NumBooks := (random(0, 2));
add_mult_objs_to_inven(self_obj, ScoutHandbook, NumBooks);
NumBooks := (random(0, 2));
add_mult_objs_to_inven(self_obj, GunsAndBullets, NumBooks);
set_global_var(636, game_time); //Reset "time until next spawn" counter
end
end