RafMadMan 85 Опубликовано 11 Июня 2015 Critical hit (SoC). First you must create a file effect_blood.script and then write like this: lite_treshold = 0.05 --'how much health must decrease from the last update, to make screen become red crit_treshold = 0.30 --'how much health must decrease from the last update, to make actor shake drop_item_on_crit_prob = 0.20 --'a chance that actor will drop his weapon effector_power_coeff = 0.7 prev_health = -1 function wounded_pp_update() if prev_health > (db.actor.health + lite_treshold) then level.add_pp_effector("fire_hit.ppe", 2011, false) local effector_power = (prev_health - db.actor.health)*100*effector_power_coeff level.set_pp_effector_factor(2011, effector_power) if prev_health > db.actor.health + crit_treshold then level.add_cam_effector("camera_effects\\fusker.anm", 999, false, "") local snd_obj = xr_sound.get_safe_sound_object([[actor\pain_3]]) snd_obj:play_no_feedback(db.actor, sound_object.s2d, 0, vector(), 1.0) if math.random() < drop_item_on_crit_prob then local active_item = db.actor:active_item() if active_item and active_item:section() ~= "bolt" and active_item:section()~= "wpn_knife" then db.actor:drop_item(active_item) end end end prev_health = db.actor.health end end Then we open bind_stalker.script and into the function function actor_binder:update(delta) object_binder.update(self, delta) local time = time_global() game_stats.update (delta, self.object)we add this effect_blood.wounded_pp_update() That's all folks! Translaton: @RafMadMan P.S. Taken from Stalkerinside. And sorry for my not perfect English. Getting money from corpses (SoC). First we need a file treasure_manager.script . Let's find this: --' Using of initiator (a chance to give out a hiding-place) function CTreasure:use(npc) printf("TREASURE USE") After line printf("TREASURE USE") we write this if (npc and db.actor) then lootmoney.lootmoney(npc) end We should get --' Using of initiator (a chance to give out a hiding-place) function CTreasure:use(npc) printf("TREASURE USE") if (npc and db.actor) then lootmoney.lootmoney(npc) end After it we save changes and create file lootmoney.script and we write in it this function lootmoney(npc) if npc ~= nil and not string.find(npc:section(),"arena") and npc:character_community()~="arena_enemy" then local money = npc:money() if money ~= nil and money ~=0 then local deadmoney = money local npc_rank npc_rank = ranks.get_obj_rank_name(npc) if npc_rank ~= nil then if npc_rank == "novice" and deadmoney >=400 then deadmoney=math.random(25,400) elseif npc_rank == "experienced" and deadmoney >=500 then deadmoney=math.random(50,500) elseif npc_rank == "veteran" and deadmoney >=600 then deadmoney=math.random(100,600) elseif npc_rank == "master" and deadmoney >=700 then deadmoney=math.random(200,700) end end local news_texti = "\\n%c[255,255,0,0]Dead stalker: %c[default]"..npc:character_name().."\\n%c[255,255,0,0]Money found: %c[default]"..game.translate_string(tostring(deadmoney).."RU") db.actor:give_game_news(news_texti, "ui\\ui_iconsTotal", Frect():set(0,0,83,47), 1, 4000) db.actor:give_money(deadmoney) game_stats.money_quest_update(deadmoney) npc:give_money(-money) game_stats.money_quest_update(-money) end end end And after it save changes in the file. That's all! Translation and editing : @RafMadMan P.S. Taken from Stalkerinside. And sorry for my not perfect English. 1 1 Поделиться этим сообщением Ссылка на сообщение
RafMadMan 85 Опубликовано 15 Июня 2015 Cigarette addiction (SoC). First we need these files (AMK Mod): config/misc/items.ltx config/text/rus/string_table_enc_equipment.xml scripts/amk.script script/amk_mod.script 1) We create file your_script_name.script in folder gamedata/scripts and write in it this: snd = sound_object([[ambient\underground\rnd_giant]]) -- Check if we need to smoke. It calls out every 6 game minutes function test_for_need_kur() amk.save_variable("kur",amk.load_variable("kur",0)+1) amk.g_start_timer("kur",0,0,6) kur_reduce_health() end -- Health decrease, if actor hasn`t smoke for a long time function kur_reduce_health() local tmp = amk.load_variable("kur",0) if tmp > 150 then if db.actor.health > 0.15 then db.actor.health = - 0.15 end if not snd:playing() then snd:play_at_pos(db.actor, vector():set(0,0,0), 0, sound_object.s2d) end end end -- Smoking function kur_item(oid, time) if alife():object(oid)==nil then local tmp = amk.load_variable("kur",0) - time*10 if tmp < 0 then tmp = 0 end amk.save_variable("kur", tmp) kur_reduce_health() end end 2) We open file amk.script and after: function __do_timer_action(select_string,params_string) we write: if select_string=="kur" then your_script_name.test_for_need_kur() end 3) We open file amk_mod.script and in the function first_run we write amk.g_start_timer("kur",0,0,6) then in function check_sleep_item(obj) after elseif section=="treasure_item" then stype="tr_item" but before end we write this: elseif section == "sigaret" then stype = "sgr" 4) We open file items.ltx and in the end of the file we write this: [sigaret]:identity_immunities GroupControlSection = spawn_group discovery_dependency = $spawn = "food and drugs\antirad" $prefetch = 32 class = II_ANTIR cform = skeleton visual = weapons\sigaret\sigaret.ogf inv_name = sigareta inv_name_short = sigareta description = enc_food_sigareta inv_weight = 0.02 inv_grid_width = 1 inv_grid_height = 2 inv_grid_x = 10 inv_grid_y = 24 cost = 50 ; eatable item eat_health = 0 eat_satiety = 0 eat_power = 0 eat_radiation = 0 eat_alcohol = 0 wounds_heal_perc = 0 eat_portions_num = 1 ; food item animation_slot = 4 ;hud item hud = wpn_vodka_hud 5) We open file string_table_enc_equipment.xml in the end we write this: <string id="sigareta"> <text>Box of cigarettes</text> </string> <string id="enc_food_sigareta"> <text>Here you can write your own description of the cigarettes.</text> </string> Then we save changes and Cigarette addiction is ready for using in the game! That's all!Translation and editing : RafMadManP.S. Taken from Stalkerinside. And sorry for my not perfect English. 2 Поделиться этим сообщением Ссылка на сообщение
RafMadMan 85 Опубликовано 20 Июня 2015 (изменено) Universal repair kit. First we open file gamefata/config/misc/items.ltx and in its end we write this: ;-------------------------------------------------------------------------------Repair kit [repair_kit]:identity_immunities GroupControlSection = spawn_group discovery_dependency = $spawn = "devices\quest_items\repair_kit" $prefetch = 32 class = II_ANTIR cform = skeleton visual = physics\box\box_1c.ogf radius = 1 description = repair_kit_desc inv_name = repair_kit_name inv_name_short = repair_kit_name inv_weight = 3.0 inv_grid_width = 2 inv_grid_height = 2 inv_grid_x = 4 inv_grid_y = 18 cost = 500 eat_health = 0 eat_satiety = 0 eat_power = 0 eat_radiation = 0 eat_alcohol = 0 wounds_heal_perc = 0 eat_portions_num = 3 animation_slot = 4 Then we save changes and open file gamedata/config/text/rus/string_table_enc_equipment.xml and in the end of it, but before </string_table> we write this: <string id="repair_kit_name"> <text>Universal repair kit</text> </string> <string id="repair_kit_desc"> <text>Your description of the repair kit</text> </string> Then we save changes and open file gamedata/scripts/bind_stalker.script and after these lines: function actor_binder:on_item_drop (obj) level_tasks.proceed(self.object) --game_stats.update_drop_item (obj, self.object) we write this: exp_mod.itemuse(obj) -- Repair Kit Then we save changes and in this folder we create file exp|_mod.script and in it we write this: --Script from NZK mod --by zek ------------------------------------------------------------------------ --- Script of using things straight from invertory (In this case - using of the repair kit) --- Work with bind_stalker.script/actor_binder:on_item_drop/ ------------------------------------------------------------------------ function itemuse(what) local obj_name = what:name() if (string.find(obj_name, "repair_kit")) then use_repair_kit(what) -- If you want to add new trigger item, add script this line. end end ------------------------------------------------------------------------ --- The process of using of the repair kit ------------------------------------------------------------------------ function use_repair_kit(what) local repair_slot_num = 0 local item_in_slot_1 = db.actor:item_in_slot(1) local item_in_slot_2 = db.actor:item_in_slot(2) local item_in_slot_6 = db.actor:item_in_slot(6) if (item_in_slot_1 ~= nil) then repair_slot_num = 1 end if (item_in_slot_2 ~= nil) then if (repair_slot_num == 0) then repair_slot_num = 2 elseif (repair_slot_num == 1) then if (item_in_slot_1:condition() > item_in_slot_2:condition()) then repair_slot_num = 2 end end end if (item_in_slot_6 ~= nil) then if (repair_slot_num == 0) then repair_slot_num = 6 elseif (repair_slot_num == 1) then if (item_in_slot_1:condition() > item_in_slot_6:condition()) then repair_slot_num = 6 end elseif (repair_slot_num == 2) then if (item_in_slot_2:condition() > item_in_slot_6:condition()) then repair_slot_num = 6 end end end if (repair_slot_num == 1) then local rep_point = item_in_slot_1:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_1:set_condition(rep_point) elseif (repair_slot_num == 2) then local rep_point = item_in_slot_2:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_2:set_condition(rep_point) elseif (repair_slot_num == 6) then local rep_point = item_in_slot_6:condition() + 10 if (rep_point > 1) then rep_point = 1 end item_in_slot_6:set_condition(rep_point) end end That is all! Now we can add it to some trader. (It will be in another lesson.) That's all!Translation and editing : RafMadManP.S. Taken from Stalkerinside. Изменено 20 Июня 2015 пользователем RafMadMan 1 1 Поделиться этим сообщением Ссылка на сообщение
RafMadMan 85 Опубликовано 14 Октября 2015 (изменено) How to create your first quest? Creation of simple dialog.Let‘s start the process of creation of our quest from creating a small dialog. We open file gamedata\config\gameplay\character_desc_escape.xml and do this:- find string <actor_dialog>escape_trader_done_blockpost_box</actor_dialog> - and add after it a new one - <actor_dialog>escape_trader_oops</actor_dialog> - then we save changes.We have just added a new dialog branch to trader "Sidorovich", but not even a branch - just a link on it. The structure of the dialog is situated in file gamedata\config\gameplay\dialogs_escape.xml whicj we open and do this:- we find some free space between </dialog> and <dialog id="..."> - and add there a such construction: <dialog id="escape_trader_oops"> <precondition>escape_dialog.trader_alredy_give_job</precondition> <has_info>tutorial_end</has_info> <phrase_list> <phrase id="0"> <text>escape_trader_oops_0</text> <next>1</next> </phrase> <phrase id="1"> <text>escape_trader_oops_1</text> <next>2</next> </phrase> <phrase id="2"> <text>escape_trader_oops_2</text> <next>3</next> </phrase> <phrase id="3"> <text>escape_trader_oops_3</text> </phrase> </phrase_list> </dialog> - and save changes. Now we have a structure of a new dialog branch. But we have to do one more thing - to write strings, which actor will see in game instead of escape_trader_oops_....For it let‘s open a file gamedata\config\text\rus\stable_dialogs_escape.xml and do this:- find some free space between </string> и <string id="..."> - and write there such strings: <string id="escape_trader_oops_0"> <text>Hey, sidor, we can talk about... vodka?</text> </string> <string id="escape_trader_oops_1"> <text>Vodka? Are you kidding me? I have no vodka! But I remember that Wolf had hidden some on attic... Can you get it for me?</text> </string> <string id="escape_trader_oops_2"> <text>All right, then... I‘ll find some.</text> </string> <string id="escape_trader_oops_3"> <text>Go, go...</text> </string> - save changes.So now we have a dialog. We can strat the game and test it. But now we have to "pin" a quest to this dialog. Creation of quest.To "pin" activation of quest to a dialog is very easy. Just open file gamedata\config\gameplay\dialogs_escape.xml and do this:- let‘s change the content of <phrase id="2"> in this way: <phrase id="2"> <text>escape_trader_oops_2</text> <give_info>quest_vodka_started</give_info> <next>3</next> </phrase> - and save changes.Now, after Gunslinger says: "All right, then... I‘ll find some." trader Sidorovich gives us a quest "Bring vodka". But don‘t hurry to test changes. We have only added a reference about our quest, though we didin‘t create it. Let‘s fix this mistake. Open file gamedata\config\gameplay\tasks_escape.xml and in the begining of the file add this: <game_task id="esc_test_vodka_task"> <title>Bring vodka</title> <!-- name of the quest --> <objective> <text>Bring vodka to trader</text> <icon>ui_iconsTotal_find_item</icon> <infoportion_complete>test_quest_vodka_given</infoportion_complete> </objective> <objective> <text>Return with vodka to trader</text> <map_location_type hint="esc_dinamit_to_volk">green_location</map_location_type> <object_story_id>Escape_novice_lager_volk</object_story_id> <infoportion_complete>test_quest_vodka_given</infoportion_complete> </objective> <objective> <text>Find vodka on the attic</text> <map_location_type hint="escape_trader">blue_location</map_location_type> <object_story_id>Escape_Trader</object_story_id> <infoportion_complete>test_quest_vodka_given</infoportion_complete> </objective> </game_task> We have just wriiten the data of quest: icons, names of it parts, loction of markers and so on. We will return to this file in future, because a lot of things in it were made quickly and we didn‘t pay enough attention to it. I dont‘ know how to make the quest "Return with vodka to trader" appear in PDA, but i think it is not so bad - it works and we have no problems with the game. Let‘s continue. Let‘s open file gamedata\config\gameplay\info_l01escape.xml and registrate in it some new infoportions(we will use them to start and to complete the quest). - after string <game_information_portions> write this: <info_portion id="test_quest_vodka_given"></info_portion> <info_portion id="quest_vodka_started"> <task>esc_test_vodka_task</task> </info_portion> <info_portion id="dont_want_to_bring_vodka"></info_portion> That is all with infoportions.Now let‘s make some "small" but very important things - tips on the screen, which we can see when we start/end the quest. For it let‘s open a file gamedata\config\text\rus\string_table_tasks_escape.xml and write this: <string id="esc_test_bring_vodku"> <text>Bring vodka</text> </string> <string id="esc_test_bring_vodku_1"> <text>Find vodka on the attic</text> </string> <string id="esc_test_bring_vodku_2"> <text>Bring vodka to trader</text> </string> Now we can test it. Now we can begin the third part. We forgot to give player ability to complete the quest. Realization of ability to complete the quest.It is no so hard as it seems. All conditions are already created, now we only have to use them in the dialog. Let‘s change it: make it structure more branched and functional: 0. Hey, sidor, we can talk about... vodka? (switch-over to 1)1. Vodka? Are you kidding me? I have no vodka! But I remember that Wolf had hidden some on attic... Can you get it for me? (choice - switch-over to 2,4,5; initially we can use only 2)2. All right, then... I‘ll find some. (we start the quest , switch-over to 3, after this frase it disappears)3. Go, go... (the end of the dialog)4. Here is it!(appears only if actor has vodka in invertory, when you choose this answer vodka "carries" to trader, quest completes, switch-over to 7)5. Sorry, but i have no vodka... Can you wait some more?(appears only if we start the quest, switch-over to 6)6. Get out of here! Don‘t come back without vodka!!!(switch-over to 8)7. Oh, God... Yes, yes, now give it to me! Thank you, here is your reward.(gives player a reward, switch-over to 8)8. Fuck you!(the end of the dialog) That‘s how it looks in file gamedata\config\gameplay\dialogs_escape.xml: <dialog id="escape_trader_oops"> <precondition>escape_dialog.trader_alredy_give_job</precondition> <has_info>tutorial_end</has_info> <phrase_list> <phrase id="0"> <text>escape_trader_oops_0</text> <next>1</next> </phrase> <phrase id="1"> <text>escape_trader_oops_1</text> <next>2</next> <next>4</next> <next>5</next> </phrase> <phrase id="2"> <dont_has_info>quest_vodka_started</dont_has_info> <text>escape_trader_oops_2</text> <give_info>quest_vodka_started</give_info> <next>3</next> </phrase> <phrase id="3"> <text>escape_trader_oops_3</text> <action>dialogs.break_dialog</action> </phrase> <phrase id="4"> <text>escape_trader_oops_4</text> <precondition>escape_dialog.have_a_vodka</precondition> <action>escape_dialog.give_vodku</action> <next>7</next> </phrase> <phrase id="5"> <has_info>kvest_vodka_started</has_info> <text>escape_trader_oops_5</text> <next>6</next> </phrase> <phrase id="6"> <text>escape_trader_oops_6</text> <next>8</next> </phrase> <phrase id="7"> <text>escape_trader_oops_7</text> <give_info>test_quest_vodka_given</give_info> <action>escape_dialog.transfer_deneg</action> <next>8</next> </phrase> <phrase id="8"> <text>escape_trader_oops_8</text> </phrase> </phrase_list> </dialog> Now let‘s add to games such scripts as "giving money" and "giving vodka". Open file gamedata\scripts\escape_dialog.script and before separator(delimiter) Trader add such strings: function transfer_deneg(first_speaker, second_speaker) dialogs.relocate_money(second_speaker, 4000, "in") end function give_vodku (npc, actor) dialogs.relocate_item_section(npc, "vodka", "out") end function have_a_vodka (stalker, player) return stalker:object ("vodka") ~= nil end That‘s all! Now we can test our quest in game! Addition.If we change th e begining of our dialog in dialogs_escape.xml to this(code below), our branch wiil disappear after we complete the quest: <dialog id="escape_trader_oops"> <precondition>escape_dialog.trader_alredy_give_job</precondition> <has_info>tutorial_end</has_info> <dont_has_info>test_quest_vodka_given</dont_has_info> <phrase_list> But I didn‘t test it, so beware :^) That's all!Translation and editing : RafMadManP.S. Taken from Stalkerinside. And sorry for my not perfect English. If you have some problems with it - write me, may be I had made some mistakes in code/words. Изменено 14 Октября 2015 пользователем RafMadMan 3 Поделиться этим сообщением Ссылка на сообщение