P
philman401
Guest
So I'm making a rpg game. I have scripts that initializes their stats stored in a map type ds list.
I have scripts for each class, and a script that calls for all of them.
I also have a script to "clean the game" ie destroy the ds lists I've created for use when the game session ends (not app end, but like return to main menu or something). However, when I call upon this script to delete some ds lists, I get an errror basically saying some of these lists don't exist. Mainly, the mage, cleric an darcher. I've done nothing different to them, yet they are giving me issues.
here is an example of the knight
here us the ine for mage (the one with the issue, along with cleric and archer)
And here is the script to destroy the lists. I've added a ds_exist hoping to have it fixed but still same issue.
Only the mage/cleric/archer ds lists are having trouble being destroyed, everything else including uniStats and classList don't give me that error.
I have scripts for each class, and a script that calls for all of them.
Code:
//knight
iniKnight();
//thief
iniThief();
//mage
iniMage();
//cleric
iniCleric();
//archer
iniArcher();
global.selClass := 0;
global.classList := ds_list_create();
ds_list_add(global.classList,global.classKnight);
ds_list_add(global.classList,global.classThief);
ds_list_add(global.classList,global.classMage);
ds_list_add(global.classList,global.classCleric);
ds_list_add(global.classList,global.classArcher);
iniUniStats();
I also have a script to "clean the game" ie destroy the ds lists I've created for use when the game session ends (not app end, but like return to main menu or something). However, when I call upon this script to delete some ds lists, I get an errror basically saying some of these lists don't exist. Mainly, the mage, cleric an darcher. I've done nothing different to them, yet they are giving me issues.
here is an example of the knight
Code:
global.classKnight := ds_map_create();
global.classKnight[? "object"] := knight;
global.classKnight[? "class"] := "Knight";
global.classKnight[? "spr_rite"] := knightrite_spr;
global.classKnight[? "spr_left"] := knightleft_spr;
global.classKnight[? "maxhp"] := irandom_range(125,200);
global.classKnight[? "maxmp"] := irandom_range(15,25);;
global.classKnight[? "hp"] := global.classKnight[? "maxhp"];
global.classKnight[? "mp"] := 0;
global.classKnight[? "power"] := irandom_range(3,8);
var pr := global.classKnight[? "power"];
var prmn := irandom_range(3,5)/100;
var prmx := irandom_range(3,5)/100;
global.classKnight[? "prmin"] := pr * prmn;
global.classKnight[? "prmax"] := pr * prmx;
global.classKnight[? "recovery"] := irandom_range(1,2);
global.classKnight[? "attack_spd"] := irandom_range(30,60);
global.classKnight[? "dr"] := irandom_range(15,25)/100;
global.classKnight[? "crits"] := irandom_range(5,10);
global.classKnight[? "crit_dmg"] := irandom_range(100,150)/100;
global.classKnight[? "speechcraft"] := irandom_range(10,15);
global.classKnight[? "pesonality"] := choose("charismatic","diplomatic","righteous");
global.classKnight[? "act_ab"] := "script goes here";
global.classKnight[? "pass_ab"] := "script goes here";
global.classKnight[? "level"] := 1;
global.classKnight[? "maxlevel"] := 100;
global.classKnight[? "exp"] := 0;
global.classKnight[? "maxexp"] := 100;
global.classKnight[? "expgrowth"] := 50;
global.classKnight[? "name"] := "Knight";
here us the ine for mage (the one with the issue, along with cleric and archer)
Code:
global.classMage := ds_map_create();
global.classMage[? "object"] := mage;
global.classMage[? "class"] := "Mage";
global.classMage[? "spr_rite"] := magerite_spr;
global.classMage[? "spr_left"] := mageleft_spr;
global.classMage[? "maxhp"] := irandom_range(90,110);
global.classMage[? "maxmp"] := irandom_range(75,95);;
global.classMage[? "hp"] := global.classMage[? "maxhp"];
global.classMage[? "mp"] := 0;
global.classMage[? "power"] := irandom_range(10,15);
var pr := global.classMage[? "power"];
var prmn := irandom_range(6,8)/100;
var prmx := irandom_range(5,7)/100;
global.classMage[? "prmin"] := pr * prmn;
global.classMage[? "prmax"] := pr * prmx;
global.classMage[? "recovery"] := irandom_range(3,6);
global.classMage[? "attack_spd"] := irandom_range(20,25);
global.classMage[? "dr"] := irandom_range(5,10)/100;
global.classMage[? "crits"] := irandom_range(5,10);
global.classMage[? "crit_dmg"] := irandom_range(110,125)/100;
global.classMage[? "speechcraft"] := irandom_range(10,15);
global.classMage[? "pesonality"] := choose("intelligent","arrogant","eccentric");
global.classMage[? "act_ab"] := "script goes here";
global.classMage[? "pass_ab"] := "script goes here";
global.classMage[? "level"] := 1;
global.classMage[? "maxlevel"] := 100;
global.classMage[? "exp"] := 0;
global.classMage[? "maxexp"] := 100;
global.classMage[? "expgrowth"] := 35;
global.classMage[? "name"] := "Mage";
And here is the script to destroy the lists. I've added a ds_exist hoping to have it fixed but still same issue.
Code:
if(ds_exists(global.classKnight,ds_type_map))
ds_list_destroy(global.classKnight);
if(ds_exists(global.classThief,ds_type_map))
ds_list_destroy(global.classThief);
if(ds_exists(global.classMage,ds_type_map))
ds_list_destroy(global.classMage);
if(ds_exists(global.classCleric,ds_type_map))
ds_list_destroy(global.classCleric);
if(ds_exists(global.classArcher,ds_type_map))
ds_list_destroy(global.classArcher);
if(ds_exists(global.classList,ds_type_list))
ds_list_destroy(global.classList);
if(ds_exists(global.uniStats,ds_type_list))
ds_list_destroy(global.uniStats);
Only the mage/cleric/archer ds lists are having trouble being destroyed, everything else including uniStats and classList don't give me that error.