hsp天道 | ||
使用ゲーム | 信長の野望・天道 | |
シナリオ・担当勢力 | - | |
シナリオの設定 | - | |
動画形態 | - | |
登録武将 | - | |
史実武将の扱い | - | |
縛り | - | |
投稿時期 | - | |
投稿者名 | tamura | |
マイリスト | hsp天道 | |
関連タグ | 【hsp天道】 | |
ニコニコ大百科 | ||
関連サイト | - | |
ニコ証 | - | |
関連動画 | その時幻想郷が動いた | |
備考 | - |
#uselib "user32.dll" #func SetTimer "SetTimer" int,int,int,int #func KillTimer "KillTimer" int,int #uselib "kernel32.dll" #cfunc CreateToolhelp32Snapshot "CreateToolhelp32Snapshot" int,int #cfunc Process32First "Process32First" int,sptr #cfunc Process32Next "Process32Next" int,sptr #func CloseHandle "CloseHandle" int #cfunc OpenProcess "OpenProcess" int,int,int #func ReadProcessMemory "ReadProcessMemory" int,int,var,int,int #func WriteProcessMemory "WriteProcessMemory" int,int,var,int,int #define WM_TIMER 0x0113 #define TIMER_ID 1 ; タイマーID sdim strBuf,25000;あとで使う変数。 gsel 0,-1;起動時に現れるなんとかというウィンドウを消す。 ;ウィンドウの表示、およびあれこれ設定。 screen 2,300,100,4 hMainWnd=hwnd onexit goto *exit title "test" button goto "システム実行!",*main_system ; メッセージ処理の登録、タイマーメッセージが来たら*OnTimerラベルへ飛ぶ。 oncmd gosub *OnTimer,WM_TIMER ; タイマーを設定(1秒間隔) SetTimer hwnd,TIMER_ID,1000,0 if stat==0 { dialog "タイマーの設定に失敗しました。", 1, "エラー" end } ;ハンドル取得に使う変数を準備。 sdim ProcName,260 dim PROCESSENTRY32,74 ProcName="NOBU13.exe" ;スナップショットを調べて、天道のハンドルという情報を探す。 *GetProc GameWndPID=0 hSnap=CreateToolhelp32Snapshot($F,0) if hSnap==-1:dialog "CreateToolhelp32Snapshot error",1,"スナップショットなし":stop PROCESSENTRY32.0=296 if Process32First(hSnap,varptr(PROCESSENTRY32)){ do getstr strBuf,PROCESSENTRY32,36,'\0' if strBuf==ProcName:GameWndPID=PROCESSENTRY32.2:_break until Process32Next(hSnap,varptr(PROCESSENTRY32))==0 if GameWndPID==0{ CloseHandle hSnap error="天道は起動していますか?\nEXEはNOBU13.exeですか?" switch MessageBoxA(hMainWnd,error,"エラー",$15) case 2 end case 4 goto *GetProc swend } }else{ CloseHandle hSnap dialog "Process32First error",1,"想定外のエラー" end } CloseHandle hSnap hGameWndProc=OpenProcess($1F0FFF,0,GameWndPID) ;サーチ用変数。 NowSearchA=0 NowSearchB=0 NowSearchC=0 NowSearchD=0 /*以下の2つの数値の下4桁はPC環境によって変わるので、使用者が独自に調べて下さい。*/ adr_today=$110035F0;シナリオ開始日時のアドレス。35F0の部分を調べてください。 k=$200001DC;蠣崎季広の統率のアドレス。01DCの部分を調べてください。 ;ゲーム内の日付を検索する。 *Search_today ReadProcessMemory hGameWndProc,int(adr_today),NowSearchA,4,0 ReadProcessMemory hGameWndProc,int(adr_today+4),NowSearchB,4,0 ReadProcessMemory hGameWndProc,int(adr_today+16),NowSearchC,4,0 ReadProcessMemory hGameWndProc,int(adr_today+20),NowSearchD,4,0 if NowSearchA==$61D&NowSearchB==$3 {;群雄割拠の開始日付を探す。 if NowSearchA<=NowSearchC{ dialog "日付を発見しました!" mes NowSearchC;現在の年号を表示 adr_today=adr_today+16;現在の年号のアドレスを入力しておく。 goto *Search_kaki } else { adr_today=adr_today+$10000 goto *Search_today } } else { if adr_today>$14000000 { dialog "日付が見つかりません。\n天道を再起動してみてください。" end } else { adr_today=adr_today+$10000 goto *Search_today } } stop ;蠣崎季広のデータを検索する。 *Search_kaki ReadProcessMemory hGameWndProc,int(k),NowSearchA,4,0 ReadProcessMemory hGameWndProc,int(k)+4,NowSearchB,4,0 ReadProcessMemory hGameWndProc,int(k)+8,NowSearchC,4,0 ReadProcessMemory hGameWndProc,int(k)+12,NowSearchD,4,0 ;NowSearchXは、はじめに4バイトで使ったので、後はずっと4バイトで使用する。 if NowSearchA=$44&NowSearchB=$31&NowSearchC=$4C&NowSearchD=$4F { dialog "蠣崎季広のデータを見つけました!" } else { if k>$220001DC { dialog "季広のデータが見つかりません\n天道を再起動してみてください。" stop } k=k+$10000 goto *Search_kaki } ;ここでmain_systemで使う変数の準備。 kaguya_kyotenn_taikyuu=0 Value=0 ValueB=0 ValueC=0 ValueWA=0 AdrBuf=0 yuuka_tousi_now=0 stop ;OnTimerに行く前にstopで止めないとエラー。 *OnTimer ;タイマーメッセージの処理 if wparam==TIMER_ID : gosub *main_system return 0;gosubで呼びだしたラベルの最後はreturnでないとスタック領域がオーバーフローしましたというエラーがでる。 ;覚醒システム本体 *main_system ;幽香(武将No.464)の戦法が発動した瞬間のみ、幽香の武勇を倍にする。 yuuka_tousi_pre=yuuka_tousi_now ReadProcessMemory hGameWndProc,int(k+$38300-$40),Value,4,0 AdrBuf=Value;AdrBuf=現在地のポインタ ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 if Value==$D32FE0 { ReadProcessMemory hGameWndProc,int(AdrBuf+$78),Value,4,0;Value=軍勢のポインタ。 if Value==$0 {;幽香の部隊が単独である。 ReadProcessMemory hGameWndProc,int(AdrBuf+$4C),yuuka_tousi_now,4,0 } else {;幽香の部隊が軍勢に含まれる。 ReadProcessMemory hGameWndProc,int(Value+$4C),yuuka_tousi_now,4,0 } } if yuuka_tousi_now!=0&&yuuka_tousi_now<=yuuka_tousi_pre {;闘志の減少を確認。 ValueWA=230 WriteProcessMemory hGameWndProc,int(k+$38300+$4),ValueWA,4,0 } vs_heiryoku_pre=vs_heiryoku_now ReadProcessMemory hGameWndProc,int(k+$38300-$40),Value,4,0 AdrBuf=Value;AdrBuf=現在地のポインタ ReadProcessMemory hGameWndProc,int(AdrBuf+$10),Value,4,0 AdrBuf=Value;攻撃目標のポインタ ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 if Value==$D30120 {;攻撃目標が拠点である。 ReadProcessMemory hGameWndProc,int(AdrBuf+$28),vs_heiryoku_now,4,0 } if vs_heiryoku_now<vs_heiryoku_pre||vs_heiryoku_now==0 {;兵数が減少したら、武勇を元に戻す。 ValueWA=115 WriteProcessMemory hGameWndProc,int(k+$38300+$4),ValueWA,4,0 } ;輝夜(武将No.499)の所属拠点の耐久値を回復する。 AdrBuf=k+$3C6D0-$40;輝夜の現在地のポインタのアドレス ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0;Value=現在地データ始まりのアドレス AdrBuf=Value ReadProcessMemory hGameWndProc,int(AdrBuf),ValueB,4,0 if ValueB==$D30120 {;現在地が拠点である AdrBuf=k+$3C6D0-$40;輝夜の現在地のポインタのアドレス ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0;Value=拠点データ始まりのアドレス AdrBuf=Value+$110 ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0;Value=耐久値のアドレス AdrBuf=Value+$C ReadProcessMemory hGameWndProc,int(AdrBuf),kaguya_kyotenn_taikyuu,4,0 if kaguya_kyotenn_taikyuu<6000{ Value=6000 WriteProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 } } ;衣玖(武将No.90)の部隊の士気を回復する。 AdrBuf=k+$AE60-$40;イクサンの現在地ポインタ ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 AdrBuf=Value ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 if Value==$D32FE0 { AdrBuf=AdrBuf+$48 ValueWA=$64 WriteProcessMemory hGameWndProc,int(AdrBuf),ValueWA,4,0 } ;衣玖の覚醒条件 武将No.93と94が同じ勢力。 ReadProcessMemory hGameWndProc,int(k+$AE60),Value,4,0 if Value<99 {;衣玖が未覚醒 ReadProcessMemory hGameWndProc,int(k+$AE60-$74),Value,4,0 ReadProcessMemory hGameWndProc,int(k+$B430-$74),ValueB,4,0 ReadProcessMemory hGameWndProc,int(k+$B620-$74),ValueC,4,0 if Value==ValueB&&Value==ValueC{;二人とも同じ勢力 ValueWA=100 WriteProcessMemory hGameWndProc,int(k+$AE60),ValueWA,4,0 WriteProcessMemory hGameWndProc,int(k+$B430),ValueWA,4,0 WriteProcessMemory hGameWndProc,int(k+$B620),ValueWA,4,0 } } return 0 *exit KillTimer hwnd,TIMER_ID ;タイマーを破棄 CloseHandle hGameWndProc end
;早苗の軍勢が出陣しても、拠点の兵力が減らない。 ReadProcessMemory hGameWndProc,int(k+$67E60-$40),sanae_gennzaiti_Adr,4,0 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr),Value,4,0;早苗の現在地を取得 if sanae_syutuzinn==0 {;フラグOFF if Value==$D30120 {;早苗が拠点にいる。 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),sanae_kyotenn_heiryoku,4,0;拠点兵力を取得。 sanae_kyotenn_heiryoku_Adr=sanae_gennzaiti_Adr+$28 } if Value==$D32FE0 {;早苗が出陣している ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$70),ValueC,4,0;さっきまでいた拠点の兵力を減らす。 ReadProcessMemory hGameWndProc,int(ValueC+$28),ValueD,4,0 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),ValueB,4,0 ValueWA=ValueD+ValueB WriteProcessMemory hGameWndProc,int(sanae_kyotenn_heiryoku_Adr),ValueWA,4,0 ReadProcessMemory hGameWndProc,int(adr_today),sanae_syutuzinn_year,4,0;日付を取得 ReadProcessMemory hGameWndProc,int(adr_today+$4),sanae_syutuzinn_month,4,0 ReadProcessMemory hGameWndProc,int(adr_today+$8),sanae_syutuzinn_day,4,0 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$70),ValueB,4,0;出陣拠点の兵力を取得。 sanae_kyotenn_heiryoku_Adr=ValueB+$28 ReadProcessMemory hGameWndProc,int(sanae_kyotenn_heiryoku_Adr),sanae_kyotenn_heiryoku,4,0 sanae_syutuzinn=1;フラグON ValueWA=30000;兵力を30000に。 WriteProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),ValueWA,4,0 } } if sanae_syutuzinn==1 {;フラグON if Value==$D30120 {;早苗が拠点にいる(拠点に帰還した)。 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),sanae_kyotenn_heiryoku,4,0;拠点兵力 sanae_kyotenn_heiryoku=sanae_kyotenn_heiryoku-sanae_heiryoku;拠点兵力から現在兵力を減らす。 WriteProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),sanae_kyotenn_heiryoku,4,0 sanae_syutuzinn=0 } if Value==$D32FE0 {;早苗が出陣している ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),sanae_heiryoku,4,0;現在兵力取得。 ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$78),ValueB,4,0 ;兵糧を補給する。 ReadProcessMemory hGameWndProc,int(adr_today),sanae_now_year,4,0;日付を取得 ReadProcessMemory hGameWndProc,int(adr_today+$4),sanae_now_month,4,0 ReadProcessMemory hGameWndProc,int(adr_today+$8),sanae_now_day,4,0 sanae_keikanissuu=(sanae_now_year-sanae_syutuzinn_year)*360+(sanae_now_month-sanae_syutuzinn_month)*30+(sanae_now_day-sanae_syutuzinn_day) ReadProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$28),ValueB,4,0 sanae_hokyuu_hyourou=ValueB*sanae_keikanissuu/90 if sanae_hokyuu_hyourou>0 {;季節始めに兵糧が激減するバグの防止。 ReadProcessMemory hGameWndProc,int(k+$67E60-$74),ValueC,4,0 ReadProcessMemory hGameWndProc,int(ValueC+$4C),ValueD,4,0 ValueD=ValueD+sanae_hokyuu_hyourou WriteProcessMemory hGameWndProc,int(ValueC+$4C),ValueD,4,0 } ReadProcessMemory hGameWndProc,int(adr_today),sanae_syutuzinn_year,4,0;多重に補給しないよう、出陣日数を書き換えておく。 ReadProcessMemory hGameWndProc,int(adr_today+$4),sanae_syutuzinn_month,4,0 ReadProcessMemory hGameWndProc,int(adr_today+$8),sanae_syutuzinn_day,4,0 ValueWA=0 WriteProcessMemory hGameWndProc,int(sanae_gennzaiti_Adr+$2C),ValueWA,4,0;傷兵を消す。 } }
;神奈子が攻撃中の相手に、毎秒特定の打撃を与える。 ReadProcessMemory hGameWndProc,int(k+$63A90-$40),AdrBuf,4,0 ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0;神奈子の現在地を調べる。 if Value==$D32FE0{;出陣中 ReadProcessMemory hGameWndProc,int(AdrBuf+$10),ValueB,4,0 ReadProcessMemory hGameWndProc,int(ValueB),ValueC,4,0 if ValueC==$D32FE0||ValueC==$D30120 {;目標は敵部隊、もしくは拠点 ReadProcessMemory hGameWndProc,int(ValueB+$28),ValueWA,4,0 ValueWA=ValueWA-100 ReadProcessMemory hGameWndProc,int(ValueB+$2C),ValueWB,4,0 ValueWB=ValueWB+100 if ValueWA<0 { ValueWB=ValueWB+ValueWA ValueWA=0 } WriteProcessMemory hGameWndProc,int(ValueB+$28),ValueWA,4,0 WriteProcessMemory hGameWndProc,int(ValueB+$2C),ValueWB,4,0 } if ValueC==$D2FDC8 {;目標は敵施設。 ReadProcessMemory hGameWndProc,int(ValueB+$C),ValueWA,4,0 ValueWA=ValueWA-100 if ValueWA<0 { ValueWA=0 } WriteProcessMemory hGameWndProc,int(ValueB+$C),ValueWA,4,0 } }
;諏訪子の戦法が発動した瞬間のみ、備え系戦法効果時間を5倍にする。 suwako_tousi_pre=suwako_tousi_now ReadProcessMemory hGameWndProc,int(k+$51DC0-$40),Value,4,0 AdrBuf=Value;AdrBuf=現在地のポインタ ReadProcessMemory hGameWndProc,int(AdrBuf),Value,4,0 if Value==$D32FE0 {;出陣中 ReadProcessMemory hGameWndProc,int(AdrBuf+$78),Value,4,0;Value=軍勢のポインタ。 if Value==$0 {;諏訪子の部隊が単独である。 ReadProcessMemory hGameWndProc,int(AdrBuf+$4C),suwako_tousi_now,4,0;部隊の闘志取得 ReadProcessMemory hGameWndProc,int(AdrBuf+$10),ValueB,4,0 ReadProcessMemory hGameWndProc,int(ValueB+$28),suwako_vs_heiryoku_now,4,0;対戦相手の兵力 } else {;諏訪子の部隊が軍勢に含まれる。 ReadProcessMemory hGameWndProc,int(Value+$4C),suwako_tousi_now,4,0;軍勢の闘志 ReadProcessMemory hGameWndProc,int(Value+$10),ValueB,4,0 ReadProcessMemory hGameWndProc,int(ValueB+$28),suwako_vs_heiryoku_now,4,0;対戦相手の兵力 } if suwako_tousi_now!=0&&suwako_tousi_now<suwako_tousi_pre {;闘志の減少を確認。 ValueWA=100 WriteProcessMemory hGameWndProc,int($E90E08),ValueWA,4,0 } if suwako_tousi_now>suwako_tousi_pre||suwako_tousi_now==0 {;闘志が減少したら、値を元に戻す。 ValueWA=20 WriteProcessMemory hGameWndProc,int($E90E08),ValueWA,4,0 } } else {;出陣中に非ず ReadProcessMemory hGameWndProc,int($E90E08),Value,4,0 if Value>20 { ValueWA=20 WriteProcessMemory hGameWndProc,int($E90E08),ValueWA,4,0;パラメータを元に戻す。 } }
;雛の撃破兵数を知る。 ReadProcessMemory hGameWndProc,int(k+$91500),HinaKill,4,0;ヒナキルの呼び出し。 ReadProcessMemory hGameWndProc,int(k+$91500-$F0),HinaLV_pre,4,0;雛レベルの呼び出し。 ReadProcessMemory hGameWndProc,int(k+$5D0-$40),Value,4,0 ReadProcessMemory hGameWndProc,int(Value),ValueB,4,0 if ValueB==$D32FE0 {;雛が出陣中。 hina_mokuhyou_pre=hina_mokuhyou_now hina_mokuhyou_heiryoku_pre=hina_mokuhyou_heiryoku_now hina_syouhei_pre=hina_syouhei_now ReadProcessMemory hGameWndProc,int(Value+$10),hina_mokuhyou_now,4,0;攻撃目標 ReadProcessMemory hGameWndProc,int(hina_mokuhyou_now),ValueB,4,0;目標の種類取得 ReadProcessMemory hGameWndProc,int(hina_mokuhyou_now+$28),hina_mokuhyou_heiryoku_now,4,0;目標兵数 ReadProcessMemory hGameWndProc,int(hina_mokuhyou_now+$2C),hina_syouhei_now,4,0;目標兵数 if ValueB==$D32FE0||ValueB==$D30120 { if hina_mokuhyou_pre==hina_mokuhyou_now{;目標が健在。 gennsyou=hina_mokuhyou_heiryoku_pre-hina_mokuhyou_heiryoku_now;兵数減少。 zouka_syouhei=hina_syouhei_now-hina_syouhei_pre ValueD=gennsyou*0.3 if gennsyou>=0&&zouka_syouhei>ValueD {;兵力が減少しており、傷兵がそれに見合うだけ増えている。 HinaKill=HinaKill+gennsyou WriteProcessMemory hGameWndProc,int(k+$91500),HinaKill,4,0;ヒナキルの保管。 } } } } cls ;雛のレベルアップ HinaLV_now=HinaKill/10000 if HinaLV_now>HinaLV_pre {;レベルがさっきまでと違う ReadProcessMemory hGameWndProc,int(k+$5D0),ValueWA,4,0 ValueWA=ValueWA+1 WriteProcessMemory hGameWndProc,int(k+$5D0),ValueWA,4,0 ReadProcessMemory hGameWndProc,int(k+$5D0+$8),ValueWA,4,0 ValueWA=ValueWA+1 WriteProcessMemory hGameWndProc,int(k+$5D0+$8),ValueWA,4,0 HinaLV_pre=HinaLV_pre+1 WriteProcessMemory hGameWndProc,int(k+$91500-$F0),HinaLV_pre,4,0 mes "LVUP" } mes "目標前"+hina_mokuhyou_pre+"" mes "目標今"+hina_mokuhyou_now+"" mes "兵力前"+hina_mokuhyou_heiryoku_pre+"" mes "兵力今"+hina_mokuhyou_heiryoku_now+"" mes "減少値"+gennsyou+"" mes "ヒナキル"+HinaKill+"" mes "雛レベル"+HinaLV_pre+"" mes "雛レベル"+HinaLV_now+""