1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Modding in WeiDU

Discussion in 'Icewind Dale 2' started by lendial, Aug 18, 2011.

  1. lendial Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Aug 4, 2010
    Messages:
    80
    Likes Received:
    1
    Gender:
    Male
    Im currently trying to modify an exist mod (g3 tweaks) which sets monster hp to their maximum allowable value based on class levels.

    im trying to scale it based on monster level (high level monster get 30% hp boost on top of max etc etc).

    my problem is that i cant convert a decimal value - say 90*1.15 into an integer value which is required to write in the required field. as far as i know there isnt any built in rounding or floor function and i am at a loss as how to do it. does anyone have expertise with this?

    the code is as follows


    BEGIN @5300
    DESIGNATED 1300

    COPY_EXISTING_REGEXP ~^.*\.cre$~ ~override~
    SET "maxhp" = 0
    READ_SHORT 0x24 "curhp"
    READ_SHORT 0x26 "maxhp"
    READ_BYTE 0x8b "barbarian"
    READ_BYTE 0x8c "bard"
    READ_BYTE 0x8d "cleric"
    READ_BYTE 0x8e "druid"
    READ_BYTE 0x8f "fighter"
    READ_BYTE 0x90 "monk"
    READ_BYTE 0x91 "paladin"
    READ_BYTE 0x92 "ranger"
    READ_BYTE 0x93 "rogue"
    READ_BYTE 0x94 "sorceror"
    READ_BYTE 0x95 "wizard"
    SET "maxed_hp" = 12 * "%barbarian%" + 10 * ("%fighter%" + "%paladin%" + "%ranger%")
    + 8 * ("%cleric%" + "%druid%" + "%monk%") + 6 * ("%bard%" + "%rogue%")
    + 4 * ("%wizard%" + "%sorceror%")
    PATCH_IF ("%curhp%" < "%maxed_hp%") BEGIN
    WRITE_SHORT 0x24 "%maxed_hp%" * "%curhp%" / "%maxhp%"
    WRITE_SHORT 0x26 "%maxed_hp%"
    END
     
  2. Blackthorne TA

    Blackthorne TA Master in his Own Mind Staff Member ★ SPS Account Holder Adored Veteran Pillars of Eternity SP Immortalizer (for helping immortalize Sorcerer's Place in the game!) New Server Contributor [2012] (for helping Sorcerer's Place lease a new, more powerful server!) Torment: Tides of Numenera SP Immortalizer (for helping immortalize Sorcerer's Place in the game!)

    Joined:
    Oct 19, 2000
    Messages:
    10,416
    Media:
    40
    Likes Received:
    232
    Gender:
    Male
    I don't have any experience with WeiDU, but normally in computers if you are doing integer arithmetic (i.e. arithmetic with integer types), the result will be an integer (i.e. the truncation/rounding will happen automatically).
     
  3. lendial Gems: 4/31
    Latest gem: Sunstone


    Joined:
    Aug 4, 2010
    Messages:
    80
    Likes Received:
    1
    Gender:
    Male
    success! i think i had some sort of syntatical error before because from the original code clearly there is some decimal truncation going on.

    thank you.
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.