Hi guys, some more RPG issues here
This is more of a logical/structural question than coding I guess.
I've been struggling dor the past two weeks with a good looting system, meaning something flexible and not to greedy in ressource (I don't want to create 300 Invitems).
So basically this was my idea (I'll try not make it simple but can be more accurate if needed):
30 inventoryitems with no sprites or anyhting else, kind of the matter that would embody the different items (in the example lets say it correponds to 5 max equipped item+15 max items in the bag+5 max loot items+5 extras)
1 struct of arrays
Code: ags describing the icon,name etc of all the items. This one on the other hand could be big since I guess it doesn't take too much memory, say 200 different items (this is ambitious "^^).
so we have for instance :
loot[1].sprite=1; loot[2].sprite=2;
loot[1].Nameitem=Blade; loot[2].Nameitem=Shield;
loot[1].bonus=5; loot[2].bonus=3;
....
So far I guess it's quite clear. Now this is where it becomes confused, and not so good :
Ennemies are defined with the same method
Code: ags and I added these lines
Code: ags
Then,at map load, I attribute the loot to the different mobs with a function randomingly giving them the items with given probabilities.
Code: ags
So when the map is loaded, each munster has something like this :
ennemi[0].loot1=0; ennemi[1].loot1=0; ...
ennemi[0].loot2=1; ennemi[1].loot1=0;
ennemi[0].loot3=0; ennemi[1].loot1=1; ...
ennemi[0].loot4=0; ennemi[1].loot1=1;
ennemi[0].loot5=1; ennemi[1].loot1=0;
Anf finally when I loot the monster another function gives the image and attributes to the invitem based on the loot struct:(this becomes really messy :s)
Code: ags
In clear, each type of monster could carry a maximum of 5 items, and for each monster all 5 items must be defined each time, this is what the 'l' variable is here for-->monster type1 can loot loot[0],loot[1],loot[2],loot[3],loot[4] (l==0).monster2 can loot loot[5]...loot[9](l==5) etc. This is particularly bad because if i want monster1 to be able to carry loot[6] I must define this item twice, more if I want this item to be carried by more monsters. It seems like a huge waste of space...
Besides the whole thing is actually extremely heavy to manipulate and I start to get lost when I want to add items descriptions or some kind of icon overlay when the mouse is over it. When I started to make the items pickable this became nuts and I realized there might be some easier way to do this. problem is that now my mind is stuck on this idea and I can't find anything else X3
Would some of you have some suggestions I could use? I can give more details if needed but I feel like I've already given too many and lost most of you "^^
Thanks

I've been struggling dor the past two weeks with a good looting system, meaning something flexible and not to greedy in ressource (I don't want to create 300 Invitems).
So basically this was my idea (I'll try not make it simple but can be more accurate if needed):
30 inventoryitems with no sprites or anyhting else, kind of the matter that would embody the different items (in the example lets say it correponds to 5 max equipped item+15 max items in the bag+5 max loot items+5 extras)
1 struct of arrays
Struct loot{
int sprite;
String Nameitem;
int bonus;
...
}
so we have for instance :
loot[1].sprite=1; loot[2].sprite=2;
loot[1].Nameitem=Blade; loot[2].Nameitem=Shield;
loot[1].bonus=5; loot[2].bonus=3;
....
So far I guess it's quite clear. Now this is where it becomes confused, and not so good :
Ennemies are defined with the same method
ennemis[k].HP=200;
//...
ennemis[k].loot1=0;
ennemis[k].loot2=0;
ennemis[k].loot3=0;
ennemis[k].loot4=0;
ennemis[k].loot5=0;
ennemis[k].baseloot=0;
Then,at map load, I attribute the loot to the different mobs with a function randomingly giving them the items with given probabilities.
attribuloot(k, 40,60, 100, 20, 20); //-->so 40% to have item1, 60% to have item 2...
So when the map is loaded, each munster has something like this :
ennemi[0].loot1=0; ennemi[1].loot1=0; ...
ennemi[0].loot2=1; ennemi[1].loot1=0;
ennemi[0].loot3=0; ennemi[1].loot1=1; ...
ennemi[0].loot4=0; ennemi[1].loot1=1;
ennemi[0].loot5=1; ennemi[1].loot1=0;
Anf finally when I loot the monster another function gives the image and attributes to the invitem based on the loot struct:(this becomes really messy :s)
function Loot_attribution(Character*corps, int l){
//l number of first loot item
//inventaireused is a global int to keep track of the number of inventory items I've used.
nmobjets=ennemis[corps.ID].loot1+ennemis[corps.ID].loot2+ennemis[corps.ID].loot3+ennemis[corps.ID].loot4+ennemis[corps.ID].loot5;//how many more inv items are we using
if(ennemis[corps.ID].loot1==1){
corps.AddInventory(inventory[inventaireused]);//adds the next unused item inventory to the mob
inventaireused++;
inventory[inventaireused].Graphic=butin[l].sprite; //gives the attributes
inventory[inventaireused].CursorGraphic=butin[l].sprite;
Lblloot1.Text= String.Format("%s",butin[l].Nomobjet); //this label is next to the item to display its name
Lblloot1.TextColor=butin[l].couleur;
Lblloot1.Visible=true;
}
if(ennemis[corps.ID].loot2==1){
corps.AddInventory(inventory[inventaireused]);
inventaireused++;
//and same fo the 4 other items
In clear, each type of monster could carry a maximum of 5 items, and for each monster all 5 items must be defined each time, this is what the 'l' variable is here for-->monster type1 can loot loot[0],loot[1],loot[2],loot[3],loot[4] (l==0).monster2 can loot loot[5]...loot[9](l==5) etc. This is particularly bad because if i want monster1 to be able to carry loot[6] I must define this item twice, more if I want this item to be carried by more monsters. It seems like a huge waste of space...
Besides the whole thing is actually extremely heavy to manipulate and I start to get lost when I want to add items descriptions or some kind of icon overlay when the mouse is over it. When I started to make the items pickable this became nuts and I realized there might be some easier way to do this. problem is that now my mind is stuck on this idea and I can't find anything else X3
Would some of you have some suggestions I could use? I can give more details if needed but I feel like I've already given too many and lost most of you "^^
Thanks