Сповіщення
Очистити все

Складний квест на оборону табору. Частина 2


Ранг:
Майстер
Роль:
Гість
Записи:
752
Приєднався:
2 роки тому
 

Логіка

Тут така проблема. Шість файлів логіки – це надто багато, нормальні люди так не роблять. Значить, що? Значить треба колупати all.spawn і вже там прописувати логіку. (Але це поки що лише досліджується). Поки що - можна прописати вбити лише одного - тобто. ватажка.

Відкриваємо gamedata\config\scripts і там створимо 6 файлів логіки:

1-й файл логіки - esc_bandit_ataka_1 , в ньому пишемо:

 
[ logic ]
 active = remark@search 
on_death = death
 
[ death ]
 on_info =  %+esc_bandit_ataka_1_dead%
 
[ remark@fire ]
 combat_ignore_cond = { !is_sniper_enemy } radius = 0 anim = hide on_info = { =health_le ( 0.5 ) }  
 

 
remark@search
wounded = wounded@work 
sniper = true
 
[ remark@search ]
 combat_ignore_cond = true 
combat_ignore_keep_when_attacked = false 
anim = hide 
target = actor 
on_info = { =see_enemy } 
remark@fire
wounded = wounded@work
 
[ smart_terrains ]
 none = true
 
[
 wounded @ work ] hp_state = 0 | wounded_heavy @ help_heavy hp_state_see = 0 | wounded_heavy @ help_heavy hp_victim = 0 | 
 
 
 
 
 

Інші файли створюються з аналогічним змістом, але в назві змінюється цифра на наступну і в

[ death ]
 on_info =  %+esc_bandit_ataka_1_dead%

також міняється цифра на номер наступного профілю.

Діалоги

Відкриваємо dialogs_new.xml , і в ньому пишемо між <game_dialogs> і </game_dialogs>:

<dialog  id = "esc_ataka_2" > 
           <has_info > ataka_done </has_info >
            <dont_has_info > ataka_ok </dont_has_info >
        <phrase_list >
            <phrase  id = "0" > 
               <text > Болк, ну ти як живий? </text >
                <next > 1 </next >
            </phrase >
            <phrase  id = "1" > 
               <text > Так, Xa-xa, як ми їх? </text >
                <next > 2 </next >
            </phrase >
            <phrase  id = "2" > 
               <text > Плохо, друг мій, плоксо... </text >
                <next > 3 </next >
            </ phrase >
            <phrase  id = "3" > 
               <text > Бат спасибі тобі... Бат, держи, чим багатий... </text >
                <action > new_dialog.ataka_reward </action >
                <next > 4 </next >
            </phrase >
            <phrase  id = "4" > 
               <text > Спасибі! </text >
                <give_info > ataka_ok </give_info >
                <action > dialogs.break_dialog </action >
            </phrase > < 
       / phrase_list >
    </dialog >
    <dialog  id = "esc_ataka_1" > 
           <dont_has_info > ataka_start </dont_has_info 
       <phrase_list>
            < phrase  id = 
               " 0 " > <text> а що ти весь тремтиш? </text >
                <next > 1 </next >
            </phrase >
            <phrase  id = "1" > 
               <text > Так з хвилини на хвилину бандити нападуть... </text >
                <next > 2 </next >
            < /phrase >
            <phrase  id ="2" > 
               <text > Я тобі допоможе відбитись, добре? </text >
                <next > 3 </next >
            </phrase >
            <phrase  id = "3" > 
               <text > Bot спасибі тобі Мечений, вік дякую! </text >
                <next > 4 </next >
            </phrase >
            <phrase  id = "4" > 
               <text > Досить соплі припустити, з хвилини на хвилину бандити підійде! </text >
                <give_info > ataka_start </give_info >
                <action > new_dialog.esc_bandit_ataka_1< / action >
                <action > new_dialog.esc_bandit_ataka_2 </action 
               > < action > new_dialog.esc_bandit_ataka_3 < /action > action > <action > new_dialog.esc_bandit_ataka_5 </action > <action > new_dialog.esc_bandit_ataka_6 </action > <action > dialogs.break_dialog </action > </phrase > </phrase_list > </dialog > </game_dialogs >
               
               
               
               
           
       
   

 

Відкриваємо character_desc_escape.xml шукаємо

   <specific_character  id = "esc_wolf" team_default = "1" >

і після

      <actor_dialog > tm_wolf_reward </actor_dialog >

вставляємо

      <actor_dialog > esc_ataka_2 </actor_dialog >
       <actor_dialog > esc_ataka_1 </actor_dialog >      
 

Додавання до ПДA

Відкриваємо tasks_new.xml і в ньому пишемо:

   <game_task  id = "ataka_bandit" > 
      <title > Допомога Bolky </title >
       <objective >
          <text > Допомога Bolky </text > 
          <icon > ui_iconsTotal_kill_stalker </icon  
         > < infoportion_complete > 
      ataka_ok > < / 
      infoion objective >
          <text > Відбитись від атаки бандитів. </text > 
          <icon  height = "50" > ui\ui_icons_task < / icon 
          > < function_complete > new_dialog.bandit_atack_precon </function_complete > 
                      < infoportion_set_complete > ataka_done < / infoportion_set_complete >
       >
       . </text > <map_location_type hint = "Болк" > blue_location </map_location_type > <object_story_id > Escape_novice_lager_volk </object_story_id > <infoportion_complete > ataka_ok </infoportion_complete > < /objective > </game_ta
          
                      
                     
         
      
   

Інфопоршни

Відкриваємо info_new.xml і між <game_information_portions> і </game_information_portions> пишемо:

   <info_portion  id = "ataka_start" >  
      <task > ataka_bandit </task >
    </info_portion > 
 
   <info_portion  id = "ataka_done" > </info_portion >
    <info_portion  id = "ataka_ok" > </info_portion >
 
   <info_portion  id = "esc_bandit_ataka_1_dead" > </info_portion 
   > < info_portion  id = " esc_bandit_ataka_2_dead " > < / 
   info_portion > <info_portion id = "esc_bandit_ataka_3_dead" > < /info_portion > " ion > < info_portion id = "esc_bandit_ataka_5_dead" > </info_portion > <info_portion id = "esc_bandit_ataka_6_dead" > </info_portion > 
    
    
    

Відкриваємо папки gamedata/scripts , знаходимо файл з назвою new_dialog.script , а в ньому пишемо:

 
function esc_bandit_ataka_1 ( ) 
   alife ( ) : create ( " esc_bandit_ataka_1 " esc_bandit_ataka_2 " , vector _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   _ _ _ _ _ _ _ ( ) : 
   set ( -141.80 , -14.23 , -123.79 ) , 107755 , 70 ) end function .79 ) , _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 107755 , 70 ) end function esc_bandit_ataka_4 ( ) 
   alife ( ) : create ( " esc_bandit_ataka_4 " 5 ( ) alife ( ) : create ( _ _ _ _ _ _ _ _ _ 
   _ _ _ _ _ " esc_bandit_ataka_5 " 
   , vector ( ) : set ( -141.80 , -14.23 , -123.79 ) , 107755 , 70 ) end function 80 , -14.23 _ _ _ _ _ _ _ _ _ _ , -123.79 ) , 107755 , 70 ) end










 
 
 
function bandit_atack_precon ( task , info )  
   if  ( db.actor:has_info ( "esc_bandit_ataka_1_dead" 
    ) and db.actor:has_info  ( 
    " esc_bandit_ataka_2_dead " ) and  db.actor:has_info 
    ( " esc_bandit_ad bandit_ataka_4_dead " ) and 
    db.actor:has_info ( "esc_bandit_ataka_5_dead" ) and 
    db.actor:has_info ( "esc_bandit_ataka_6_dead" ) ) then return db.actor:give_info_portion ( "ataka_done" ) end return false end    
    
 
  
 
 
function ataka_reward ( first_speaker , second_speaker )  
   dialogs.relocate_money ( second_speaker, 10000 , "in" ) 
end  
 

Все, вітаю, ви написали новий квэст! Він буде у Булку. Бажано його виконувати після квеста з флешкою ​​Шистрого!

 

Примітка від Re]Spawner

Я дуже поважаю урок! Дякую!
Але за діалогу є один недолік - не дуже важливий, але гравець через нього може отримати стільки грошей, скільки захоче. Дивимося:

<dialog  id = "esc_ataka_2" > 
           <has_info > ataka_done </has_info >
            <dont_has_info > ataka_ok </dont_has_info >
        <phrase_list >
            <phrase  id = "0" > 
               <text > Болк, ну ти як живий? </text >
                <next > 1 </next >
            </phrase >
            <phrase  id = "1" > 
               <text > Так, Xa-xa, як ми їх? </text >
                <next > 2 </next >
            </phrase >
            <phrase  id = "2" > 
               <text > Плохо, друг мій, плоксо... </text >
                <next > 3 </next >
            </ phrase >
            <phrase  id = "3" > 
               <text > Бат спасибі тобі... Бат, держи, чим багатий... </text >
                <action > new_dialog.ataka_reward </action >
                <next > 4 </next >
            </phrase >
            <phrase  id = "4" > 
               <text > Спасибі! </text >
                <give_info > ataka_ok </give_info >
                <action > dialogs.break_dialog </action >
            </phrase >
        </phrase_list >
    </dialog >

Недолік тут:

     <action > new_dialog.ataka_reward </action >

Він поставлений не в кінці діалогу, тому гравець поговорить з вовком, отримає гроші, але не закінчить діалог, а вийде і знову прокрутить діалог, отримуючи ще 5 тисяч. І так до безкінечності! Тому, роблячи такі місії, прибрав би його і поставив сюди:

<phrase  id = "4" > 
               <text > Спасибі! </text >
                <give_info > ataka_ok </give_info >
                <action > new_dialog.ataka_reward </action >
                <action > dialogs.break_dialog </action >
            </phrase >
        </phrase_list >
    </dialog >

Дякуємо за увагу всім удачі в модобудуванні!


   
Цитата