Scripting item effects

Discussion in 'General Modification' started by Agetian, Aug 3, 2005.

Remove all ads!
  1. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    I wanted to point out a pretty cool way of scripting item effects. I have so far been able to find a way to script a way to add/remove effects when the item is put into inventory/removed from it and when the item is worn/not worn.

    For example, we want to make a longsword that gives the wielder +10 STR (of course, only when the item is in the inventory). For example, we can make a file called py00800longsword_str.py with the following data:

    Code:
    def san_wield_on( attachee, triggerer ):
    	triggerer.stat_base_set(stat_strength, triggerer.stat_level_get(stat_strength) + 10)
    	return RUN_DEFAULT
    
    def san_wield_off( attachee, triggerer ):
    	triggerer.stat_base_set(stat_strength, triggerer.stat_level_get(stat_strength) - 10)
    	return RUN_DEFAULT
    
    Then, assign script #800 to the longsword's san_wield_on and san_wield_off standard actions (using ToEEWB or ProtoEd). Enjoy!

    Also, there are similar standard actions san_insert_item and san_remove_item that apply when the item is put into inventory/removed from it. Another standard action that may be worth examining is san_hit.

    P.S. Of course, I know that there's a property in protos.tab that can be assigned to add +10 STR, and it'll actually act better since it won't affect the base strength, but I wanted to tell you about the scripting way of doing things... who knows, maybe something cool can be scripted this way?...

    - Agetian
     
    Last edited: Aug 3, 2005
  2. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,009
    Likes Received:
    255
    That's pretty cool Agetian, I have a question for you.

    I want to make Hemlock useful, so I was thinking make it a usable item that you can put on a weapon (destoyed after use) to give it 1 use of the dagger of venom ability, but I have no idea how to script it.

    Either that or when I get Verbobonc going again have an assassin's guild with a poison maker who can take the hemlock and give poison - for a price (but I think I can do that one myself).
     
  3. Agetian

    Agetian Attorney General Administrator

    Joined:
    Aug 14, 2004
    Messages:
    2,526
    Likes Received:
    0
    Hmm... can't think of how to do that at a first glance, Allyx, sorry. It'll probably take me some time to figure it out. I wish I had time to help you out with that... sorry!

    - Agetian
     
  4. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,746
    Likes Received:
    375
    The san_use_item bit is how I got the animations on the ioun stones.

    Allyx: interesting idea. If I think of something I will tell you.
     
Our Host!