Permanent effects

  • h3dg3hug
  • h3dg3hug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 weeks 1 day ago #9896 by h3dg3hug
Permanent effects was created by h3dg3hug
I am trying to add a permanent effect to one of my races. The race is wyrm (like a Chinese "wingless dragon") and I want it to be permanently affected by FLYING. I've been trying all day to figure out how to flip the bit for it in the do_start() method inside class.c, but I keep coming up empty. Any clues? Am I even on the right track?

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

More
3 weeks 1 day ago #9897 by thomas
Replied by thomas on topic Permanent effects
What you're after is affect_to_char(). Something like this untested code:
struct affected_type af;

    new_affect(&af);
    af.spell = SPELL_FLY;
    af.duration = -1;
    SET_BIT_AR(af.bitvector, AFF_FLY);
    affect_to_char(char, &af);

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

More
3 weeks 1 day ago #9898 by thomas
Replied by thomas on topic Permanent effects
Also, you'll want this to be added when the player enters the game, so in enter_player_game() in interpreter.c.
I'd suggest an extra touch: add a AFF_INNATE to the bitvector, and check for this whenever you try to remove affects. This will then prevent a char from losing innate spell effects to dispel magic or scripts.

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

  • h3dg3hug
  • h3dg3hug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 weeks 6 hours ago #9899 by h3dg3hug
Replied by h3dg3hug on topic Permanent effects
Thanks you for the hints! I've got it to compile OK by putting (a lightly modified version of) your code block at the end of enter_player_game(). What a good thing to know about! I was totally barking up the wrong tree trying to smash it in in class.c...
I also like the idea to add AFF_INNATE so dispels won't remove it, but bitvectors are still a little foreign to me so I'm not sure how to assign AFF_FLY and AFF_INNATE at the same time. Maybe I should just define a new one like INNATEFLY?
In the end, it still is not applying the affect how it should, but I feel it's close. I settled for just giving them the fly spell at 100% on lvl 1, because I was tired and that was the easy way out. It's a duct tape + popsicle sticks job, but I feel I can eventually probably figure out how to make it do what I actually want...

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

More
3 weeks 5 hours ago #9900 by thomas
Replied by thomas on topic Permanent effects
It' really simple to add two bitvectors: AFF_FLY | AFF_INNATE.

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

  • h3dg3hug
  • h3dg3hug's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 weeks 2 days ago #9902 by h3dg3hug
Replied by h3dg3hug on topic Permanent effects
Thank you for your help, I got this to work finally. It kept saying "standing" in all the cases where position is checked, which made me think the affect wasn't being applied. It took me an embarassingly long time to figure out I could use my Imm to do_stat and check for the bit.
Turns out there was no definition for POS_FLYING so I made one, to show in the room and in the score command. Now all's well =)
The following user(s) said Thank You: thomas

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

Time to create page: 0.097 seconds