Scripting Challenge

Discussion in 'General Modification' started by Livonya, Apr 1, 2005.

Remove all ads!
  1. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Hay, I have a scripting challenge/hurdle that I have not been able to master.

    I have been trying to put spell like effects in the Heartbeat rather than in the spell.py

    For example the Vrock should get a free Vrock Spore cloud every 3 rounds (this should be a free action). Currently he fires this as a spell every round and doesn't get any other actions... sort of silly when he gets so many attacks to be wasting his time with the spore cloud instead...

    I easily wrote code to make the Vrock fire the Vrock Spore Cloud every 3 rounds as a fee action. That I did. It works, allows him to do other actions, and does poison damage to those around him.

    What I can NOT do is to get the spell condition Vrock Spore Cloud to apply to the hit targets.

    The condition lasts for 10 rounds and does 1d2 damage each round.

    I just can't get that to stick.

    I will post the code I am having trouble with later tonight... so you can see exactly what I am talking about...

    Maybe somone will be able to help...

    Anyway, this thread is sort of a waste of time until I post the data, but I wanted to write this intro part while I had time...

    - Livonya
     
  2. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    this is the original script from the Vrock Spore spell py

    remove_list = []

    spell.duration = 10
    damage_dice = dice_new( '1d8' )
    game.particles( 'Mon-Vrock-Spores', spell.caster )

    for target_item in spell.target_list:
    # damage 1-8 (no save)
    target_item.obj.spell_damage( spell.caster, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, spell.id )

    # add SPORE condition
    target_item.obj.condition_add_with_args( 'sp-Vrock Spores', spell.id, spell.duration, 0 )
    target_item.partsys_id = game.particles( 'Mon-Vrock-Spores-Hit', target_item.obj )

    spell.target_list.remove_list( remove_list )
    spell.spell_end( spell.id )


    this is what I have in my script... from a Heartbeat:

    if (attachee.name == 14258): ## Guardian Vrock
    game.global_vars[762] = game.global_vars[762] + 1
    if (game.global_vars[762] >= 3):
    damage_dice = dice_new( '1d8' )
    game.particles( 'Mon-Vrock-Spores', attachee)
    for obj in game.obj_list_vicinity(attachee.location,OLC_CRITTERS):
    if (obj.distance_to(attachee) <= 10 and obj.name != 14258 and obj.name != 14361):
    obj.spell_damage( attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 261 )
    game.particles( 'Mon-Vrock-Spores-Hit', obj )
    obj.condition_add_with_args( 'sp-Vrock Spores', 273, 10, 0)


    273 is the spell ID when used in the original spell, though I only know this by setting a global_vars during the spell to see what it is...

    I am sure the problem is with the spell.id part...

    Any help?
     
  3. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    what happens when you try 602?

    273 seems to be levitate. 602 is vrock screech

    Just a thought, I'm actually thinking that this is one of those potential areas where context matters. You're not in spell casting mode, then the condition doesn't "stick".

    Still, try the 602?

    -- dulcaoin
     
  4. Livonya

    Livonya Established Member

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

    No, the spell.id does NOT respond to anything in a mes.file this number is not the same as the mes.id number. That was my first thought, but it just doesn't work like that. The only numbers that do anything outside of the spell file are the 260 to 278 range, everything else produces no effect at all.

    If you set a game.global_vars[##] = spell.id in the middle of the Vrock Spore cloud you will discover that the spell.id is 273

    If you modify the Vrock Spore code so that it is 273 instead of spell.id then the spell works just fine. Which shows that 273 is accurate.

    Furthermore...

    obj.condition_add_with_args( 'sp-Vrock Spores', 273, 10, 0) works perfectly inside the spell, but if you use

    obj.condition_add_with_args( 'sp-Vrock Spores', 273, 10, 0) outside of the spell file then you get mage armor effect instead (or some other defensive spell effect).

    Even stranger...

    If you use: obj.spell_damage( attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 273 ) inside the spell then it works just fine...

    BUT if you use this exact code [obj.spell_damage( attachee, D20DT_POISON, damage_dice, D20DAP_UNSPECIFIED, D20A_CAST_SPELL, 273 )] outside of the spell file then you get a MAXIMIZED spell.

    That is why I changed the number to 261 which seems to work fine.

    - Livonya
     
Our Host!