Limiting Potions to User Only

Discussion in 'General Modification' started by Rudy, Mar 19, 2015.

Remove all ads!
  1. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I'm trying to come up with an elegant way to limit the effects of a potion to the one using it. Characters should not be able to use a cure light wounds potion on another character. I know that one could create separate versions of the spell; one for the potion, one for scrolls/wands/casting, and then alter the Range in the spell definition. This would involve a lot of extra spells, though, with a shrinking number of slots.

    Is there a command, accessible within the code of a spell effect, that would allow you to access the source of the spell? For example, within the code for Protection From Fire, could I test to see if the spell originated from item 8020? Further, is there a method to access the character using the item? Longshot, I know, but I figured worth asking.
     
  2. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    I can't find anything about "feeding" other people potions in the D&D 3.5 rules. But in ToEE the ability to feed someone else a potion, especially during combat, is so engrained in players' minds that I think taking it away would cause frustrating confusion at best to most players.

    But if you wanted to, I think you have to edit this file:

    /Temple/data/rules/spells/702 Potion of Haste.txt

    Remove the line highlighted below:

    Code:
    Casting Time: 1 action
    Range: Touch
    Saving Throw: Fortitude
    Spell Resistance: Yes
    Projectile: No
    flags_Target: Range
    inc_flags_Target: Self
    [I][COLOR="Magenta"]inc_flags_Target: Other[/COLOR][/I]
    exc_flags_Target: Dead
    exc_flags_Target: Non-critter
    exc_flags_Target: Hostile
    mode_Target: Single
    min_Target: 1
    max_Target: 0
    radius_Target: 0
    Although looking at the code, it looks like you could add more than 1 target, which would make multiple dosage potions possible, and kind of fun. :coffee: :drunk: :coffee: :coffee: :coffee: :drunk: :drunk: :coffee: :drunk:
     
  3. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Oh, thanks, but I do know of that solution; that's what I referred to when I talked about altering the Range in the spell definition. The problem with that method is that you would need two different spells definitions for every spell; one for the potion (excluding others), and one for other castings (including others).

    You definitely, absolutely, cannot feed other characters potions under 3.5 rules, but you may be right about taking it away resulting in bad feelings. Regardless, there doesn't seem to be a way to do it without creating a separate spell for each potion, which I'm not about to do, so it's a moot point.

    Thanks for taking the time to look into it.
     
  4. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    In many of the cases, there's already a separate spell file for the potion version of the spell, as in Haste above. All the protections, hiding, sneaking, heroism, haste, elarge person, and some other have separate files too. So you'd have to make new ones for the cures and the ability buffing spells, and a few others.
     
  5. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    True; it's not so much about the work, as it is about the fact that there are only like 30 viable spell slots remaining, as there is a hardcoded limit on spell ids. That comes down to just over 20 once I add in the needed spells for the resist/protection from elements spells I created. If I wanted to have a scroll for those too, I'd need a separate spell for that, then we're down to about 10. So, even if there was enough left for me to do the cure spells, too, it would use up all, or very close to all, of the possible spell slots, leaving no room for other people to make cool new spells. Clearly not worth it, I think.
     
  6. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    No way that I know of, because of brewed potions mainly - they take on the same properties as the brewer.
    Otherwise you could have used spell.caster_class, which is 0xBAAD F00D for potions (I shit you not! someone was bored at the office apparently...).

    Although I guess you could add it as a partial solution - IF the spell.caster_class is 0xBAAD FOOD (=3,131,961,357 in unsigned representation, or -1163005939 in signed int) then set the target to spell.caster (.obj I think).

    Edit: Actually, I may be able to jury rig something a bit more robust, using the game.global_vars trick and some DLL hacking. Although TBH these kind of fixes are better left to actually changing the code via TemplePlus.
     
    Last edited: Mar 19, 2015
  7. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    @Sitra: Can we replace all the functions that access the spell array with C code?
     
  8. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Yes, already started doing so in fact ;)

    Though I think the ultimate solution is to directly access the global action sequence / D20 action, where it should say the action type is D20A_USE_POTION or something like that. This way you can differentiate between normal spell casting and using potions (even brewed ones).

    BTW, don't mind my messing with DLL hacks, it's just... old habits :p
     
  9. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    That is hilarious =D.

    Seems like this is definitely something left to TemplePlus, etc, as you say.
     
Our Host!