Jump to content

Recommended Posts

Hey, i'm back again...

I'm now creating another mod, this time an OP weapons pack (already out on steam but adding MUCH more) and i want one of my weapons to deal more damage to shadow mobs, like terror-beak and all that... 

Quote

local function onattack(inst, attacker, target)
    inst.components.weapon.attackwear = target ~= nil and target:IsValid() 
        and (target:HasTag("shadow") or target:HasTag("shadowminion") or target:HasTag("shadowchesspiece") or target:HasTag("stalker") or target:HasTag("stalkerminion")) 
        and inst.components.weapon:SetDamage(1000000) 
        or 1
end

 this is honestly what I've tried, in hopes that it would one shot them rather than deal the 1 damage i set originally.

uh, if anyone knows if there's an easier way or if i'm so close, it'd be great if you could help again!

(and if i have more questions that I cannot find answers for, ill be back)

EDIT: Also have another problem of custom items wont show their inventory image when used as crafting material

Edited by PixaL SKulLKid

hm i don't understand the " and inst.components.weapon:SetDamage(1000000) "

why dont you use an easier to read if clause? if the setDamage return nil or false the second part will always take place

 

 inst.components.weapon.attackwear = 1
if  target ~= nil and target:IsValid() and (target:HasTag("shadow") or target:HasTag("shadowminion") or target:HasTag("shadowchesspiece") or target:HasTag("stalker") or target:HasTag("stalkerminion")) then
 inst.components.weapon:SetDamage(1000000) 
end

okay while writing this i wonder why you assign a value to " inst.components.weapon.attackwear"?

Quote

EDIT: Also have another problem of custom items wont show their inventory image when used as crafting material

U need to add inventory image path to your AddRecipe Ingredient
 

AddRecipe("myitem", 
    {Ingredient("custom_ingredient", 1, "images/inventoryimages/custom_ingredient.xml", "custom_ingredien.tex")}, RECIPETABS.WAR, TECH.ANCIENT_FOUR, nil, nil, nil, nil, nil, "images/inventoryimages/myitem.xml", "myitem.tex")

Of course "custom_ingredient" is ur custom item name.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...