DarkSlayerEX Posted June 19, 2015 Share Posted June 19, 2015 Another one of the problems that crop up when it comes to repairing and holding on to weapons at the moment though, is there is a lot of weapons that can't actually be repaired (without having mods do so) Utensils, Crowbars, and Knives i believe are all examples. Link to comment Share on other sites More sharing options...
tommysticks Posted June 20, 2015 Author Share Posted June 20, 2015 Another one of the problems that crop up when it comes to repairing and holding on to weapons at the moment though, is there is a lot of weapons that can't actually be repaired (without having mods do so) Utensils, Crowbars, and Knives i believe are all examples. I'll have to fix that. Pretty simple fix. Thanks for the heads up though. Link to comment Share on other sites More sharing options...
Ankhr Posted June 21, 2015 Share Posted June 21, 2015 Hi, was wondering, if I have a baseball bat (or plank) that has both a prefix and suffix already, then I craft a nailed baseball bat from that bat, should the prefix and suffix be transferred to the nailed bat or is it intended that it just simply becomes a nailed baseball bat without any pre/suffix? Seemed kinda counterproductive Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted June 21, 2015 Share Posted June 21, 2015 If anything, it might just be a programming oversight, as I believe not many weapons that i can recall (Bat, Plank only?) can be crafted into another type of weapon. Link to comment Share on other sites More sharing options...
tommysticks Posted June 21, 2015 Author Share Posted June 21, 2015 Yeah, was definitely an oversight. I will take a look at it. I don't know if mod data is stored between a newly crafted weapon and the original. If it is, pretty sure I can come up with a solution. Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted June 25, 2015 Share Posted June 25, 2015 It looks like food-making recipes retain food rot value from the ingredients over to the output item. Perhaps looking into how that's being set up might let you find a way to move the prefix and suffix to an output weapon. Also, what happens to the prefix and suffix of a weapon if it actually breaks? It seems like it would become a new item, which I assume would cause the same problem as crafting it into a new weapon. Link to comment Share on other sites More sharing options...
NoMiS Plays Posted June 28, 2015 Share Posted June 28, 2015 Hey there! Just started using this mod in a series on my channel and have been enjoying it so far. Came across a bug the other day where the axe I was using in the Winter is Coming challenge kept getting a new prefix/suffix every time I killed a zed. I must have gotten up to a dozen names on it before switching out lol. First name is applied at 3:20 and more continue being applied up until about 6:35https://www.youtube.com/watch?v=igF2xI6s-PI&lc=z12jvndrrozidh1qo04cdpt53p24gtbxt34 Thanks and keep up the good work! Link to comment Share on other sites More sharing options...
SandyBeaches Posted June 29, 2015 Share Posted June 29, 2015 Heya! I love this mod but I have noticed a significant bug. If you save, exit and then reload a game, the only properties the weapons seem to retain are the name changes. Considering I got a graceful sledgehammer of the grass hopper, I was pretty sad about it. I can't really see why this is happening though. Perhaps changes should be assigned to a seperate instance and then override the object in the inventory? That would explain why the strings are saving, as they are objects themselves... O.K, been digging around the java files for a bit. Seems item properties like damage, weight etc AREN'T SAVED TO DISK! Instead, the game loads the name/id of an item, then fills it out from the base script definitions. This makes a lot of sense, as doing so greatly reduces the size of save files. Mod data is saved however. Here is the important function; public void load(ByteBuffer input, int WorldVersion, boolean net) throws IOException { net = false; this.uses = input.getInt(); this.id = input.getLong(); if (input.get() == 1) { if (this.table == null) { this.table = LuaManager.platform.newTable(); } this.table.load(input, WorldVersion); } if (input.get() == 1) { ((DrainableComboItem)this).setUsedDelta(input.getFloat()); } setCondition(input.get(), false); this.activated = (input.get() == 1); setHaveBeenRepaired(input.getShort()); if (input.get() != 0) { this.name = GameWindow.ReadString(input); } if (input.get() == 1) { int size = input.getInt(); this.byteData = ByteBuffer.allocate(size); for (int n = 0; n < size; n++) { this.byteData.put(input.get()); } this.byteData.flip(); } if (WorldVersion >= 30) { int it = input.getInt(); if (it > 0) { this.extraItems = new ArrayList(); for (int i = 0; i < it; i++) { this.extraItems.add(GameWindow.ReadString(input)); } } } if (WorldVersion >= 31) { setCustomName(input.get() == 1); } if (WorldVersion >= 55) { float weight = input.getFloat(); if (weight >= 0.0F) { setActualWeight(weight); setCustomWeight(true); } } if (WorldVersion >= 57) { setKeyId(input.getInt()); } if (WorldVersion >= 59) { setTaintedWater(input.get() == 1); } if (WorldVersion >= 62) { setRemoteControlID(input.getInt()); setRemoteRange(input.getInt()); } } Note the SetCustomWeight. AFAIK this is what allows an items weight to be saved. For all others, I would recommend saving all the data to your mod data and then re-applying effects when items are loaded. Hope this helps! I have just spent several hours searching, and I think the event you want to lock to is LuaEventManager.triggerEvent("LoadGridsquare", square); If a dev could provide better insight I would appreciate it. Link to comment Share on other sites More sharing options...
tommysticks Posted June 29, 2015 Author Share Posted June 29, 2015 Holy cow, thanks a lot guys! I have no internet ATM so can't update, but I sure will when I get back to civilization. Link to comment Share on other sites More sharing options...
blindcoder Posted June 29, 2015 Share Posted June 29, 2015 OnLoadGridSquare is the place for items on the ground, the other one would be at least OnLoad for to check for items in players inventory. Note thta OnLoadGridSquare should be implemented as performant as possible (ie: return as quickly as possible), because it can seriously slow down world streaming. Link to comment Share on other sites More sharing options...
SandyBeaches Posted June 29, 2015 Share Posted June 29, 2015 How I would do it would be to check "Is this a weapon?", no? end. If yes, follow with checking the mod data if a "Has this weapon got mods?" bool is set. If no, end. That should make things nice and fast. Link to comment Share on other sites More sharing options...
blindcoder Posted June 29, 2015 Share Posted June 29, 2015 How I would do it would be to check "Is this a weapon?", no? end. If yes, follow with checking the mod data if a "Has this weapon got mods?" bool is set. If no, end. That should make things nice and fast. Yes, that sounds good! Link to comment Share on other sites More sharing options...
SandyBeaches Posted June 30, 2015 Share Posted June 30, 2015 O.K, I have spent +6 hours digging through the java and rewriting the mod from scratch. I'm not finished yet but I have work tomorrow so I have to stop. I have learned many things from the code, namely that more is saved than I thought, as I forgot to check the HandWeapon class.THINGS THAT ARE SAVED! float maxRange float minRangeRanged int ClipSize float minDamage float maxDamage int RecoilDelay int aimingTim int reloadTime int HitChance float minAngle if (input.get() == 1) attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); if (input.get() == 1) attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); if (input.get() == 1) attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); if (input.get() == 1) attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); if (input.get() == 1) attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); if (input.get() == 1) { attachWeaponPart((WeaponPart)InventoryItemFactory.CreateItem(GameWindow.ReadString(input))); } setExplosionTimer(input.getInt()); uses id usedDelta condition activated haveBeenRepaired name customName(input.get() == 1); float weight = input.getFloat(); -- ONLY SAVED IF SETCUSTOMWEIGHT WAS SET! if (weight >= 0.0F) { setActualWeight(weight); setCustomWeight(true); } setTaintedWater(input.get() == 1); setRemoteControlID(input.getInt()); setRemoteRange(input.getInt());I will have to rewrite a lot more since I only found this out recently. Other things I found:The following can freely be used to manipulate a weapon:NOTE: xMod is multiplicative,isX is Boolean and paired with setX,getX is paired with setXThere are no sanity checks on any of these. other than binary ones, they can be set to any real value.So you can give an item NEGATIVE weight etc. getEnduranceModisAlwaysKnockdownsetKnockdownModgetAmmoTypeisCanBarracadeisKnockBackOnNoDeathgetMaxAnglegetMaxDamagegetMaxHitCountgetMaxRangegetMinAnglegetMinimumSwingTimegetMinRangegetNoiseFactorgetOtherHandRequiregetPushBackMod()isRangeFalloff()isShareDamage()getSwingTime()getToHitModifier()isUseEndurance()getDoorDamage()getConditionLowerChance()isMultipleHitConditionAffected()isShareEndurance()isCantAttackWithLowestEndurance()getAimingMod()getCriticalChance()getHitChance()getRecoilDelay()isPiercingBullets()getClipSize()The following MAY NOT be feely used. Regardless of what you set them too, their return values (get) are a function of the player's skills.getDamageModgetRangeModgetFatigueModgetKnockbackModgetSpeedModgetToHitModAnd lastly, here is what I got done today. I couldn't understand OnLoad so I just put a hack in OnEquipped to check things.--InventoryItem and HandWeapon and IsoPlayer:getPrimaryHandItem--[[RAWK'S additions and thoughts.Need to check on load event and ongridload?Table of upgrades?NWBT = {};NWBT[1] = {["category"] = "Legendary"};NWBT[1][1] = {["nameChange" = ""; ["stat"] = ""; ["multiply"] = 1; }Methodology: Leave weapons unaltered in saves (except name) and apply all modifications whenmod data needed:namedWeaponsbEquipped A binary of whether to run the initialization functions.namedWeaponstRand{ ... an array of 4? randomized numbers that predetermines the bonuses (to prevent save scumming)namedWeaponstConditionUpgrade Every time the weapon is upgraded, its max condition is upgraded. Use to check if we have applied all upgrades yet.namedWeaponstKillQuota{ ... a 2? item array of the kills needed to earn the bonusesnamedWeaponsnKills Int of kills with weapon.namedWeaponsbBonusEarned A binary of whether a bonus has been earned on the weapon. Used for short-circuiting out of functions.namedWeaponssOriginalName Original name of the itemnamedWeaponssOriginalTooltip Original tooltip of the item. We will show the modifications here too.Functions should be (in shorthand):on_load(object o) if o.type ~= weapon then result; else tModData = o:getModData(); if tModData.namedWeaponsbBonusEarned ~= true then result; else setStats(o, tModData); end endPREVIOUS MOD DATA.bEquipped nil or 1.zRandMod = 1 or -1 ; used for condition. Unneeded..oStage1; kills for first upgrade.oStage2; kills for second upgrade.nKills; int of kills with weapon.namedWeaponssOriginalName = primaryHandItem:getName(); original name of weapon.namedWeaponstRand[1]/2/3; stat decider, currently done when weapon reaches kill count, allows save scumming. NOTE! Is overridden!]]local floor = math.floor; local function round(_num) local number = _num; return number <= 0 and floor(number) or floor(number + 0.5);end-- used for shortening functions.local function betweenLimits(num, lower, upper) if lower == nil then lower = 0; end if upper == nil then upper = 10000; return math.min(math.max(num, lower), upper);end-- function used to initialize variables, and reapply on load.local function beenEquipped() local player = getPlayer(); local primaryHandItem = player:getPrimaryHandItem(); -- check to see if there is an item. if primaryHandItem == nil then return; end -- check if this is can be used as a weapon. if primaryHandItem:isWeapon() == false then return; end -- check if this test has been run before local pModData = primaryHandItem:getModData(); if pModData.namedWeaponsbEquipped == true then loadAndCheck(); else -- Short-circuiting done! On to defining the variables. -- Predefine what the bonus this weapon will get. pModData.namedWeaponstRand = { ZombRand(8),ZombRand(10),ZombRand(8),ZombRand(10) }; -- array is; 1 and 3, buff categories, 2 and 4, buff levels. pModData.namedWeaponsnKills = 0; -- Make an int array of kills needed to reach buff levels, based off weapon durability. local iCM, iCLC = primaryHandItem:getConditionMax(), primaryHandItem:getConditionLowerChance(); pModData.namedWeaponstKillQuota = {1 + (1 + iCM * 0.4) * (iCLC / 10), 2 + (1 + iCM * 0.6) * (iCLC / 10)}; -- A binary used for short-circuiting loading checks. pModData.namedWeaponsbBonusEarned = false; -- Float table to store modified stats. Used for checking if we have applied them already. pModData.namedWeaponstConditionUpgrade = primaryHandItem:getConditionMax(); -- Strings storing original name and tooltip. pModData.namedWeaponssOriginalName = primaryHandItem:getName(); pModData.namedWeaponssOriginalTooltip = primaryHandItem:getTooltip(); pModData.namedWeaponsbEquipped = true -- we are done here. end print("Kills required for upgrade: " .. pModData.namedWeaponsnKills); print("Kills required for upgrade: " .. pModData.namedWeaponstKillQuota[1]); print("Kills required for 2nd upgrade: " .. pModData.namedWeaponstKillQuota[2]);end-- Function used to apply stats on load. Currently called through equipped as a hack.local function loadAndCheck()-- duplicate code due to future split local player = getPlayer(); local primaryHandItem = player:getPrimaryHandItem(); -- check to see if there is an item. if primaryHandItem == nil then return; end -- check if this is a weapon if primaryHandItem:isWeapon() == false then return; end -- check if this test has been run before local pModData = primaryHandItem:getModData(); if (pModData.namedWeaponsbEquipped and pModData.namedWeaponsbBonusEarned) then -- current condition is saved to file, but conditionMax is not! so we can use it to check if we -- need to refresh stats. if pModData.namedWeaponstConditionUpgrade > primaryHandItem:getConditionMax() then if pModData.namedWeaponsnKills < pModData.namedWeaponstKillQuota[1] then print("something has gone horribly wrong"); elseif pModData.namedWeaponsnKills < pModData.namedWeaponstKillQuota[2] then applyFirstWeaponUpgrade(primaryHandItem); else applyFirstWeaponUpgrade(primaryHandItem); applySecondWeaponUpgrade(primaryHandItem); end end endendlocal function killCounter() local player = getPlayer(); local primaryHandItem = player:getPrimaryHandItem(); -- check to see if there is an item. if primaryHandItem == nil then return; end -- check if this is a weapon if primaryHandItem:getMinDamage() == nil then return; end local pModData = primaryHandItem:getModData(); -- we just killed something, so update the count. pModData.namedWeaponsnKills = pModData.namedWeaponsnKills + 1; -- did we just earn the first buff? if pModData.namedWeaponsnKills == pModData.namedWeaponstKillQuota[1] then applyFirstWeaponUpgrade(primaryHandItem); print("Ding!"); -- what about the second? elseif pModData.namedWeaponsnKills == pModData.namedWeaponstKillQuota[2] then applySecondWeaponUpgrade(primaryHandItem); print("Ding! Gratz!"); endendlocal function applyFirstWeaponUpgrade(primaryHandItem) if primaryHandItem == nil return; end -- get mod data local pModData = primaryHandItem:getModData(); -- we are going to be lazy and not check for nil as we control all calls to here. -- upgrade condition max first. All upgraded weapons get this! primaryHandItem:setConditionMax(betweenLimits(1.2 * primaryHandItem:getConditionMax() + ZombRand(10),1)); -- we will update the namedWeaponstConditionUpgrade and namedWeaponsbBonusEarned at the end. -- lets find out what category of buff we got! --LEGENDARY! Give it some more durability! if pModData.namedWeaponstRand[1] == 7 then primaryHandItem:setConditionLowerChance(betweenLimits(primaryHandItem:getConditionLowerChance() * 1.2 + 5, 1)); primaryHandItem:setConditionMax(betweenLimits(primaryHandItem:getConditionMax() * 1.4 + 5,1)); if pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Indestructible " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 1000); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 100); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Weightless " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(0); primaryHandItem:setWeight(0); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Evil " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(betweenLimits(primaryHandItem:getMaxDamage() * 2,1)); primaryHandItem:setMinDamage(betweenLimits(primaryHandItem:getMinDamage() * 2, 0.5)); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Cleaving " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxHitCount(betweenLimits(primaryHandItem:getMaxHitCount() * 2 + 4, 4)); --buffed. Need to add variable to alter for difficulties. elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Backstabbing " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(betweenLimits(primaryHandItem:getCriticalChance() + 60, 60, 80); --Limits need to be defined in variable. elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("King's " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(betweenLimits(primaryHandItem:getSwingTime() - 0.75,0.1)); primaryHandItem:setMinimumSwingTime(betweenLimits(primaryHandItem:getMinimumSwingTime() - 0.75, 0.1)); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Giant " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(betweenLimits(primaryHandItem:getPushBackMod() * 1.4 + 2.5, 2.5)); else primaryHandItem:setName("Wood foe " .. pModData.namedWeaponssOriginalName); primaryHandItem:setDoorDamage(betweenLimits(primaryHandItem:getDoorDamage() * 1.4 + 35, 35)); primaryHandItem:setTreeDamage(betweenLimits(primaryHandItem:getTreeDamage() * 1.4 + 35, 35)); end -- Durability!! elseif pModData.namedWeaponstRand[1] == 6 then if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Tenacious " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 4 + 10); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3 + 5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Hefty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 3); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Trusty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 2 + 5); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Rugged " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Stout " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Lasting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Sturdy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Hardy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.4); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Well-made " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.3); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 1); else primaryHandItem:setName("Firm " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 1); end -- Weight! elseif pModData.namedWeaponstRand[1] == 5 then if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Graceful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.1)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.1)); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Fluttering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.2)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.2)); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Aerial " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.3)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.3)); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Thin " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.4)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.4)); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Handy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.5)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.5)); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Smooth " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.6)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.6)); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Fine " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.7)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.7)); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Fair " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.8)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.8)); else pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Little " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(betweenLimits(primaryHandItem:getActualWeight() * 0.9)); primaryHandItem:setWeight(betweenLimits(primaryHandItem:getWeight() * 0.9)); end elseif pModData.namedWeaponstRand[1] == 4 then -- range prefix -- works if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Towering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Long " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.9); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Excessive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.8); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Ample " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.7); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Considerable " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.6); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Abundant " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.5); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Great " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.4); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Reaching " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.3); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Built " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.2); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end else primaryHandItem:setName("Laden " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end end elseif pModData.namedWeaponstRand[1] == 3 then -- damage prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Fatal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 1); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Ruinous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.9); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Baneful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.8); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Dire " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.7); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Slaughterous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.6); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Lethal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Destructive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Wreckful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Deadly " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.2); else primaryHandItem:setName("Damaging " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.1); end elseif pModData.namedWeaponstRand[1] == 2 then -- speed prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Agile " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Hasty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.45); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.45); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Nimble " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.4); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.4); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Accelerated " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.35); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.35); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Fleeting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.3); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.3); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Rapid " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.25); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.25); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Winged " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.2); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.2); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Swift " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.15); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.15); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Quick " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.1); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.1); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end else primaryHandItem:setName("Ready " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end end elseif pModData.namedWeaponstRand[1] == 1 then -- knockback prefix -- if primaryHandItem:getKnockDownMod() == nil then -- problem here w crowbar -- primaryHandItem:setKnockDownMod(0.1); -- else -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod()); -- end -- if primaryHandItem:getPushBackMod() == nil then -- primaryHandItem:setPushBackMod(0.1); -- end if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Mammoth " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 1.5); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Titanic " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.95); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Colossal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.85); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Monstrous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.75); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Enormous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.65); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Immense " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.55); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Massive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.45); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Great " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.35); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Vast " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.25); else primaryHandItem:setName("Big " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.15); end else -- crit prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Sinister " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 50); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Withering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 45); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Exacting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 40); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Cynical " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 35); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Condemning " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 30); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Biting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 25); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Cutting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 20); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Penetrating " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 15); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Harmful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 10); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end else primaryHandItem:setName("Sharp " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 5); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end end --[[Previous Version. Kept for legacy reading. local function numberKills() local player = getPlayer(); local primary = player:getPrimaryHandItem(); if primary ~= nil then local pModData = primaryHandItem:getModData(); pModData.nKills = pModData.nKills + 1; -- += is not used in lua, nKills can now be called from any function in any file -- player:Say("That's " .. pModData.nKills .. " with this weapon."); print("Zeds killed with this weapon " .. pModData.nKills); if pModData.nKills == pModData.wStage1 then -- if pModData.nKills == 1 then primaryHandItem:setConditionLowerChance(1.4 * primaryHandItem:getConditionLowerChance() + 1); primaryHandItem:setConditionMax(1.4 * primaryHandItem:getConditionMax() + ZombRand(20)) primaryHandItem:setCondition(primaryHandItem:getConditionMax()); pModData.namedWeaponstRand[1] = ZombRand(8); -- pModData.namedWeaponstRand[1] = 1; pModData.namedWeaponstRand[2] = ZombRand(9); pModData.namedWeaponstRand[2] = ZombRand(10); if pModData.namedWeaponstRand[1] == 7 then -- special prefix - works primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax()); if pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Indestructible " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(1000); primaryHandItem:setConditionMax(100); primaryHandItem:setCondition(100); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Weightless " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(0); primaryHandItem:setWeight(0); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Evil " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() * 2); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() * 2 + 0.1); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Cleaving " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxHitCount(primaryHandItem:getMaxHitCount() + ZombRand(2) + 1); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Backstabbing " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 60); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("King's " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.75); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.75); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Giant " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 2.5); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 1.5); else primaryHandItem:setName("Breaching " .. pModData.namedWeaponssOriginalName); primaryHandItem:setDoorDamage(primaryHandItem:getDoorDamage() + 35); end elseif pModData.namedWeaponstRand[1] == 6 then -- durability prefix - works if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Tenacious " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 4 + 10); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3 + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Hefty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 3); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Trusty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 2 + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Rugged " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Stout " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Lasting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Sturdy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Hardy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Well-made " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 1); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); else primaryHandItem:setName("Firm " .. pModData.namedWeaponssOriginalName); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 1); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); end elseif pModData.namedWeaponstRand[1] == 5 then -- weight prefix - works if pModData.namedWeaponstRand[2] <= 9 then primaryHandItem:setName("Graceful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 1); primaryHandItem:setWeight(primaryHandItem:getWeight() - 1); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Fluttering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.9); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.9); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Aerial " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.8); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.8); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Thin " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.7); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.7); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Handy " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.6); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.6); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Smooth " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.5); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.5); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Fine " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.4); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.4); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Fair " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.3); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.3); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Little " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.2); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.2); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end else primaryHandItem:setName("Light " .. pModData.namedWeaponssOriginalName); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.1); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.1); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end end elseif pModData.namedWeaponstRand[1] == 4 then -- range prefix -- works if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Towering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Long " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.9); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Excessive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.8); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Ample " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.7); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Considerable " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.6); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Abundant " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.5); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Great " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.4); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Reaching " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.3); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Built " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.2); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end else primaryHandItem:setName("Laden " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end end elseif pModData.namedWeaponstRand[1] == 3 then -- damage prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Fatal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 1); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Ruinous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.9); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Baneful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.8); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Dire " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.7); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Slaughterous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.6); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Lethal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Destructive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Wreckful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Deadly " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.2); else primaryHandItem:setName("Damaging " .. pModData.namedWeaponssOriginalName); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.1); end elseif pModData.namedWeaponstRand[1] == 2 then -- speed prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Agile " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Hasty " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.45); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.45); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Nimble " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.4); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.4); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Accelerated " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.35); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.35); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Fleeting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.3); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.3); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Rapid " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.25); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.25); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Winged " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.2); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.2); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Swift " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.15); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.15); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Quick " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.1); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.1); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end else primaryHandItem:setName("Ready " .. pModData.namedWeaponssOriginalName); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end end elseif pModData.namedWeaponstRand[1] == 1 then -- knockback prefix -- if primaryHandItem:getKnockDownMod() == nil then -- problem here w crowbar -- primaryHandItem:setKnockDownMod(0.1); -- else -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod()); -- end -- if primaryHandItem:getPushBackMod() == nil then -- primaryHandItem:setPushBackMod(0.1); -- end if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Mammoth " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 1.5); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Titanic " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.95); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Colossal " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.85); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Monstrous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.75); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Enormous " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.65); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Immense " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.55); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Massive " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.45); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Great " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.35); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Vast " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.25); else primaryHandItem:setName("Big " .. pModData.namedWeaponssOriginalName); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.15); end else -- crit prefix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName("Sinister " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 50); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName("Withering " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 45); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName("Exacting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 40); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName("Cynical " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 35); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName("Condemning " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 30); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName("Biting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 25); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName("Cutting " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 20); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName("Penetrating " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 15); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName("Harmful " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 10); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end else primaryHandItem:setName("Sharp " .. pModData.namedWeaponssOriginalName); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 5); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end end end player:Say("This is a " .. primaryHandItem:getName()); end endendlocal function numberKills2() local player = getPlayer(); local primary = player:getPrimaryHandItem(); if primary ~= nil then local pModData = primaryHandItem:getModData(); if pModData.nKills == pModData.wStage2 then -- if pModData.nKills == 2 then primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 10); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 10); primaryHandItem:setCondition(primaryHandItem:getConditionMax()); pModData.namedWeaponstRand[1] = ZombRand(8); -- pModData.namedWeaponstRand[1] = 1; pModData.namedWeaponstRand[2] = ZombRand(9); pModData.namedWeaponstRand[2] = ZombRand(10); if pModData.namedWeaponstRand[1] == 7 then -- special suffix - works primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 10); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 10); primaryHandItem:setCondition(primaryHandItem:getConditionMax()); if pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of stone"); primaryHandItem:setConditionLowerChance(1000); primaryHandItem:setConditionMax(100); primaryHandItem:setCondition(100); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of the feather"); primaryHandItem:setActualWeight(0); primaryHandItem:setWeight(0); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of hell"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() * 2); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() * 2 + 0.1); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of rending"); primaryHandItem:setMaxHitCount(primaryHandItem:getMaxHitCount() + ZombRand(3) + 1); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of the assassin"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 60); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of haste"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.75); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.75); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of the colossus"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 2.5); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 1.5); else primaryHandItem:setName(primaryHandItem:getName() .. " of breaching"); primaryHandItem:setDoorDamage(primaryHandItem:getDoorDamage() + 35); end elseif pModData.namedWeaponstRand[1] == 6 then -- durability suffix - works if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of tenacity"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 4 + 10); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3 + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of heftiness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 3); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 3); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of trustworthiness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() * 2 + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of ruggedness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2 + 5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of stoutness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of longevity"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 2); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of sturdiness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 5); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of hardiness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of craftsmanship"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() * 1.5); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 1); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); else primaryHandItem:setName(primaryHandItem:getName() .. " of firmness"); primaryHandItem:setConditionLowerChance(primaryHandItem:getConditionLowerChance() + 1); primaryHandItem:setConditionMax(primaryHandItem:getConditionMax() + 2); primaryHandItem:setCondition(primaryHandItem:getConditionMax() ); end elseif pModData.namedWeaponstRand[1] == 5 then -- weight suffix - works if pModData.namedWeaponstRand[2] <= 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of cotton"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 1); primaryHandItem:setWeight(primaryHandItem:getWeight() - 1); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of the leaf"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.9); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.9); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of the sky"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.8); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.8); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " that is thin"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.7); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.7); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " that is handy"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.6); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.6); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " that is smooth"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.5); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.5); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " that is fine"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.4); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.4); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " that is easy to carry"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.3); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.3); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " that is tiny"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.2); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.2); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end else primaryHandItem:setName(primaryHandItem:getName() .. " that is not heavy"); primaryHandItem:setActualWeight(primaryHandItem:getActualWeight() - 0.1); primaryHandItem:setWeight(primaryHandItem:getWeight() - 0.1); if primaryHandItem:getActualWeight() <= 0 then primaryHandItem:setActualWeight(0.1); end if primaryHandItem:getWeight() <= 0 then primaryHandItem:setWeight(0.1); end end elseif pModData.namedWeaponstRand[1] == 4 then -- range suffix -- works if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of the tower"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of length"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.9); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of excess"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.8); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of amplitude"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.7); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of impressiveness"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.6); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of abundance"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.5); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of greatness"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.4); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of reach"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.3); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of quality"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.2); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end else primaryHandItem:setName(primaryHandItem:getName() .. " of ladency"); primaryHandItem:setMaxRange(primaryHandItem:getMaxRange() + 0.1); if primaryHandItem:getMaxRange() >= 2.25 then primaryHandItem:setMaxRange(2.25); end end elseif pModData.namedWeaponstRand[1] == 3 then -- damage suffix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of fatality"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 1); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of ruin"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.9); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of bane"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.8); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of agony"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.7); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of slaughter"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.6); primaryHandItem:setMinDamage(primaryHandItem:getMinDamage() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of lethality"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.5); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of destruction"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.4); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of wreck"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.3); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of death"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.2); else primaryHandItem:setName(primaryHandItem:getName() .. " of damage"); primaryHandItem:setMaxDamage(primaryHandItem:getMaxDamage() + 0.1); end elseif pModData.namedWeaponstRand[1] == 2 then -- speed suffix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of agility"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of lightning"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.45); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.45); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of the grasshopper"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.4); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.4); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of the wind"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.35); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.35); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of time"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.3); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.3); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of the river"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.25); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.25); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of speed"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.2); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.2); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of the hare"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.15); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.15); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of quickness"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.1); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.1); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end else primaryHandItem:setName(primaryHandItem:getName() .. " of readiness"); primaryHandItem:setSwingTime(primaryHandItem:getSwingTime() - 0.5); primaryHandItem:setMinimumSwingTime(primaryHandItem:getMinimumSwingTime() - 0.5); if primaryHandItem:getSwingTime() <= 0 then primaryHandItem:setSwingTime(0.1); primaryHandItem:setMinimumSwingTime(0.1); end end elseif pModData.namedWeaponstRand[1] == 1 then -- knockback suffix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of the Mammoth"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 1.5); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.5); elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of the Titans"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.95); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.4); elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of the mountain"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.85); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.3); elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of Baal"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.75); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.2); elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of the elephant"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setAlwaysKnockdown(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.65); -- primaryHandItem:setKnockDownMod(primaryHandItem:getKnockDownMod() + 0.1); elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of the moon"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.55); elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of the whale"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.45); elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of the wave"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.35); elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " of the ocean"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.25); else primaryHandItem:setName(primaryHandItem:getName() .. " that is kind of big"); primaryHandItem:setKnockBackOnNoDeath(true); primaryHandItem:setPushBackMod(primaryHandItem:getPushBackMod() + 0.15); end else -- crit suffix if pModData.namedWeaponstRand[2] == 9 then primaryHandItem:setName(primaryHandItem:getName() .. " of murder"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 50); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 8 then primaryHandItem:setName(primaryHandItem:getName() .. " of the Ninja"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 45); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 7 then primaryHandItem:setName(primaryHandItem:getName() .. " of Brutus"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 40); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 6 then primaryHandItem:setName(primaryHandItem:getName() .. " of the politic"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 35); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 5 then primaryHandItem:setName(primaryHandItem:getName() .. " of the shadow"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 30); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 4 then primaryHandItem:setName(primaryHandItem:getName() .. " of the hawk"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 25); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 3 then primaryHandItem:setName(primaryHandItem:getName() .. " of cutting"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 20); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 2 then primaryHandItem:setName(primaryHandItem:getName() .. " of piercing"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 15); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end elseif pModData.namedWeaponstRand[2] == 1 then primaryHandItem:setName(primaryHandItem:getName() .. " that hurts"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 10); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end else primaryHandItem:setName(primaryHandItem:getName() .. " that is pointy"); primaryHandItem:setCriticalChance(primaryHandItem:getCriticalChance() + 5); if primaryHandItem:getCriticalChance() >= 100 then priimary:setCriticalChance(75); end end end player:Say("This is a " .. primaryHandItem:getName()); end endend]] Events.OnEquipprimaryHandItem.Add(beenEquipped);Events.OnZombieDead.Add(killCounter);-- Events.OnPlayerUpdate.Add(zRandTest);--Events.OnPlayerUpdate.Add(changeName);Have a good day! Link to comment Share on other sites More sharing options...
SandyBeaches Posted July 1, 2015 Share Posted July 1, 2015 (edited) Sorry for the ridiculously long post last time. I don't know how to do folds, and it is to long to edit. Could a mod remove it?Anyway, EXCITING NEWS!After much pain, learning, and digging through java and lua references, I have completely rebuilt this mod from the ground up. Unfortunately, rescuing previously buffed weapons proved too onerous for me to achieve, so sorry but your old buffs are gone.Rejoyce however! At the prospect of NEW buffs, that SURVIVE RELOADS! I still cannot work out how OnLoad works, but for now all you have to do is re-equip an item after loading, and ALL THE BUFFS COME BACK!It has truly been a learning experience for me, and I thank sticks and blind for their examples. For the sake of easy maintenance, addition and error checking, all potential buffs are now stored in a table and iterated over. Almost half the length of the file is comments, take a look! It was a lot of fun and I am pretty proud of it.Oh, by the way, for shizz and giggles try putting 10 in the add fields of all the range buffs. You can hit things further away than a pistol! DOWNLOAD: Old download had bug. Edited July 2, 2015 by SandyBeaches blindcoder 1 Link to comment Share on other sites More sharing options...
tommysticks Posted July 1, 2015 Author Share Posted July 1, 2015 Holy shit, that's awesome. Not on a comp so I can't read exactly what you've done. You can add ["quote"] and ["/quote"] without quotes to hide that. Link to comment Share on other sites More sharing options...
SandyBeaches Posted July 2, 2015 Share Posted July 2, 2015 (edited) Whoops, left one error in, I forgot to convert two values to integers when assigning them to namedWeaponstKillQuota.And another error fixed, turns out if a weapon is saved with a current durability of more than 127, there is a good chance it will be loaded with negative condition and instantly broken. Caused by condition being saved to file in a byte, nothing I can do about that.Luckily, I already had the checks needed to fix it! Tables are great. New, improved, now hopefully completely bug free version below. Remember that you must re-equip a weapon after reloading the game for the stats to be reapplied.DOWNLOAD http://www.filedropper.com/sandybeacheseditnamedweapons_2 Edited July 2, 2015 by SandyBeaches Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted July 2, 2015 Share Posted July 2, 2015 I had one of my weapons upgrade to HastySurvival Axe (no space between the prefix) and it wouldn't seem to ever get a suffix. This is with Sandy's version. Link to comment Share on other sites More sharing options...
SandyBeaches Posted July 2, 2015 Share Posted July 2, 2015 Thanks for the bug report. I see the typo and it is fixed. I have fixed a lot of bugs. Unfortunatelly, you will have to use a new weapon. Also, check your console.txt for any stack traces. I have the mod print heaps of info as it is running. Also, looks like I forgot to put prefixes and suffixes for knock back, so you may have gotten a knockback buff. If you are using the old-slightly-borked version, the weapon will be broken when you reload the game (byte flip overflow error on max condition.) New, totally fixed version below! DOWNLOAD V0.3 http://www.filedropper.com/sandybeacheseditnamedweapons_3 CHANGELOGv0.3Critical damage buffs now also increase tree/building damage.Knockback now has prefix/suffixes.Knockback now increases the number of targets hitRange now increases the number of targets hit (more than knockback)typos fixed.Deleted Herobrine Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted July 2, 2015 Share Posted July 2, 2015 When I reloaded my file after using your last version(Sandy v3) to get a prefix (Reaching) the buff is now completely inert. Only my suffix (Haste) seems to be remembered. Edit: It appears that my Reaching Buff is now set to absolute minimum value, instead of the range it used to be set to when i first unlocked the prefix. I am not sure if that's what the prefix is supposed to give now, or if it's another bug. Link to comment Share on other sites More sharing options...
fluffe9911 Posted July 2, 2015 Share Posted July 2, 2015 One thing I notice is that as soon as you get the first name the next kill you seem to immediately get the next name im using SandyBeaches one Edit happened twice so far maby im very lucky? Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted July 2, 2015 Share Posted July 2, 2015 I haven't had that happen on any of my weapons. That's a pretty strange bug. Link to comment Share on other sites More sharing options...
SandyBeaches Posted July 2, 2015 Share Posted July 2, 2015 When I reloaded my file after using your last version(Sandy v3) to get a prefix (Reaching) the buff is now completely inert. Only my suffix (Haste) seems to be remembered. Edit: It appears that my Reaching Buff is now set to absolute minimum value, instead of the range it used to be set to when i first unlocked the prefix. I am not sure if that's what the prefix is supposed to give now, or if it's another bug. Was it with a fresh weapon, or did the weapon have the prefix from the bugged version? Also, reload the game, re-equip the weapon, pause the game and alt-tab to look at the console. You will see a bunch of output like:Loading! MaxRange = 1.6Loading! SwingSpeed = 0.4Loading! ConditionMax = 30stored buff condition is 30Current Max Condition is 30Can you post that here? Thanks. One thing I notice is that as soon as you get the first name the next kill you seem to immediately get the next name im using SandyBeaches one Edit happened twice so far maby im very lucky?This is actually how it currently works if you are using a low durability item. The distance between 0, buff1 and buff2 are directly determined by the items chance to lose durability and max durability, and is determined the first time you equip an item. If you want to see how many kills you need, that too is listed on the console. Just equip the weapon, pause, alt tab and it should say something like This is for a spoon Kills = 0Kills to Stage 1 = 2Kills to Stage 2 = 3Baseball bats take 16 kills to get the prefix (I think) and sledgehammers take much longer. Link to comment Share on other sites More sharing options...
tommysticks Posted July 3, 2015 Author Share Posted July 3, 2015 Correction, not "quote" and "/quote," but "spoiler" and "/spoiler" in brackets [ ] Link to comment Share on other sites More sharing options...
LeetgamerBoi Posted July 3, 2015 Share Posted July 3, 2015 i had this glitch where it kept adding names"Axe of cotton of cotton of evil of...ect."Any cause for this? Link to comment Share on other sites More sharing options...
DarkSlayerEX Posted July 3, 2015 Share Posted July 3, 2015 Edit: Apparently EDITING my post, sometimes means POST NEW entry... dumb thing... Content one comment below. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now