OK論壇

 找回密碼
 註冊
查看: 3426|回復: 10

[教學] 神奇寶貝模組

[複製鏈接]
  • TA的每日心情
    慵懶
    2016-6-9 12:41 PM
  • 簽到天數: 31 天

    連續簽到: 1 天

    [LV.5]常住居民I

    發表於 2012-1-15 14:10:03 | 顯示全部樓層 |閱讀模式
    首先要說,這是從RO貼圖區  sinya  大所發表的  神奇寶貝 in RO ?中所看到的。
    要看實際效果可以從原出處觀看http://www.okayro.com/thread-224548-1-1.html

    sinya 大在那篇沒有發表如何使用,所以我想說在這邊補上一些使用方法。

    但是要先聲明,專案來源是國外的一個模擬器論壇,作者宣稱只能用在他們論壇。
    所以,我也不清楚到底能不能PO在這裡,如果不行的話,請麻煩告訴我一聲,我會馬上拿掉。

    另外此套件還在更新中,如果說想要追作者最新的版本,和直接下載作者源碼和圖片的話,
    請先從影片連到那論壇註冊,然後至

    http://forum.cronus-emulator.com/index.php?app=downloads&module=display§ion=download&do=version_download&id=236

    頁面下載 Data.zip 和 Renewall.zip,一個是原始碼專案,另一個是客戶端補丁(含神奇寶貝圖片音樂等),
    但檔案加起來50mb,太大了,不然我想說直接幫大家上傳,就不用貼它論壇連結了,這點還請見諒
    但論壇不是很好註冊,使用葡萄牙語,外加註冊時會問他們論壇的規則,請努力刷到問圖像大小那提,填 「150x200」

    以下貼的是他修改到的源碼,不想使用純粹想參考的大大可以挑有興趣的部分看看。


    src/map/atcommand.c
    1. ACMD_FUNC(repairall)
    2. {
    3. int count, i;
    4. int homid;
    5. nullpo_retr(-1, sd);

    6. count = 0;
    7. for (i = 0; i < MAX_INVENTORY; i++) {
    8. if (sd->status.inventory[i].nameid && sd->status.inventory[i].card[3] == 1) {
    9. homid = MakeDWord(sd->status.inventory[i].card[1], sd->status.inventory[i].card[2]);
    10. sd->status.inventory[i].card[3] = 0;
    11. clif_produceeffect(sd, 0, sd->status.inventory[i].nameid);
    12. count++;
    13. }
    14. }

    15. if (count > 0) {
    16. clif_misceffect(&sd->bl, 3);
    17. clif_equiplist(sd);
    18. clif_displaymessage(fd, msg_txt(107)); // All items have been repaired.
    19. } else {
    20. clif_displaymessage(fd, msg_txt(108)); // No item need to be repaired.
    21. return -1;
    22. }

    23. return 0;
    24. }
    複製代碼


    src/map/mob.h
    搜尋
    1. int spawn_timer;
    複製代碼
    增加
    1. nt unhide_timer;
    複製代碼
    搜尋
    1. int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data);
    複製代碼
    增加
    1. int mob_delayhide(int tid, unsigned int tick, int id, intptr_t data);int unhide_delay(struct mob_data *md);
    複製代碼
    搜尋
    1.   int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data)  
    複製代碼
    的函示撰寫位置,在底下增加
    1. int mob_delayhide(int tid, unsigned int tick, int id, intptr_t data){
    2. struct block_list* bl = map_id2bl(id);
    3. struct mob_data* md = BL_CAST(BL_MOB, bl);

    4. if( md )
    5. {
    6. if( md->unhide_timer != tid )
    7. {
    8. ShowError("mob_delayspawn: Timer mismatch: %d != %d\n", tid, md->unhide_timer);
    9. return 0;
    10. }
    11. md->unhide_timer = INVALID_TIMER;
    12. unhide_delay(md);
    13. }
    14. return 0;
    15. }

    16. int unhide_delay(struct mob_data *md){
    17. md->sc.option &= ~OPTION_HIDE;
    18. status_set_viewdata(&md->bl, md->class_);
    19. clif_changeoption(&md->bl);
    20. return 0;
    21. }
    複製代碼
    src/map/skill.c
    搜尋
    1. case WZ_ESTIMATION:
    複製代碼

    改寫
    1. case WZ_ESTIMATION:

    2. if( sd == NULL )
    3. break;
    4. if( dstsd )
    5. { // Fail on Players
    6. clif_skill_fail(sd,skillid,0,0,0);
    7. break;
    8. }
    9. if( dstmd) {
    10. rate = (dstmd->status.max_hp/dstmd->status.hp)*(100-dstmd->level)/30;
    11. if (rand()%100 < rate){
    12. clif_specialeffect(bl,112,AREA);
    13. dstmd->sc.option |= OPTION_HIDE;
    14. clif_changeoption(&dstmd->bl);
    15. memset(&tmp_item,0,sizeof(tmp_item));
    16. tmp_item.nameid = 9001;
    17. tmp_item.identify = 1;
    18. tmp_item.card[0] = CARD0_HUN;
    19. tmp_item.card[3] = dstmd->class_;
    20. if((flag = pc_additem(sd,&tmp_item,1))) {
    21. clif_additem(sd,0,0,flag);
    22. map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
    23. dstmd->deletetimer = add_timer(gettick()+4500, mob_timer_delete, dstmd->bl.id, 0);
    24. }
    25. } else {
    26. clif_specialeffect(bl,67,AREA);
    27. dstmd->sc.option |= OPTION_HIDE;
    28. clif_changeoption(&dstmd->bl);
    29. dstmd->unhide_timer = add_timer(gettick()+4500, mob_delayhide, dstmd->bl.id, 0);
    30. }
    31. }
    複製代碼




    src/map/homunculus.c
    搜尋
    1. int merc_hom_dead(struct homun_data *hd, struct block_list *src)
    複製代碼

    改寫
    1. nt merc_hom_dead(struct homun_data *hd, struct block_list *src)
    2. {
    3. struct map_session_data *sd = hd->master;
    4. struct item tmp_item;
    5. int flag;
    6. sd = hd->master;
    7. hd = sd->hd;
    8. merc_save(hd);
    9. sd = hd->master;
    10. pc_delitem(sd, pc_search_inventory(sd,690), 1, 0, 0);

    11. merc_hom_hungry_timer_delete(hd);
    12. hd->homunculus.hp = 0;

    13. memset(&tmp_item,0,sizeof(tmp_item));
    14. tmp_item.nameid = 9001;
    15. tmp_item.identify = 1;
    16. tmp_item.card[0] = CARD0_HUN;
    17. tmp_item.card[1] = GetWord(hd->homunculus.hom_id,0);
    18. tmp_item.card[2] = GetWord(hd->homunculus.hom_id,1);
    19. tmp_item.card[3] = 1;
    20. if((flag = pc_additem(sd,&tmp_item,1))) {
    21. clif_additem(sd,0,0,flag);
    22. map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
    23. }
    24. hd->homunculus.hp = 0;
    25. hd->homunculus.intimacy = 0;
    26. return unit_remove_map(&hd->bl,CLR_OUTSIGHT);
    27. }
    複製代碼



    搜尋
    1. int merc_hom_vaporize(struct map_session_data *sd, struct homun_data *hd)
    複製代碼

    改寫
    1. int merc_hom_vaporize(struct map_session_data *sd, struct homun_data *hd)
    2. {
    3. struct item tmp_item;
    4. int flag;
    5. hd = sd->hd;
    6. merc_save(hd);

    7. memset(&tmp_item,0,sizeof(tmp_item));
    8. tmp_item.nameid = 9001;
    9. tmp_item.identify = 1;
    10. tmp_item.card[0] = CARD0_HUN;
    11. tmp_item.card[1] = GetWord(hd->homunculus.hom_id,0);
    12. tmp_item.card[2] = GetWord(hd->homunculus.hom_id,1);
    13. tmp_item.card[3] = 0;
    14. if((flag = pc_additem(sd,&tmp_item,1))) {
    15. clif_additem(sd,0,0,flag);
    16. map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
    17. }
    18. sd = hd->master;
    19. hd->homunculus.intimacy = 0;
    20. return unit_remove_map(&hd->bl,CLR_OUTSIGHT);

    21. }
    複製代碼



    增加

    1. int merc_hom_evolution(struct homun_data *hd)
    2. {
    3. struct s_homunculus *hom;
    4. struct h_stats *max, *min;
    5. struct map_session_data *sd;
    6. nullpo_ret(hd);

    7. if(!hd->homunculusDB->evo_class || hd->homunculus.class_ == hd->homunculusDB->evo_class)
    8. {
    9. clif_emotion(&hd->bl, E_SWT);
    10. return 0 ;
    11. }
    12. sd = hd->master;
    13. if (!sd)
    14. return 0;

    15. if (!merc_hom_change_class(hd, hd->homunculusDB->evo_class)) {
    16. ShowError("merc_hom_evolution: Can't evolve homunc from %d to %d", hd->homunculus.class_, hd->homunculusDB->evo_class);
    17. return 0;
    18. }

    19. //Apply evolution bonuses
    20. hom = &hd->homunculus;
    21. max = &hd->homunculusDB->gmax;
    22. min = &hd->homunculusDB->gmin;
    23. intif_rename_hom(sd, hd->homunculusDB->name);
    24. hom->max_hp += rand(min->HP, max->HP);
    25. hom->max_sp += rand(min->SP, max->SP);
    26. hom->str += 10*rand(min->str, max->str);
    27. hom->agi += 10*rand(min->agi, max->agi);
    28. hom->vit += 10*rand(min->vit, max->vit);
    29. hom->int_+= 10*rand(min->int_,max->int_);
    30. hom->dex += 10*rand(min->dex, max->dex);
    31. hom->luk += 10*rand(min->luk, max->luk);
    32. hom->intimacy = 500;

    33. unit_remove_map(&hd->bl, CLR_OUTSIGHT);
    34. map_addblock(&hd->bl);

    35. clif_spawn(&hd->bl);
    36. clif_emotion(&sd->bl, E_NO1);
    37. clif_specialeffect(&hd->bl,568,AREA);

    38. //status_Calc flag&1 will make current HP/SP be reloaded from hom structure
    39. hom->hp = hd->battle_status.hp;
    40. hom->sp = hd->battle_status.sp;
    41. status_calc_homunculus(hd,1);

    42. if (!(battle_config.hom_setting&0x2))
    43. skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately

    44. return 1 ;
    45. }
    複製代碼




    回復

    使用道具 舉報

  • TA的每日心情
    慵懶
    2016-6-9 12:41 PM
  • 簽到天數: 31 天

    連續簽到: 1 天

    [LV.5]常住居民I

     樓主| 發表於 2012-1-15 14:12:04 | 顯示全部樓層
    src/map/unit.c

    改寫增加
    1. case BL_HOM:
    2. {
    3. struct homun_data *hd = (struct homun_data *)bl;
    4. ud->canact_tick = ud->canmove_tick; //It appears HOM do reset the can-act tick.
    5. if( !hd->homunculus.intimacy && !(hd->master && !hd->master->state.active) )
    6. { //If logging out, this is deleted on unit_free
    7. clif_emotion(bl, E_SOB);
    8. clif_clearunit_area(bl,clrtype);
    9. map_delblock(bl);
    10. unit_free(bl,CLR_OUTSIGHT);
    11. map_freeblock_unlock();
    12. return 0;
    13. }
    14. break;
    15. }
    複製代碼
    src/map/battle.c
    改寫
    1. case BL_PC:
    2. if (((TBL_PC*)target)->invincible_timer != INVALID_TIMER || ((TBL_PC*)target)->hd || pc_isinvisible((TBL_PC*)target ))
    3. return -1; //Cannot be targeted yet.
    4. break;
    複製代碼
    src/map/pc.c
    新增
    1. if( item->type != IT_HEALING && item->type != IT_USABLE && item->type != IT_CASH )
    2. return 0;
    3. if( !item->script ) //if it has no script, you can't really consume it!
    4. return 0;

    5. switch( nameid )
    6. }
    複製代碼
    1. case 9001: //pokebola
    2. if(sd->hd == NULL){
    3. if(sd->status.inventory[n].card[3] > 2){
    4. merc_create_homunculus_request(sd, (sd->status.inventory[n].card[3]));
    5. clif_specialeffect(&sd->bl,41,AREA);
    6. return 1;
    7. }
    8. if(sd->status.inventory[n].card[3] == 1){
    9. clif_displaymessage(sd->fd, msg_txt(718));
    10. return 0;
    11. }
    12. if(sd->status.inventory[n].card[3] == 0){
    13. sd->status.hom_id = MakeDWord(sd->status.inventory[n].card[1], sd->status.inventory[n].card[2]);
    14. intif_homunculus_requestload(sd->status.account_id, MakeDWord(sd->status.inventory[n].card[1], sd->status.inventory[n].card[2]));
    15. clif_specialeffect(&sd->bl,41,AREA);
    16. return 1;
    17. }
    18. }
    19. return 0;
    複製代碼
    src/map/itemdb.h
    搜尋
    1. #define CARD0_PET ((short)0xFF00)
    複製代碼
    新增
    1. #define CARD0_HUN ((short)0xFF00)
    複製代碼
    homunculus_db.txt
    新增
    1. 2501,2502,Bulbasaur,537,60000,0,1,7,0,700,150,40,17,20,15,35,24,0,60,100,4,9,5,19,5,19,5,19,4,20,6,20,6,20,1,10,10,20,1,5,1,4,1,5,4,10,1,10,10,16
    2. 2502,2503,Ivysaur,537,60000,0,1,7,0,700,150,40,17,20,15,35,24,0,60,100,4,9,5,19,5,19,5,19,4,20,6,20,6,20,1,10,10,20,1,5,1,4,1,5,4,10,1,10,0,36
    3. 2503,2503,Venosaur,537,60000,0,1,7,0,700,150,40,17,20,15,35,24,0,60,100,4,9,5,19,5,19,5,19,4,20,6,20,6,20,1,10,10,20,1,5,1,4,1,5,4,10,1,10,1,99
    4. 2504,2505,Charmander,912,60000,0,1,2,0,700,320,10,20,17,35,11,24,12,80,130,1,4,8,20,4,20,4,20,1,10,3,19,3,19,10,20,1,10,1,10,1,5,4,10,1,3,1,4,1,16
    5. 2505,2506,Charmileon,912,60000,0,1,2,0,700,320,10,20,17,35,11,24,12,80,130,1,4,8,20,4,20,4,20,1,10,3,19,3,19,10,20,1,10,1,10,1,5,4,10,1,3,1,4,1,36
    6. 2506,2506,Charizard,912,60000,0,1,2,0,700,320,10,20,17,35,11,24,12,80,130,1,4,8,20,4,20,4,20,1,10,3,19,3,19,10,20,1,10,1,10,1,5,4,10,1,3,1,4,1,99
    7. 2507,2508,Squirtle,910,60000,0,1,2,0,700,90,25,29,35,9,8,30,9,45,75,3,6,4,20,8,20,1,10,3,19,4,20,3,19,5,15,5,15,4,10,1,10,1,3,1,4,1,5,1,16
    8. 2508,2509,Wartortle,910,60000,0,1,2,0,700,90,25,29,35,9,8,30,9,45,75,3,6,4,20,8,20,1,10,3,19,4,20,3,19,5,15,5,15,4,10,1,10,1,3,1,4,1,5,1,36
    9. 2509,2509,Blastoise,910,60000,0,1,2,0,700,90,25,29,35,9,8,30,9,45,75,3,6,4,20,8,20,1,10,3,19,4,20,3,19,5,15,5,15,4,10,1,10,1,3,1,4,1,5,1,99
    複製代碼
    Item_db.txt
    新增
    1. 690,Pokebola,Pokebola,11,1000,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ itemskill "AM_REST",1; },{},{}
    2. 691,Pokebola_vazia,Pokebola Vazia,11,2000,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ itemskill "WZ_ESTIMATION",1; },{},{}
    3. 692,Relampago_Nivel_3,Relampago Nivel 3,11,1000,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ itemskill "WZ_ESTIMATION",1; },{},{}
    複製代碼
    1. 9001,Pokebola,Pokebola,2,20,,0,,,,,,,,,,,,,{ getitem 690,1; },{},{}
    複製代碼
    mob_db2.txt
    新增
    1. 2501,BULBASAUR,Bulbasaur,Bulbasaur,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    2. 2502,IVYSAUR,Ivysaur,Ivysaur,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    3. 2504,CHARMANDER,Charmander,Charmander,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    4. 2505,CHARMELEON,Charmeleon,Charmeleon,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    5. 2506,SQUIRTLE,Squirtle,Squirtle,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    6. 2507,WARTORTLE,Wartortle,Wartortle,24,1109,0,287,176,1,80,135,30,0,1,24,24,5,52,5,10,12,0,4,23,0x3195,200,1564,864,576,0,0,0,0,0,0,0,0,990,70,904,5500,757,57,943,210,7041,100,508,200,625,20,0,0,0,0,4068,1
    複製代碼
    msg_athena.conf
    新增
    1. 718: Seu pokemon esta morto.
    複製代碼

    到此結束了。
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情

    2022-6-12 07:34 PM
  • 簽到天數: 260 天

    連續簽到: 1 天

    [LV.8]以壇為家I

    發表於 2012-1-15 15:02:28 | 顯示全部樓層
    你還真會找 - x - ...
    謝謝你辛苦的轉帖了:tk_01
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    擦汗
    2018-9-15 03:18 PM
  • 簽到天數: 842 天

    連續簽到: 1 天

    [LV.10]以壇為家III

    發表於 2012-1-15 17:25:37 | 顯示全部樓層
    謝謝分享:tk_38

    解個一題
    Qual o numero do artigo das regras que proibe flood?

    答案: 4
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    慵懶
    2017-2-15 05:18 PM
  • 簽到天數: 476 天

    連續簽到: 1 天

    [LV.9]以壇為家II

    發表於 2012-1-22 01:05:47 | 顯示全部樓層
    我比&#36739;好奇的是你是如何&#35775;&#38382;到那&#20010;&#35770;&#22363;抓&#36164;源的- -.
    我自己注&#20876;的&#21495;&#26080;&#26435;&#35775;&#38382;&#35813;&#35770;&#22363;`.
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    開心
    2 小時前
  • 簽到天數: 1323 天

    連續簽到: 1 天

    [LV.10]以壇為家III

    發表於 2012-1-22 01:16:35 | 顯示全部樓層
    回復 5# dreamunreal


        首先你要搬來台灣住 大陸的網路被封很大
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    慵懶
    2017-2-15 05:18 PM
  • 簽到天數: 476 天

    連續簽到: 1 天

    [LV.9]以壇為家II

    發表於 2012-1-22 01:21:34 | 顯示全部樓層
    回復  dreamunreal


        首先你要搬來台灣住 大陸的網路被封很大
    sinya 發表於 2012-1-22 01:16



    = =.....&#36825;&#20010; 我表示&#21387;力很大...&#36825;跨海行&#21160;...
    你家招上&#38376;女婿么0 0?我&#24212;聘~ ..
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    開心
    2021-5-22 05:33 PM
  • 簽到天數: 86 天

    連續簽到: 1 天

    [LV.6]常住居民II

    發表於 2012-1-22 01:27:18 | 顯示全部樓層
    回復 2# 納歐


    你已經經過此方法確認可以無誤使用了嗎
    怕大改後 卻沒看到效果-.-
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    慵懶
    2016-6-9 12:41 PM
  • 簽到天數: 31 天

    連續簽到: 1 天

    [LV.5]常住居民I

     樓主| 發表於 2012-1-22 10:33:56 | 顯示全部樓層
    抱歉沒試過,我只拿他圖片來用而已 :tk_14
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    擦汗
    2014-8-13 07:23 AM
  • 簽到天數: 109 天

    連續簽到: 1 天

    [LV.6]常住居民II

    發表於 2012-2-23 17:20:46 | 顯示全部樓層
    本帖最後由 sense 於 2012-2-23 05:24 PM 編輯

    回復 9# 納歐

    我把他下載下來也上傳到空間了

    雖然我也還沒試過-.-


    下載
    回復 支持 反對

    使用道具 舉報

  • TA的每日心情
    開心
    2023-9-25 11:37 PM
  • 簽到天數: 1686 天

    連續簽到: 1 天

    [LV.Master]伴壇終老

    發表於 2012-3-28 19:44:18 | 顯示全部樓層
    你有個地方打錯

    是    int unhide_timer;

    不是 nt unhide_timer;
    回復 支持 反對

    使用道具 舉報

    您需要登錄後才可以回帖 登錄 | 註冊

    本版積分規則

    Archiver|手機版|小黑屋|OK討論區

    GMT+8, 2024-5-2 05:54 PM , Processed in 0.054502 second(s), 19 queries , Gzip On.

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回復 返回頂部 返回列表