Jump to content
Sign in to follow this  
Jones

[Question] Item's Stat Bonus (eg. Mammoth, Colossus)

Recommended Posts

Does anyone know how & where it's coded? 

Any information is good. Thanks for the help in advance. :)

Edited by Jones

Share this post


Link to post
Share on other sites

In ItemPre.bin each line corresponds to the prefix (text only, not colour). 

Then you put it on an item with attr 53/56 iirc.

First digit is colour, next two digits are the id from itempre, last digit does nothing (AFAIK)

(cant remember all colours off the top of my head)

 

This doesnt actually add the stats though.

 

To edit the stats of an item you need to edit Creat_Item_Tattr in attrcalculate.lua, but bear in mind you can only have 5 editable attributes per item (not counting energy/forge/durability/level etc)

Share this post


Link to post
Share on other sites
31 minutes ago, 7n6 said:

In ItemPre.bin each line corresponds to the prefix (text only, not colour). 

Then you put it on an item with attr 53/56 iirc.

First digit is colour, next two digits are the id from itempre, last digit does nothing (AFAIK)

(cant remember all colours off the top of my head)

 

This doesnt actually add the stats though.

 

To edit the stats of an item you need to edit Creat_Item_Tattr in attrcalculate.lua, but bear in mind you can only have 5 editable attributes per item (not counting energy/forge/durability/level etc)

thanks, ill look at that some time.

 

i wanna know, is it possible to create items such as "cardic" "silver dragon" etc on demand?

and the text that describes it, is it located in the .exes itself?

 

@7n6

Share this post


Link to post
Share on other sites
4 minutes ago, 7n6 said:

What do you mean by "the text that describes it"?

 

And yes it is possible to make cardic etc items on demand

can you tell me how?

 

and the text that describes it is for example, if it's strength attribute added on the normal item, it's called "Mammoth" etc.

 

@7n6

Edited by Jones

Share this post


Link to post
Share on other sites

You can use 

 to generate items with cardic etc, growth/max growth is the prefix for items.

Edited by 7n6
  • Like 1

Share this post


Link to post
Share on other sites

functions.lua:

function SetItemPrefix(item, pre)
    -- @revised by [email protected] (fixed algorithm and shifting)
    local baoshilv = GetItemAttr(item, 53)
    local oldpre = GetItemPrefix(item)
    if oldpre == pre then return end
    SetItemAttr(item, 53, ((math.floor(baoshilv/1000)*1000)+(pre*10)+(math.mod(math.abs(baoshilv),10))))
end

function GetItemPrefix(item) -- Gets the items prefix
    local prefix = math.floor(math.mod(GetItemAttr(item,53),1000)/10)
    return prefix
end

function GetItemColour(item)
    local baoshilv = GetItemAttr(item, 53)
    local colourid = math.floor(baoshilv/1000)
    if     colourid >= 00 and colourid < 01 then return 'gray'
    elseif colourid >= 01 and colourid < 03 then return 'white'
    elseif colourid >= 03 and colourid < 05 then return 'green'
    elseif colourid >= 05 and colourid < 07 then return 'purple'
    elseif colourid >= 07 and colourid < 09 then return 'red'
    elseif colourid >= 09 and colourid < 11 then return 'gold'
    else                                          return nil
    end
end

function SetItemColour(item, colour)
    if colour == GetItemColour(item) then return end
    local colourid
    if colour == 'gray'     then colourid = 00 end
    if colour == 'white'     then colourid = 01 end
    if colour == 'green'     then colourid = 03 end
    if colour == 'purple'     then colourid = 05 end
    if colour == 'red'         then colourid = 07 end
    if colour == 'gold'        then colourid = 09 end
    if colour ~= nil then
        SetItemAttr(item, 53, ((colour*1000)+(pre*10)+(math.mod(math.abs(baoshilv),10))))
    end
end

function SetBaoshiLv(item, colour, prefix)
    SetItemColour(item, colour)
    SetItemPrefix(item, prefix)
end

function CalculateBaoshiLv(base, pre)
    return math.floor(base/1000)*1000+pre*10+math.mod(math.abs(base),10)
end

 

usage: 
local item = GetChaItem(role, 2, ...)
SetBaoshiLv(item, 'red', 42) -- where 'item' is the item userdata, 'red' is the colour, 42 is the prefix.
 

Note: there are buggy ones release long ago (all public ones are buggy). do not use it

  • Like 2

kong.png

a2.png

Share this post


Link to post
Share on other sites

I find the error it was about the spacing instead of using spaces I just use TAB spacing it work fine but it doesn't make the color change.

Share this post


Link to post
Share on other sites

I guess this script is for random item that has name mammoth - colossus to make it colored. Is there any way like the certain item would color change not random name but same name

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...