King Diamond Posted March 6, 2006 Share Posted March 6, 2006 I'd like to share an idea how to detect a moment of casting non-SPIN innates. As soon as none of the SpellCast*() work for such innates I see the only possible way to detect their casting moment is by the setting of a GLOBAL for a short period of time (I've chosen ONE_ROUND, could be shorter) and following script checks for such variables. If you'll find it useful plz use that. It'll be used in one part of the new CtB version (only for several spells). COPY_EXISTING_REGEXP GLOB ~.*\.spl~ ~override~  READ_SHORT 0x1c spell_type  PATCH_IF (%spell_type% = 4) BEGIN   //Innate spell   READ_LONG  0x64 abil_offset   READ_SHORT 0x68 abil_num   READ_LONG  0x6a eff_offset   READ_SHORT 0x70 glob_eff_cnt   SET extra = 0   //  adding global effect: GLOBAL var = 1   SET already_there = 0   FOR(cnt=0; cnt<"%glob_eff_cnt%"; cnt=cnt+1) BEGIN     READ_SHORT ("%eff_offset%"+0x30*cnt)    "eff_type"     READ_ASCII ("%eff_offset%"+0x30*cnt+0x14) "name"     PATCH_IF( "%eff_type%"=265 AND ("%name%" STRING_COMPARE_CASE "%SOURCE_RES%")=0 ) THEN BEGIN      SET already_there = 1     END   END   PATCH_IF( already_there=0 ) THEN BEGIN    INSERT_BYTES eff_offset   0x30    WRITE_SHORT eff_offset    265    WRITE_BYTE  eff_offset+2   1    WRITE_BYTE  eff_offset+4   1    WRITE_BYTE  eff_offset+0x0c 1    WRITE_BYTE  eff_offset+0x12 100    WRITE_EVALUATED_ASCII eff_offset+0x14 ~%SOURCE_RES%~ #8    SET glob_eff_cnt = glob_eff_cnt + 1    WRITE_SHORT 0x70 glob_eff_cnt    SET extra = 1   END   //  adding ability effects: GLOBAL var = 0   FOR(cnt=0; cnt<"%abil_num%"; cnt=cnt+1) BEGIN    SET already_there = 0    READ_SHORT ("%abil_offset%"+cnt*0x28+0x1e)  eff_cnt    READ_SHORT ("%abil_offset%"+cnt*0x28+0x20)  eff_idx    SET eff_idx = eff_idx + extra    WRITE_SHORT ("%abil_offset%"+cnt*0x28+0x20) eff_idx    FOR( cnt2=0; cnt2<eff_cnt; cnt2=cnt2+1 ) BEGIN     READ_SHORT ("%eff_offset%"+0x30*(cnt2+eff_idx))    "eff_type"     READ_ASCII ("%eff_offset%"+0x30*(cnt2+eff_idx)+0x14) "name"     PATCH_IF( "%eff_type%"=265 AND ("%name%" STRING_COMPARE_CASE "%SOURCE_RES%")=0 ) THEN BEGIN      SET already_there = 1     END    END    PATCH_IF( already_there=0 ) THEN BEGIN    SET offset = ("%eff_offset%"+0x30*eff_idx)    INSERT_BYTES offset   0x30    WRITE_SHORT offset    265    WRITE_BYTE  offset+2   1    WRITE_BYTE  offset+0x0c 4    WRITE_LONG  offset+14  6   //Time    WRITE_BYTE  offset+0x12 100    WRITE_EVALUATED_ASCII offset+0x14 ~%SOURCE_RES%~ #8    WRITE_SHORT ("%abil_offset%"+cnt*0x28+0x1e)  eff_cnt+1    SET extra = extra + 1    END   END  END BUT_ONLY_IF_IT_CHANGES Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.