Author Topic: Did anyone find a way to add sling/bullets/On-Hit properties to Commche's loot system?  (Read 411 times)

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               If so, can they give me their code? I'm pretty sure I can do it, but maybe somebody has already done it? That would save me some time '<img'>

Also I got a little present for you guys involving loot systems. I merged some of Merle's code with Commche's loot system and I made randomized weapon appearances possible. There's also randomized armor colors as well but no appearance (but it's possible!).

pastebin.com/nXWxkgAy - This is only the sd_loot system script, meaning you'd have to have his original package installed to work. If you want a complete override you can copy/paste this over your sd_lootscript. Otherwise if you want to only incorporate the imported code you would need to copy/paste the the new code at the same place where I've put them. There are nMaxModels in each weapon case and must be placed under the same weapon type.  The code for the randomized weapon appearances starts at 2058 and at 3061. The integer int nMaxModels; must also be at the top of the functions DropRanged and DropWeapon. The randomized item colors integers is line 15-653, which is required for the randomized armor colors.

There's probably more items you can incorporate with the randomized appearances. I haven't tinkered much with it save getting it to actually work, but looking at the code should give you some clues.

Thanks for reading and many thanks if you can lend me a hand '^_^'
               
               

               


                     Modifié par mwplayer, 30 juin 2011 - 09:26 .
                     
                  


            

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               did not mean to double post
               
               

               


                     Modifié par mwplayer, 30 juin 2011 - 09:23 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0


               onhit and vamp regen properties doesnt work on ranged weapons

that will be probably reason why they are not in that loot system

Anyway its possible to workaround it, i got some code that copy ranged weapon's properties such as onhit/vamp to ammo. But that hardly helps you.
               
               

               
            

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               What happens if you add it regardless? Does it show up as a bad STRREF/crash nwn/etc?

Anyway what's the code look like? Maybe I can add a check like

if (sType == "sdhcbow" && sType == "sdlcbow" && sType == "sdlbow" && sType == "sdsbow" == FALSE)

Meaning the on-hit properties would only be added if it isn't a range weapon (according to Commche's item tags)
               
               

               


                     Modifié par mwplayer, 30 juin 2011 - 10:01 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0


               

mwplayer wrote...

What happens if you add it regardless? Does it show up as a bad STRREF/crash nwn/etc?

Anyway what's the code look like? Maybe I can add a check like

if (sType == "sdhcbow" && sType == "sdlcbow" && sType == "sdlbow" && sType == "sdsbow" == FALSE)

Meaning the on-hit properties would only be added if it isn't a range weapon (according to Commche's item tags)

no, it appears normally but just dont work

i dont use commche's so it does looks like this:

void CheckOnHit(object oWeapon, object oAmmo)
{
itemproperty ip = GetFirstItemProperty(oWeapon);
 while(GetIsItemPropertyValid(ip))
 {
  switch(GetItemPropertyType(ip))
  {
  case ITEM_PROPERTY_ON_HIT_PROPERTIES:
  case ITEM_PROPERTY_REGENERATION_VAMPIRIC:
  AddItemProperty(DURATION_TYPE_TEMPORARY,ip,oAmmo,9999.9);
  break;
  }
 ip = GetNextItemProperty(oWeapon);
 }
}

    object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
    switch(GetBaseItemType(oItem))
    {
    case BASE_ITEM_BULLET:
     if(GetBaseItemType(oWeapon) == BASE_ITEM_SLING)
     {
     CheckOnHit(oWeapon,oItem);
     }
    break;
    case BASE_ITEM_BOLT:
     if(GetBaseItemType(oWeapon) == BASE_ITEM_HEAVYCROSSBOW || GetBaseItemType(oWeapon) == BASE_ITEM_LIGHTCROSSBOW)
     {
     CheckOnHit(oWeapon,oItem);
     }
    break;
    case BASE_ITEM_ARROW:
     if(GetBaseItemType(oWeapon) == BASE_ITEM_SHORTBOW || GetBaseItemType(oWeapon) == BASE_ITEM_LONGBOW)
     {
     CheckOnHit(oWeapon,oItem);
     }
    break;
    case BASE_ITEM_SHORTBOW:
    case BASE_ITEM_LONGBOW:
    oWeapon = GetItemInSlot(INVENTORY_SLOT_ARROWS,oPC);
     if(oWeapon != OBJECT_INVALID)
     {
     CheckOnHit(oItem,oWeapon);
     }
    break;
    case BASE_ITEM_HEAVYCROSSBOW:
    case BASE_ITEM_LIGHTCROSSBOW:
    oWeapon = GetItemInSlot(INVENTORY_SLOT_BOLTS,oPC);
     if(oWeapon != OBJECT_INVALID)
     {
     CheckOnHit(oItem,oWeapon);
     }
    break;
    case BASE_ITEM_SLING:
    oWeapon = GetItemInSlot(INVENTORY_SLOT_BULLETS,oPC);
     if(oWeapon != OBJECT_INVALID)
     {
     CheckOnHit(oItem,oWeapon);
     }
    break;
    }


               
               

               
            

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               Is there a better loot system to use? Or should I just make my own?

Commche's code is starting to ****** me off.  Like the thing where he makes duplicate weapon cases to satisfy d20(2) rolls... instead of using random. Here's an example

 iRoll = d20(2);
 switch(iRoll)
       {
// Axes

        case 0: {sType = "sdgaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Greataxe";
                 if (iRoll==2)sIName = "Two Handed Axe";
                 if (iRoll==3)sIName = "Decapitator";}
        case 1: {sType = "sdgaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Greataxe";
                 if (iRoll==2)sIName = "Two Handed Axe";
                 if (iRoll==3)sIName = "Decapitator";}
        case 2: {sType = "sdgaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Greataxe";
                 if (iRoll==2)sIName = "Two Handed Axe";
                 if (iRoll==3)sIName = "Decapitator";}
                 break;         break;
        case 3: {sType = "sdwaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Dwarven War Axe";
                 if (iRoll==2)sIName = "War Axe";
                 if (iRoll==3)sIName = "Headsplitter";}
                 break;
        case 4: {sType = "sdbaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Battleaxe";
                 if (iRoll==2)sIName = "Beserker Axe";
                 if (iRoll==3)sIName = "Siege Axe";}
                 break;
        case 5: {sType = "sdhaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Handaxe";
                 if (iRoll==2)sIName = "Cleaver";
                 if (iRoll==3)sIName = "Tomohawk";}
                 break;

// Bladed

        case 6: {sType = "sd_bastard"; iRoll = d3();
                 if (iRoll==1)sIName = "Bastard Sword";
                 if (iRoll==2)sIName = "Mercinary Blade";
                 if (iRoll==3)sIName = "Black Blade";}
                 break;
        case 7: {sType = "sdlsword"; iRoll = d3();
                 if (iRoll==1)sIName = "Longsword";
                 if (iRoll==2)sIName = "Knight's Sword";
                 if (iRoll==3)sIName = "Honor Blade";}
                 break;
        case 8: {sType = "sdlsword"; iRoll = d3();
                 if (iRoll==1)sIName = "Longsword";
                 if (iRoll==2)sIName = "Knight's Sword";
                 if (iRoll==3)sIName = "Honor Blade";}
                 break;
        case 9: {sType = "sdssword"; iRoll = d3();
                 if (iRoll==1)sIName = "Short Sword";
                 if (iRoll==2)sIName = "Half Blade";
                 if (iRoll==3)sIName = "Halfling Sword";}
                 break;
        case 10: {sType = "sdgsword"; iRoll = d3();
                 if (iRoll==1)sIName = "Greatsword";
                 if (iRoll==2)sIName = "Massive Blade";
                 if (iRoll==3)sIName = "Champion's Steel";}
                 break;
        case 11: {sType = "sdkatana"; iRoll = d3();
                 if (iRoll==1)sIName = "Katana";
                 if (iRoll==2)sIName = "Samurai Sword";
                 if (iRoll==3)sIName = "Assassin Blade";}
                 break;
        case 12: {sType = "sdscim"; iRoll = d3();
                 if (iRoll==1)sIName = "Scimitar";
                 if (iRoll==2)sIName = "Arabian Sword";
                 if (iRoll==3)sIName = "Sand Blade";}
                 break;
        case 13: {sType = "sdrapier"; iRoll = d3();
                 if (iRoll==1)sIName = "Rapier";
                 if (iRoll==2)sIName = "Swashbuckler";
                 if (iRoll==3)sIName = "Death Pin";}
                 break;
        case 14: {sType = "sddagger"; iRoll = d3();
                 if (iRoll==1)sIName = "Dagger";
                 if (iRoll==2)sIName = "Sticker";
                 if (iRoll==3)sIName = "Switchblade";}
                 break;

// Exotic

        case 15: {sType = "sdstaff3"; iRoll = d3();
                 iWType = 2;
                 if (iRoll==1)sIName = "Warlock Bone";
                 if (iRoll==2)sIName = "Shaman Totem";
                 if (iRoll==3)sIName = "Cane of Scorcery";}
                 break;
        case 16: {sType = "sdkama"; iRoll = d3();
                 if (iRoll==1)sIName = "Kama";
                 if (iRoll==2)sIName = "Monk Claw";
                 if (iRoll==3)sIName = "Ripper";}
                 break;
        case 17: {sType = "sdkukri"; iRoll = d3();
                 if (iRoll==1)sIName = "Kukri";
                 if (iRoll==2)sIName = "Machetti";
                 if (iRoll==3)sIName = "Scorpion Tail";}
                 break;
        case 18: {sType = "sdlbow"; iRoll = d3();
                 iWType = 1;
                 if (iRoll==1)sIName = "Siege Bow";
                 if (iRoll==2)sIName = "Elven War Bow";
                 if (iRoll==3)sIName = "Battle Bow";}
                 break;


// Blunt

        case 19: {sType = "sdclub"; iRoll = d3();
                 if (iRoll==1)sIName = "Club";
                 if (iRoll==2)sIName = "Baton";
                 if (iRoll==3)sIName = "Truncheon";}
                 break;
        case 20: {sType = "sdhflail"; iRoll = d3();
                 if (iRoll==1)sIName = "Heavy Flail";
                 if (iRoll==2)sIName = "Deathswinger";
                 if (iRoll==3)sIName = "Skull Masher";}
                 break;
        case 21: {sType = "sdlflail"; iRoll = d3();
                 if (iRoll==1)sIName = "Flail";
                 if (iRoll==2)sIName = "Light Flail";
                 if (iRoll==3)sIName = "Head ******";}
                 break;
        case 22: {sType = "sdstaff1"; iRoll = d3();
                 iWType = 2;
                 if (iRoll==1)sIName = "Magestaff";
                 if (iRoll==2)sIName = "Arcane Staff";
                 if (iRoll==3)sIName = "Magus Pole";}
                 break;

        case 23: {sType = "sdwhamm"; iRoll = d3();
                 if (iRoll==1)sIName = "Warhammer";
                 if (iRoll==2)sIName = "Thunderhead";
                 if (iRoll==3)sIName = "Earthshaker";}
                 break;
        case 24: {sType = "sdmace"; iRoll = d3();
                 if (iRoll==1)sIName = "Mace";
                 if (iRoll==2)sIName = "Wrathpole";
                 if (iRoll==3)sIName = "Justice Bringer";}
                 break;
        case 25: {sType = "sdmstar"; iRoll = d3();
                 if (iRoll==1)sIName = "Morning Star";
                 if (iRoll==2)sIName = "Neck Crusher";
                 if (iRoll==3)sIName = "Bloodcopter";}
                 break;

//Double Sided

        case 26: {sType = "sddbsword"; iRoll = d3();
                 if (iRoll==1)sIName = "Doubleblade";
                 if (iRoll==2)sIName = "Doomblade";
                 if (iRoll==3)sIName = "Body Processor";}
                 break;
        case 27: {sType = "sddsmace"; iRoll = d3();
                 if (iRoll==1)sIName = "Double Mace";
                 if (iRoll==2)sIName = "Damage Pole";
                 if (iRoll==3)sIName = "Twin Basher";}
                 break;
        case 28: {sType = "sddsaxe"; iRoll = d3();
                 if (iRoll==1)sIName = "Double Axe";
                 if (iRoll==2)sIName = "Crowd Cutter";
                 if (iRoll==3)sIName = "Haymaker";}
                 break;
        case 29: {sType = "sdqstaff"; iRoll = d3();
                 if (iRoll==1)sIName = "Quaterstaff";
                 if (iRoll==2)sIName = "Pole";
                 if (iRoll==3)sIName = "Oak Rod";}
                 break;

// Polearms

        case 30: {sType = "sdhalberd"; iRoll = d3();
                 if (iRoll==1)sIName = "Halberd";
                 if (iRoll==2)sIName = "Death Reach";
                 if (iRoll==3)sIName = "Wind Cutter";}
                 break;
        case 31: {sType = "sdscythe"; iRoll = d3();
                 if (iRoll==1)sIName = "Reaper";
                 if (iRoll==2)sIName = "Soul Reaver";
                 if (iRoll==3)sIName = "Flesh Harvester";}
                 break;
        case 32: {sType = "sdspear"; iRoll = d3();
                 if (iRoll==1)sIName = "Spear";
                 if (iRoll==2)sIName = "Amazon Finger";
                 if (iRoll==3)sIName = "Body Skewer";}
                 break;

// Whip

      case 33: {sType = "sdwhip"; iRoll = d3();
                 if (iRoll==1)sIName = "Whip";
                 if (iRoll==2)sIName = "Bullwhip";
                 if (iRoll==3)sIName = "Deathrope";}
                 break;

// Ranged


        case 34: {sType = "sdsbow"; iRoll = d3();
                 iWType = 1;
                 if (iRoll==1)sIName = "Halfling War Bow";
                 if (iRoll==2)sIName = "Shortbow";
                 if (iRoll==3)sIName = "Bloodstring";}
                 break;
        case 35: {sType = "sdlcbow"; iRoll = d3();
                 iWType = 1;
                 if (iRoll==1)sIName = "Light Crossbow";
                 if (iRoll==2)sIName = "Bolt Pistol";
                 if (iRoll==3)sIName = "Auto Bow";}
                 break;
        case 36: {sType = "sdhcbow"; iRoll = d3();
                 iWType = 1;
                 if (iRoll==1)sIName = "Battle Crossbow";
                 if (iRoll==2)sIName = "Bolt Rifle";
                 if (iRoll==3)sIName = "Steelstring Sniper";}
                 break;
 // Mage


        case 37: {sType = "sdlhamm"; iRoll = d3();
                 if (iRoll==1)sIName = "Light Hammer";
                 if (iRoll==2)sIName = "Wood Hammer";
                 if (iRoll==3)sIName = "Hole Puncher";}
                 break;
        case 38: {sType = "sdstaff2"; iRoll = d3();
                 iWType = 2;
                 if (iRoll==1)sIName = "Mystic Cane";
                 if (iRoll==2)sIName = "Staff of Conjuring";
                 if (iRoll==3)sIName = "Ivory Staff";}
                 break;
        case 39: {sType = "sdsickle"; iRoll = d3();
                 if (iRoll==1)sIName = "Sickle";
                 if (iRoll==2)sIName = "Blood Crest";
                 if (iRoll==3)sIName = "Death Ring";}
                 break;
        case 40: {sType = "sdmgloves"; iRoll = d3();
                  iWType = 3;
                 if (iRoll==1)sIName = "Death Claws";
                 if (iRoll==2)sIName = "Exploding Fists";
                 if (iRoll==3)sIName = "Battle Gloves";}
                 break;

      }


Is there any reason to use dice instead of Random? ':huh:'
               
               

               
            

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               what's with these forums, double post '<img'>

and not even a clue as to where the delete button is
               
               

               


                     Modifié par mwplayer, 01 juillet 2011 - 03:41 .
                     
                  


            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0


               d3(); takes less time to type than Random(3)+1; to do the same thing.  That would be one reason to do it that way, though I think the difference is largely personal preference, since neither actually gets you a proper random number anyways.
               
               

               
            

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0


               Well, thanks for the help all. I've decided to use Merle's weapon system as a basis for a loot system - along with Commche's code for gems and sockets.