The following system is to be fired from the OnDeath event of boss creatures only.
What I have is about 1000+ blueprints of items that have become redundant due to better gear being available. These items used to be endgame options purchasable in our gameworld with a custom currency we call "Quest Points", which is basically like DKP. Below is kind of a template i set up in hopes of making a random loot generation based off substrings, to prevent us from having to make a case statement spanning over 1000 lines of code. The strings provided in GetStringRight are what all of these items use as prefixes, but all have random string lengths. What I am hoping to accomplish here is getting some help making this process easy.
As an example:
I want case 1 to have a chance at spawning any item starting with "dys_qst_"
case 2 spawns any item starting with "elviquest"
etc, etc etc..
-----
While keeping all of the above in mind, I also need to make sure that any items ending in "_quiver" or having a base item type of ammunition, are never to be created.
I really appreciate any help our gameworld can get in reaching this goal. The thought of having to make a case statement with over 1000 resref's is sickening, and hours and hours of nonstop work. I would never even consider it.
I am somewhat of a novice scripter and just recently started working with substrings, and figured this could be achieved very easily in theory, if only I knew how to do it correctly. Obviously the code below does not work, or I would not be posting here. It's only giving the end substring as a result. By I tried adding this substring to the prefix and still nothing.
I put this script in the OnPhysicalAttacked event of a placeable that was plot, has an inventory, and is useable.
Loaded up the module to test this out and make sure its creating items, but nothing happens. Please help =D
-----------
void main()
{
int nChance = d100();
//5% chance of spawning a 6QP item on the corpse
if(nChance <= 5)
{
string s6QP;
int nRandom = 11;
switch (nRandom)
{
case 01: s6QP = GetStringRight("dys_qst_", ; break; //Laura 6 QP Quest Items ("dys_qst_")
case 02: s6QP = GetStringRight("elviquest", 7); break; //Elvi 6 QP Quest Items ("elviquest")
case 03: s6QP = GetStringRight("hpy_itmq", ; break; //Happy 6 QP Quest Items ("hpy_itmq")
case 04: s6QP = GetStringRight("hpy_qitm", ; break; //Happy 6 QP Quest Items 2 ("hpy_qitm")
case 05: s6QP = GetStringRight("quad", 12); break; //Quad 6 QP Quest Items ("quad")
case 06: s6QP = GetStringRight("slayer", 10); break; //Slayer 6 QP Quest Items ("slayer")
case 07: s6QP = GetStringRight("sly_", 12); break; //Slayer 6 QP Quest Items 2 ("sly_")
case 08: s6QP = GetStringRight("twn_q", 11); break; //Twainer 6 QP Quest Items ("twn_q")
case 09: s6QP = GetStringRight("wolfy_", 10); break; //Wolfy 6 QP Quest Items ("wolfy_")
case 10: s6QP = GetStringRight("wtr_q_", 10); break; //Winter 6 QP Quest Items ("wtr_q_")
case 11: s6QP = GetStringRight("wtr_qf_", 9); break; //Winter 6 QP Quest Items 2 ("wtr_qf_")
}
CreateItemOnObject(s6QP, OBJECT_SELF, 1);
}
}
Modifié par SKIPPNUTTZ, 23 novembre 2011 - 02:28 .