cone broken for NPCs?

Discussion in 'General Modification' started by dulcaoin, Mar 31, 2005.

Remove all ads!
  1. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    Here is my still buggy cone of cold spell.
    I say buggy because I don't know how to compare the obj in the for loop to the spell.caster to exclude the caster from damage. Right now the caster is getting hit as well.

    I also can't figure out why my level 1 sorcerer using a cone of cold wand(lvl 5?) is getting caster level = 9??

    I also modified the print commands so they will print to a file, that way you can see what is going on. This should be replaced in the final version with standard print, so we aren't doing file i/o each time a spell is cast. I really think having a record of what is going on will help debug though.

    The text files will be created in your game's modules\ToEE folder.

    Let me know if you have any luck.

    It may also be helpfully to use cPickle to see what some of these things are.

    -Firestrand
     

    Attached Files:

  2. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0

    why can't you just compare obj to spell.caster, as I suggested to Liv?

    (for example:
    if not (obj == spell.caster):
    inside your for loop)

    BTW, THANK YOU for the file i/o stuff. Never occured to me to look it up and output to a file; I'd rather we figured out how to make print actually output to the console. Sometimes you get stuck on the dumbest thing... This is great, as we may never have to figure that problem out.
     
  3. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Firestrand -

    I know how to fix both problems...

    1) Wands and potions are buggy unless crafted by a caster in game. When a wand or potion is crafted then the spell level is set to the caster level that creates the item.

    When you use an item that was not crafted it doesn't work too well. That is just a fact of life. It can be fixed but takes a lot of work as each spell needs modification. The reason it is 9 is it is adding the character level of your PC to the spell level in the Protos file that is assigned to the item.

    2) excluding the caster will be very easy.


    I will take a look at it tonight and see if I can't get it working. Once I get it working I will post the finished working spell.

    Thanks!!!

    - Livonya
     
  4. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    When I tried that originally it didn't work.
    Instead I have converted the tuple returned by game.obj_list_cone() to a list, and simply removed the caster from the list before iterating through it.

    Oh, what is the angle of the cone supposed to be? I thought it was 60 degrees? That is what I set the code to, so if it needs to be less or more just modify the angles. I know the game particle effect is less than 60.

    Still need to get the caster's level calculated correctly.
    Still need to check if NPCs face the target before OnSpellEffect() is called. I think they do, but I am not in a position to verify. If they don't I would sort the target list by distance, and then have the caster face the furthest target.

    -Firestrand
     

    Attached Files:

    Last edited: Apr 1, 2005
  5. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Firestrand -

    I looked at the code. It is sound and makes perfect sense. I think it will work properly. I will test it tonight.

    You don't need to set the spell caster level.

    The spell caster level will be set automatic as long as the spell is NOT cast from a wand or potion that was NOT crafted.

    The only time the caster level is not automatic and correct is when the spell is cast from a wand or potion that was NOT crafted.

    NPCs have the same problem. When an NPC uses a wand/potion and sometimes innate spells the caster level is 0.

    The only reason you are having problems with the caster level is because you are casting from a wand that you most likely created via the console. I assume your level one Wizard did not craft this wand, thus you made it via the console.

    Potions/wands that you find in game don't really work properly because they were never crafted and don't have a spell level set.

    For example:

    If you CRAFT a potion of Bull's Strength the potion duration will be the SAME no matter who drinks the potion... the duration is set by the caster.

    If you FIND a potion of Bull's Strength the potion duration will be DIFFERENT depending on who drinks the potion... the duration is set by the drinker's level + the level listed in the protos.tab file.

    A lot of trial and error taught me this strange fact of TOEE mechanics.

    - Livonya
     
  6. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Yeah?

    I would think that this would work:

    Code:
    	range = 25 + 5 * int(spell.caster_level/2)
    
    	for obj in game.obj_list_cone( spell.caster, OLC_CRITTERS, range, -30, 60 )
    		if not (obj == spell.caster):
    			if obj.reflex_save_and_damage( spell.caster, spell.dc, D20_Save_Reduction_Half, D20STD_F_NONE, dam, D20DT_COLD, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, spell.id ) > 0:
    				# saving throw successful
    				obj.float_mesfile_line( 'mes\\spell.mes', 30001 )
    			else:
    				# saving throw unsuccessful
    				obj.float_mesfile_line( 'mes\\spell.mes', 30002 )
    
    
     
  7. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Works!!

    Firestrand -

    It worked perfectly.

    I added your script into my Petrifying Breath spell and now the cone is perfect.

    My Gorgon now works perfect.

    I will now fix the other spells that my NPCs use so those work as well.

    Thanks for the help.

    - Livonya
     
  8. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    *cough*

    Feeling a little like chopper liver over here ;-)

    -- d
     
  9. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    dulcaion:

    Don't be silly, your help is very appreciated.

    -Firestrand
     
  10. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Firestrand -

    Actually, it is a little strange.

    Creatures right next to the monster don't always get hit.

    The cone looks to be extremely narrow at the beginning.

    The farther away the targets are the better chance they have of being hit, but the closer they are the less chance they have of being hit.

    - Livonya
     
  11. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Also, where is the file going that I can read? I can't find it.

    D -

    Sorry, didn't mean to exclude your help!

    - Livonya
     
  12. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Never mind my last post...

    The problem is with something I am doing and not with your script...

    - Livonya
     
  13. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    This is what was causing my problem...

    Originally I used this:

    obj.partsys_id = game.particles( 'sp-Hold Monster', obj )

    However with your new script routine this line would break the script.

    I switched to this:

    game.particles( 'sp-Hold Monster', obj )

    and now it works awesome!

    - Livonya
     
  14. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    a) I'm being facetious, so don't read any anger into my joking about.

    b) Liv, you and I are starting to have a tradition of me presenting something for testing, you doubting it'll work, me insisting it should (while crossing my fingers), and then oftentimes, with tweaking, it works close to how I thought, but we both end up learning more details about it with some work. Fun AND educational! :) You were breaking with tradition is all (see note one, I'm lol while I write all this)

    -- d
     
  15. Firestrand

    Firestrand Member

    Joined:
    Mar 11, 2004
    Messages:
    79
    Likes Received:
    0
    Liv--

    Did you find where the file is being written??

    I am curious if it writes to the same place as my system.

    -Firestarnd
     
Our Host!