Jump to content

Photo

arcane scroll distribution


No replies to this topic

#1 DavidW

DavidW
  • Gibberlings
  • 4611 posts
  • Gender:Male

Posted 22 August 2018 - 06:16 PM

A while ago I made my own converter to auto-convert the IWD spell resources over to BG2, using bits of IWDEE code. It's mostly not useful for IWDification because it doesn't work for vanilla BG2, but there's a fragment that might be some use: my solution to where to put scrolls. What I did was to assign each IWD arcane spell a BG partner. Then any time the partner scroll appeared in a store, area container or creature inventory, a copy of the IWD scroll goes there too. That scatters the spells a bit more realistically through the game, and makes them feel a bit more integrated.

 

Happy to donate the code if it's of use; I've rewritten it slightly to remove dependency on SCS's function library. Just put it in a library file and INCLUDE it. I know I should be doing this through git but I can't work out how the fork functionality works; seems I can't remember how to attach a document to a post either (I suck at collaboration tools). Here it is as text, or I can email a copy.

 
///////////////////////////////////////////////
//// Data
///////////////////////////////////////////////
ACTION_DEFINE_ASSOCIATIVE_ARRAY iwd_scrolls BEGIN
EXPEDITIOUS_RETREAT=>CDIA126
SNILLOCS_SNOWBALL_SWARM => CDIA204
DECASTAVE => CDIA216
CATS_GRACE => CDIA225
ICELANCE => CDIA327
LANCE_OF_DISRUPTION => CDIA328
BELTYNS_BURNING_BLOOD => CDIA422
SHADOW_MONSTERS => CDIA426
EMOTION_COURAGE => CDIA427
EMOTION_FEAR => CDIA428
EMOTION_HOPE => CDIA429
MORDENKAINENS_FORCE_MISSILES => CDIA430
SHOUT => CDIA431
VITRIOLIC_SPHERE => CDIA432
SHROUD_OF_FLAME => CDIA524
DEMI_SHADOW_MONSTERS => CDIA525
SUMMON_SHADOW => CDIA526
CONTACT_OTHER_PLANE => CDIA528
CONJURE_WATER_ELEMENTAL => CDIA533
ANTIMAGIC_SHELL => CDIA610
LICH_TOUCH => CDIA626
MONSTER_SUMMONING_4 => CDIA627
OTILUKES_FREEZING_SPHERE => CDIA628
SHADES => CDIA629
DARTS_OF_BONE => CDIA630
SOUL_EATER => CDIA631
TROLLISH_FORTITUDE => CDIA632
MONSTER_SUMMONING_5 => CDIA706
MALAVONS_RAGE => CDIA709
ACID_STORM => CDIA724
SEVEN_EYES => CDIA725
SUFFOCATE => CDIA726
MONSTER_SUMMONING_6 => CDIA801
MIND_BLANK => CDIA802
GREAT_SHOUT => CDIA806
IRON_BODY => CDIA814
MONSTER_SUMMONING_7 => CDIA901
END
ACTION_DEFINE_ASSOCIATIVE_ARRAY bg_scrolls BEGIN
STINKING_CLOUD => SCRL97
KNOCK => SCRL91
STRENGTH => SCRL98
FLAME_ARROW => SCRL1F
LIGHTNING_BOLT => SCRL1K
CONTAGION => SCRLA8
EMOTION_HOPELESSNESS => SCRL5H
OTILUKES_RESILIENT_SPHERE => SCRL5J
CONE_OF_COLD => SCRL2F
ICE_STORM => SCRL1X
SUN_FIRE => SCRLAR
CHAIN_LIGHTNING => SCRL7S
DISINTEGRATE => SCRL7T
DEATH_FOG => SCRL7R
TENSERS_TRANSFORMATION => SCRL7G
DELAYED_BLAST_FIREBALL => SCRL8N
SPHERE_OF_CHAOS => SCRL8M
PROTECTION_FROM_ENERGY => SCRL8Y
BIGBYS_CLENCHED_FIST => SCRLB1
IMPROVED_MANTLE => SCRL9C
CARRION => SCRL8A
WYVERN_CALL => SCRL7W
SUMMON_EFREET => SCRL8S
SLEEP => SCRL81
SPIDER_SPAWN => SCRL6R
MONSTER_SUMMONING_3 => SCRL2G
ANIMATE_DEAD => SCRL2D
ORACLE => SCRL6W
CONJURE_FIRE_ELEMENTAL => SCRL7X
DELAYED_BLAST_FIREBALL => SCRL8N
PRISMATIC_SPRAY => SCRL8P
END
ACTION_DEFINE_ASSOCIATIVE_ARRAY shadow_data BEGIN
SNILLOCS_SNOWBALL_SWARM    =>             STINKING_CLOUD
DECASTAVE                  =>             KNOCK
CATS_GRACE                 =>             STRENGTH
ICELANCE                   =>             FLAME_ARROW
LANCE_OF_DISRUPTION        =>             LIGHTNING_BOLT
BELTYNS_BURNING_BLOOD      =>             CONTAGION
SHADOW_MONSTERS            =>             SPIDER_SPAWN
EMOTION_COURAGE            =>             EMOTION_HOPELESSNESS
EMOTION_FEAR               =>             EMOTION_HOPELESSNESS
EMOTION_HOPE               =>             EMOTION_HOPELESSNESS
MORDENKAINENS_FORCE_MISSILES  =>          OTILUKES_RESILIENT_SPHERE
SHOUT                         =>          CONE_OF_COLD
VITRIOLIC_SPHERE              =>          ICE_STORM
SHROUD_OF_FLAME               =>          SUN_FIRE
DEMI_SHADOW_MONSTERS          =>          MONSTER_SUMMONING_3
SUMMON_SHADOW                 =>          ANIMATE_DEAD
CONTACT_OTHER_PLANE           =>          ORACLE
CONJURE_WATER_ELEMENTAL       =>          CONJURE_FIRE_ELEMENTAL
ANTIMAGIC_SHELL               =>          SPELL_DEFLECTION
LICH_TOUCH                    =>          DEATH_SPELL
SHADES                        =>          WYVERN_CALL
OTILUKES_FREEZING_SPHERE      =>          CHAIN_LIGHTNING
DARTS_OF_BONE                 =>          DISINTEGRATE
SOUL_EATER                    =>          DEATH_FOG
TROLLISH_FORTITUDE            =>          TENSERS_TRANSFORMATION
ACID_STORM                    =>          DELAYED_BLAST_FIREBALL
SUFFOCATE                     =>          SPHERE_OF_CHAOS
MIND_BLANK                    =>          PROTECTION_FROM_ENERGY
GREAT_SHOUT                   =>          BIGBYS_CLENCHED_FIST
IRON_BODY                    =>           IMPROVED_MANTLE
SUMMON_SHADOW                =>           CARRION
MONSTER_SUMMONING_4          =>           WYVERN_CALL
MONSTER_SUMMONING_7          =>           SUMMON_EFREET
MONSTER_SUMMONING_6          =>           SUMMON_EFREET
MONSTER_SUMMONING_5         =>            SUMMON_EFREET
MALAVONS_RAGE               =>            DELAYED_BLAST_FIREBALL
SEVEN_EYES                  =>            PRISMATIC_SPRAY
EXPEDITIOUS_RETREAT         =>            SLEEP
END
////////////////////////////
/// actual code begins
////////////////////////////
ACTION_IF GAME_IS "tutu" BEGIN
   OUTER_SPRINT tutu_var "_"
END ELSE BEGIN
   OUTER_SPRINT tutu_var ""
END
   ACTION_PHP_EACH shadow_data AS iwd_spell=>bg_spell BEGIN
      OUTER_SPRINT iwd_scroll $iwd_scrolls("%iwd_spell%")
      OUTER_SPRINT bg_scroll $bg_scrolls("%bg_spell%")
      OUTER_SPRINT bg_scroll "%tutu_var%%bg_scroll%"
      OUTER_SPRINT $shadow_map("%iwd_scroll%") "%bg_scroll%"
   END
   COPY_EXISTING_REGEXP GLOB ".*\.sto" override
           GET_OFFSET_ARRAY offset_array STO_V10_ITEMS_SOLD
           PHP_EACH offset_array AS key=>offset_base BEGIN
                    READ_ASCII offset_base item_resref
                    TO_UPPER item_resref
                    READ_LONG (offset_base+0x14) number
                    SET $stock("%item_resref%")=number
           END
           PHP_EACH shadow_map AS iwd_scroll=>bg_scroll BEGIN
                 PATCH_IF INDEX_BUFFER ("%bg_scroll%")>=0 BEGIN
                      TO_UPPER bg_scroll
                      SET number_in_stock=$stock("%bg_scroll%")
                      ADD_STORE_ITEM "%iwd_scroll%" AFTER "%bg_scroll%" #1 #0 #0 "IDENTIFIED" ("%number_in_stock%")
                 END
           END
   BUT_ONLY
  
   COPY_EXISTING_REGEXP GLOB ".*\.cre" override
         PHP_EACH shadow_map AS iwd_scroll=>bg_scroll BEGIN
                 PATCH_IF INDEX_BUFFER ("%bg_scroll%")>=0 BEGIN
                    ADD_CRE_ITEM "%iwd_scroll%" #0 #0 #0 ~IDENTIFIED~ ~INV~
                 END
         END
   BUT_ONLY
   COPY_EXISTING_REGEXP GLOB ".*\.are" override
         PHP_EACH shadow_map AS iwd_scroll=>bg_scroll BEGIN
                 PATCH_IF INDEX_BUFFER ("%bg_scroll%")>=0 BEGIN
                       SET container_to_add_to=0
                       GET_OFFSET_ARRAY cnt_array ARE_V10_CONTAINERS
                       PHP_EACH cnt_array AS cnt_number=>offset_base BEGIN
                          GET_OFFSET_ARRAY2 item_array offset_base ARE_V10_ITEMS
                          PHP_EACH item_array AS ind=>offset BEGIN
                             READ_ASCII offset item_resref
                             PATCH_IF "%item_resref%" STRING_EQUAL_CASE "%bg_scroll%" BEGIN
                                SET container_to_add_to=cnt_number+1
                             END
                          END
                       END
                       PATCH_IF container_to_add_to>0 BEGIN
                          LPF ADD_AREA_ITEM STR_VAR item_to_add="%iwd_scroll%" container_to_add_to END
                       END
                 END
         END
   BUT_ONLY
 
 

 


 

Edited by DavidW, 22 August 2018 - 06:24 PM.




Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users