Меню
Расширенное меню


Энциклопедия SW


Партнеры
MYSTALKER - лучший портал по сталкеру! STALKER-FUNS

Опрос
Кто лучше?
Всего ответов: 5489

Статистика

Всего в Баре 1
Новичков 1
Опытных 0

Никого нету

Главная » Статьи » Статьи на сайте

Снятие денег с трупов!
В этой теме я напишу как сделать так что бы можно было снимать деньги с трупов. Нам надо файл treasure_manager.script В этом файле находим такие строки  

--' Юзание инициатора (возможность выдать тайник)
function CTreasure:use(npc)
  printf("TREASURE USE")
После строки --printf("TREASURE USE")-- пишем

if (npc and db.actor) then
   lootmoney.lootmoney(npc)
  end
У нас должно выйти  

--' Юзание инициатора (возможность выдать тайник)
function CTreasure:use(npc)
  printf("TREASURE USE")
   
  if (npc and db.actor) then
   lootmoney.lootmoney(npc)
  end
Теперь создаём файл lootmoney.script и в нём пишем  

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]Мёртвый сталкер: %c[default]"..npc:character_name().."\\n%c[255,255,0,0]Обнаружено денег: %c[default]"..game.translate_string(tostring(deadmoney).."руб.")
     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
теперь создаем файл watcher_act.script и впишем в него  

-- Red75 (c) 2008
-- Marauder scheme v 1.1
-- Part of AMK MOD

evid_see_stuff=6931
evid_near_stuff=evid_see_stuff+1
evid_see_body=evid_see_stuff+2
evid_position_corrected=evid_see_stuff+3

ac tid_reach_item=evid_see_stuff
actid_grab_item=evid_see_stuff+1
actid_grab_body=evid_see_stuff+2
actid_correct_position=evid_see_stuff+3

- - Вызывает closure раз в period, obj[var] хранит время следующего срабатывания
function timed(obj,var,period,closure)
  if obj[var] and obj[var]<time_global() then
   obj[var]=time_global()+period
   closure()
  elseif not obj[var] then
   obj[var]=time_global()+period
--  closure()
  end
end

function trigger_timed(obj,var)
  obj[var]=time_global()
end

local disabled_objects={}

local corpse_checked={} -- true - has loot, false - hasn't loot, nil - not checked

function checkCorpse(obj)
  if (IsStalker(obj) or IsMonster(obj)) and obj:alive()==false then
   if corpse_checked[obj:id()]~=nil then
    return corpse_checked[obj:id()]
   end
   local cnt=0
   obj:iterate_inventory(function (dummy, item)
         if item:section()~="bolt" then
           cnt=cnt+1
         end
    end, nil)
   corpse_checked[obj:id()]=cnt>0
   return corpse_checked[obj:id()]
  end
  return false
end

local valuable_clsid={
     [clsid.art_bast_artefact]=true,
     [clsid.art_black_drops]=true,
     [clsid.art_dummy]=true,
     [clsid.art_electric_ball]=true,
     [clsid.art_faded_ball]=true,
     [clsid.art_galantine]=true,
     [clsid.art_gravi]=true,
     [clsid.art_gravi_black]=true,
     [clsid.art_mercury_ball]=true,
     [clsid.art_needles]=true,
     [clsid.art_rusty_hair]=true,
     [clsid.art_thorn]=true,
     [clsid.art_zuda]=true,
     [clsid.artefact_s]=true,
     [clsid.device_detector_simple]=true,
     [clsid.device_pda]=true,
     [clsid.device_torch_s]=true,
     [clsid.equ_exo]=true,
     [clsid.equ_military]=true,
     [clsid.equ_scientific]=true,
     [clsid.equ_stalker_s]=true,
     [clsid.obj_antirad]=true,
     [clsid.obj_attachable]=true,
     [clsid.obj_bandage]=true,
     [clsid.obj_bolt]=true,
     [clsid.obj_bottle]=true,
     [clsid.obj_food]=true,
     [clsid.obj_medkit]=true,
     [clsid.wpn_ak74_s]=true,
     [clsid.wpn_ammo]=true,
     [clsid.wpn_ammo_m209]=true,
     [clsid.wpn_ammo_og7b]=true,
     [clsid.wpn_ammo_vog25]=true,
     [clsid.wpn_binocular_s]=true,
     [clsid.wpn_bm16_s]=true,
     [clsid.wpn_fn2000]=true,
     [clsid.wpn_fort]=true,
     [clsid.wpn_groza_s]=true,
     [clsid.wpn_hpsa_s]=true,
     [clsid.wpn_knife_s]=true,
     [clsid.wpn_lr300_s]=true,
     [clsid.wpn_pm_s]=true,
     [clsid.wpn_rg6_s]=true,
     [clsid.wpn_rpg7_s]=true,
     [clsid.wpn_scope_s]=true,
     [clsid.wpn_shotgun_s]=true,
     [clsid.wpn_silencer]=true,
     [clsid.wpn_svd_s]=true,
     [clsid.wpn_svu_s]=true,
     [clsid.wpn_usp45_s]=true,
     [clsid.wpn_val_s]=true,
     [clsid.wpn_vintorez_s]=true,
     [clsid.wpn_walther_s]=true,
     [clsid.wpn_wmagaz]=true,
     [clsid.wpn_wmaggl]=true
}

local obj_owner={}

function bgwith(str,ptr)
  local ps=string.find(str,ptr)
  return ps~=nil and ps==1
end

function isValuable(obj)
  local sec=obj:section()
   if sec=="amk_metka" then
     return false,false
   end
  if valuable_clsid[obj:clsid()] then
   return true, false
  end
  return bgwith(sec,"af_") or bgwith(sec,"ammo_") or bgwith(sec,"wpn_") or bgwith(sec,"energy_") or checkCorpse(obj), IsStalker(obj) or IsMonster(obj)
end

function objValue(obj)
  local sec=obj:section()
   local multiplier=1
   if bgwith(sec,"ammo_") then
     multiplier=30
   elseif sec=="vodka" then
     multiplier=20
   end
  if system_ini():section_exist(sec) and system_ini():line_exist(sec,"cost") then
   return system_ini():r_float(sec,"cost")*multiplier
  end
  return 0
end

function claimGObject(npc,st,obj)
  if st.grabitemid then
   obj_owner[st.grabitemid]=nil
  end
  st.grabitemid=obj:id()
  obj_owner[obj:id()]=npc:id()
end

function freeGObject(st)
  if st.grabitemid then
   obj_owner[st.grabitemid]=nil
   st.grabitemid=nil
  end
end

function clearGObject(st)
  st.grabitemid=nil
end

function getGObject(st)
  if st.grabitemid then
   local ret=level.object_by_id(st.grabitemid)
   if ret==nil then
    st.grabitemid=nil
   end
Категория: Статьи на сайте | Добавил: Стрел{ОК} (24.02.2011)
Просмотров: 1486 | Комментарии: 1
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]