Rudy's Item Mod

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

Remove all ads!
  1. Shiningted

    Shiningted I want my goat back Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,654
    Likes Received:
    352
    Found 'em! they weren't on my laptop, they were cunningly hidden here in the forum (hide in plain sight, as it were). Check this thread: the files are at pg 2, post 34 or so, with some more stuff about the particles effects in post 36, and if you read Gaear's post at 44 you'll find mention of a bug which is the reason we don't use Electric Jolt (I threw them all in KotB, noticed that bug much later, and Sitra finally traced it to Electric Jolt, for memory).

    EDIT: Just reading the rest of that thread, and someone came along and got the various Vigor spells working, but not at those spell numbers - maybe you'd like to look at that Rudy?
     
  2. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I'll check it out tonight; thanks!
     
  3. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    marc1967 caught a CTD bug; I failed to write the spellname correctly for the CL 9 version of Potion of Protection from Cold and Potion of Protection from Sonic. The CL 5 versions work fine.

    Attached is the protos.tab file with that fixed. It will be fixed in the next release as well, obviously.

    Thanks, marc.
     

    Attached Files:

  4. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Based on my own experiences, and what Ted wrote here and DS seemed to confirm indirectly in the last 2 posts of that thread page, SpellList.mes seems to have no purpose. I think you can save time by not putting updates into that file unless you really think you need to.
     
  5. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Okay! Finished the 9 page documentation (google docs) of this thing. That was a pain, but I think worth it.

    Note that some of the items on it are for the next version of the mod, because I'm editing the document as I go. The version history section will tell you what has been added for 0.7 so far.

    I also have a TO DO section, where I keep track of all the suggestions and check list items that I haven't gotten to yet (e.g. vampirepuppy's custom graphics, or sitra achara's suggested method to enable overriding protection from elements spells with new ones).

    https://docs.google.com/document/d/1fDgustFBAC4dqd7C3bVa3mtRM2vk2_hSzA-10sEiAUU/edit?usp=sharing
     
  6. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Doc looks great! Really. I nominate you to be "Keeper of the Scrolls" with all changes forwarded to you. :yes:

    I noticed you wanted a Helm of Read Magic to identify all potions and scrolls in the inventory. I've already done that a few weeks ago with the help of a dll hack by Sitra discussed here. Basically, the hack allows you to call npc.item_worn_at() to check what each item is in the 24 inventory slots (numbered 100-123), where previously it only checked the slots where the items were actually "worn" (0-23).

    I made a small function call get_inv() that returns a list of all inventory in the pc's possession.

    The changes were pretty small:

    1) In the proto for Helm of Reading Magic, change the spell to 'Helm of Reading Magic (INTERNAL) domain_special 1'.

    2) Create the spell 'Helm of Reading Magic (INTERNAL)'. I used 744.

    3) In the spell, add this code.

    Code:
    for p in game.party:
    	inventory = get_inv (p, 0)
    	for i in inventory:
    		if i.type in [obj_t_food, obj_t_scroll]:
    			i.item_flag_set(OIF_IDENTIFIED)
    
    Related topic:

    The spell I am using is now actually named 'Magic Item Personal (INTERNAL)'. I use a new method to conserve the precious spell slots in many cases.

    After some things you guys taught me yesterday, I experimented and confirmed that you can go up to 15 on the spell level when naming a spell in a proto. So I'm trying a new trick where if the spell you are using doesn't care about the spell's level, you can use that 'spell.caster_level' as an argument to switch between 16 different items within the spell's code.

    So for example, you run 'Helm of Reading Magic' and 'Boots of Speed' (and eventully 14 other items) off the same spell, with the Helm using 1 (spell.caster_level ==1), and the Boots using 2 (spell.caster_level ==3).
     
  7. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I definitely don't mind being assigned to compile all fixes into this mod, though I won't necessarily want to add everything that is a matter of personal taste, if that makes sense? Like your Mirror Image potion, for example.

    Nice code for the helm! Where do you put the get_inv() function?

    As far as your last idea, it is a very clever hack. Personally, though, I'm going to wait and see if Sitra's plan to expand spell slots works. If we can get up to even 2000 spell slots, there will be no need to "double up", as it were, and it will be cleaner that way.
     
  8. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Though, if Sitra's fix proves not to work, the very first thing I'll do is try your idea to run all 15 instances of Resist energy potions I created off of one internal spell.
     
  9. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    578
    Likes Received:
    60
    Oh no, I'm not gonna push stuff on you. This would be simple stuff that (I think) everyone would agree on. At this point you've made so many changes that I think it would be simpler to pass them along to you instead of submitting my own mod.

    For example, the 5 wands of magic missile are called:

    Wand Of Magic Missiles, 1st
    Wand Of Magic Missiles, 2nd
    Wand Of Magic Missiles, 3rd
    Wand Of Magic Missiles, 4th
    Wand Of Magic Missiles, 5th

    I think those should instead read:
    1st, 3rd, 5th, 7th, 9th,
    or... CL1, CL3, CL5, CL7, CL9
    or... '1 missile'. '2 missiles', '3 missiles', '4 missiles', '5 missiles'

    There's a similar situation with Wand of Scorching Ray.

    I put it into marc.py ;) But for the main build I don't know, maybe scripts.py or utilities.py?

    Don't forget you'd need the DLL hack from the link above too, which is short enough, but still a task to put in.


    I was thinking that definitely, but even then I like the idea of having all magic item spells that are of a similar family put into one file for ease of use and reference. But remembering the right spell level code makes it harder to use maybe. Personal taste.
     
  10. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Okay, I'll make the change for scorching ray/magic missile. If you have anything similar, feel free to pass it on.

    As far as the dll hack, hmm... I definitely want to do it for my own use. It would make the mod file size just to include the modified temple.dll, but I guess that's a minor consideration, as it would still be only like 5 megs.

    I suppose what I will do is document temple.dll hacks in its own subsection, and then make careful note of which new additions (e.g. the helm of read magic mod) make use of those hacks.
     
  11. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    FYI I've implemented a proper python function in TemplePlus - obj.inventory_item(n). No need to dick around with item_worn_at :)
     
  12. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    I guess this will give me good motivation to figure out how exactly TemplePlus works, and possible even work up to contribute.
     
  13. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
    Great to hear!

    I'd recommend poking around in python.cpp, temple_functions.cpp / .h, and ui_item_creation.cpp (you might something interesting there in particular ;)). Lots of examples to learn from there.
     
  14. Rudy

    Rudy Established Member

    Joined:
    Jan 30, 2005
    Messages:
    345
    Likes Received:
    2
    Okay, this is probably a really really dumb question, but how do I actually go about using TemplePlus. I do understand a lot of the functions in the files you mention, but I don't understand what steps are involved in actually making use of those functions. i.e., what I need to do before I can access those functions in .py files, for example.
     
  15. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,613
    Likes Received:
    537
Our Host!