Welcome to the Builder Academy

Question Creating spell that gives a Skin/Transform to player - Like Demon Skin Glitch

More
08 Jun 2025 19:28 #10753 by wlessard1
So I setup the applies for the Demon Skin. It is working fine except for one thing.

When I do a apply_hit or apply_move and try and put MORE than 100 as the modifier, it ends up giving me a negative number to the Maxhits/Maxmoves.

  case SPELL_DEMON_SKIN:
    af[0].location = APPLY_AC;
    af[0].duration = 1 + (GET_LEVEL(ch) / 2);
    af[0].modifier = -50;
    SET_BIT_AR(af[0].bitvector, AFF_DEMON);

    af[1].location = APPLY_HITROLL;
    af[1].duration = 1 + (GET_LEVEL(ch) / 2);
    af[1].modifier = (GET_LEVEL(ch))/4;
    SET_BIT_AR(af[1].bitvector, AFF_DEMON);

    af[2].location = APPLY_DAMROLL;
    af[2].duration = 1 + (GET_LEVEL(ch) / 2);
    af[2].modifier = (GET_LEVEL(ch))/4;
    SET_BIT_AR(af[2].bitvector, AFF_DEMON);

    af[3].location = APPLY_HIT;
    af[3].duration = (GET_LEVEL(ch) / 2);
    af[3].modifier = 200;
    SET_BIT_AR(af[3].bitvector, AFF_DEMON);

    af[4].location = APPLY_MOVE;
    af[4].duration = 1 + (GET_LEVEL(ch) / 2);
    af[4].modifier = 200;
    SET_BIT_AR(af[4].bitvector, AFF_DEMON);

    to_vict = "You skin becomes leathery.";
    break;

Results -- If I see the modifier to 100, it works fine but anything over that produces a negative to maxmove and hits, probably maxmana as well.

Affected by: DEMON
SPL: ( 29hr) Demon Skin            -56 to MAXMOVE, sets DEMON,
SPL: ( 28hr) Demon Skin            -56 to MAXHIT, sets DEMON,
SPL: ( 29hr) Demon Skin            +13 to DAMROLL, sets DEMON,
SPL: ( 29hr) Demon Skin            +13 to HITROLL, sets DEMON,
SPL: ( 29hr) Demon Skin            -50 to ARMOR, sets DEMON,


I would like to be able to run the modifier up a bit higher as I want to add some other spells that do things like this.

Bramage
Thanks for any help.

Please Log in or Create an account to join the conversation.

More
09 Jun 2025 04:17 - 09 Jun 2025 04:18 #10754 by Salty
Stock TBAmud has the following in structs.h
Code:
/** An affect structure. */ struct affected_type {   sh_int spell; /**< The spell that caused this */   sh_int duration; /**< For how long its effects will last      */   sbyte modifier;  /**< Added/subtracted to/from apropriate ability     */   byte location;   /**< Tells which ability to change(APPLY_XXX). */   int bitvector[AF_ARRAY_MAX]; /**< Tells which bits to set (AFF_XXX). */   struct affected_type *next; /**< The next affect in the list of affects. */ };

sbyte is defined in structs.h as:
Code:
typedef signed char sbyte;          /**< 1 byte; vals = -127 to 127 */

If you want larger values for affect.modifier[] you will need to change it to something like sh_int or ubyte.

I'n my game I went with sh_int:
Code:
/** An affect structure. */ struct affected_type {   sh_int spell;                /**< The spell that caused this */   sh_int duration;             /**< For how long its effects will last      */   sh_int modifier;             /**< Added/subtracted to/from apropriate ability     */   byte location;               /**< Tells which ability to change(APPLY_XXX). */   int bitvector[AF_ARRAY_MAX]; /**< Tells which bits to set (AFF_XXX). */   struct affected_type *next; /**< The next affect in the list of affects. */ };

You could use ubyte or sh_int, whichever suits your fancy.  They are defined as:
Code:
typedef unsigned char ubyte;        /**< 1 byte; vals = 0 to 255 */ typedef signed short int sh_int;    /**< 2 bytes; vals = -32,768 to 32,767 */


Hope this helps
Last edit: 09 Jun 2025 04:18 by Salty.

Please Log in or Create an account to join the conversation.

Time to create page: 0.356 seconds