san_ questions

Discussion in 'General Modification' started by marc1967, Mar 11, 2015.

Remove all ads!
  1. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    673
    Likes Received:
    110
    Could someone correct me, or confirm that I am making the right assumptions below regarding san_ files and new npc protos I am creating, before I make 200 new nps's and have to start over. :tired:


    1) I notice that most protos call py00002black jay.py for san_start_combat, and py00006captain.py for san_dying.

    san_start_combat() in py00002black jay.py has some code dealing with "break free" and handling the spiritual weapon exploit. But there are also a lot of if-thens regarding dual wielding nps's which I don't need to chug thru every time the new npc starts his combat turn.

    san_dying() in py00006captain.py is very straightforward and handles reducing CR (challenge ratings) for monsters for higher level characters, since the game only reduced xp's up to level 10.

    So, if I want to make a proto that has its own san_start_combat() or san_dying() and can't default to calling the black jay or captain function, I will extract what I have shown below as the relevant part of that code to include in the function.

    Code:
    def san_start_combat( attachee, triggerer ):
    
    	while(attachee.item_find(8903) != OBJ_HANDLE_NULL):
    		attachee.item_find(8903).destroy()
    	if (attachee.d20_query(Q_Is_BreakFree_Possible)):
    		create_item_in_inventory( 8903, attachee )
    
    	if attachee.leader_get() != OBJ_HANDLE_NULL: # Don't wanna f#@k up charmed enemies
    		return RUN_DEFAULT
    	Spiritual_Weapon_Begone( attachee )
    	
    	return RUN_DEFAULT
    
    def san_dying( attachee, triggerer ):
    	if should_modify_CR( attachee ):
    		modify_CR( attachee, get_av_level() )
    	return RUN_DEFAULT
    

    2) I don't think the following san_ functions trigger:

    san_hit()
    san_miss()
    san_taking_damage()
    san_critter_hits()

    At least I can't get them to work, and I see none of them are used in any script file at all, with one exception. Ronald tries to make the call to san_taking_damage(), but it doesn't trigger. Maybe someone else was experimenting and trying to make it work too, and left the code there.
     
    Last edited: Mar 11, 2015
  2. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    That's about the size of it, yes.

    A few remarks:

    1) Don't forget to import combat_standard_routines.py
    2) About Spiritual_Weapon_Begone: I've recently discovered that the timing constants need to be tweaked for it to work across the board. i.e. there were some cases where the timed obj_f_critter_strategy restoration fired too soon and negated the fix. So far I've changed it to this:

    Code:
    def Spiritual_Weapon_Begone( attachee ):
    	SW_BS_TIME = 45 # [ms] time lapse for the spiritual weapon being away
    	SW_BS_TIME_2 = 60 # a longer interval for the second ("failsafe") call
    	SW_BS_TIME_3 = 250
    This is still experimental, though.

    3) Some of the san_ scripts, like many other things in ToEE, are non-functioning Arcanum leftovers. See http://www.co8.org/forum/showthread.php?t=2407
     
  3. marc1967

    marc1967 Established Member

    Joined:
    Jan 19, 2014
    Messages:
    673
    Likes Received:
    110
    Thanks again Sitra, it's nice to have confirmation. That's a great link there to a discussion on the usable and unusable san files.

    On a related note, I've notice a trend in many of the flag values in proto entries that repeat themselves within the same entry. For example:

    Code:
    "OCF_NO_FLEE  OCF_MUTE  OCF_NO_FLEE  OCF_MUTE " 
    
    "OIF_WEAR_RING_PRIMARY  OIF_WEAR_RING_SECONDARY  OIF_WEAR_RING_PRIMARY  OIF_WEAR_RING_SECONDARY  OIF_WEAR_RING"
    These aren't just scatted occurrances of typos, but are actually in most of the protos for items in regards to the second example. Is this some way of overriding a known bug, or is it just copy paste gone amok? :p
     
  4. Sitra Achara

    Sitra Achara Senior Member

    Joined:
    Sep 1, 2003
    Messages:
    3,622
    Likes Received:
    538
    Unfortunately ToEE is a very fickle beast when it comes to cause and consequence. You never know what weird stipulation is there to save the game from crashing :p (I think the most ludicrous example would be the area description pop-ups that caused the Jerk Stop bug) Anyway it's like that in the vanilla file, too.

    If I had to hazard a guess, I'd say it's possibly related to the weird control characters in the file (0x0Bh). I bet Troika's parser doesn't read past the first match in a string, and skips to the next space character (0x20h), so whatever editor they were using simply didn't register that duplicity. I'd say there should be no harm in doing it 'normally', but it's best to be cautious - at the very least you should jot it down if you change anything so that when the game starts refusing to boot, you know what to revert ;)
     
Our Host!