ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Geting npc visual and forcing npc into animation.

« Previous 10 events | 1 2 | All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:27:56  22 August 2013
profilee-mailreply Message URLTo the Top
Xetrill
(Senior)
 
On forum: 07/08/2008
Messages: 129
Instead of
"local math = math"
do
"local mrand = math.random"
And put it at the top of the file, not inside a function, not inside any conditions.
Like you are using it now, it doesn't provide any benefit at all, it's worse actually. Lua now has to track the local too while still required to do a global lookup each time the function is called.

Instead of
"if (bone_index == 34 or bone_index == 35 or bone_index == 36) then"
do
"if bone_index >= 34 and bone_index <= 36 then"
Less work is always better, no work is best.

Okay, it's late so I'm gonna leave it at that, but there are very good resources online.
http://lua-users.org/wiki/OptimisationTips
http://wiki.luajit.org/Home#Performance-Tuning-and-Testing
  22:53:28  23 August 2013
profilee-mailreply Message URLTo the Top
Reisen
(Novice)
 
On forum: 02/09/2012
 

Message edited by:
Reisen
08/24/2013 16:05:45
Messages: 26
Ok, I spend close to 10 hours since yesterday trying to make it work but I cant.

Edit: I finally made it work (at least part that suppose to detect, who, shot whom and with what weapon.

This is what I have now, I think (hope) it will work fine.

if bone_index == 2 or bone_index == 3 or bone_index == 7 or bone_index == 20 or bone_index == 21 or bone_index == 33 or bone_index == 34 or (bone_index >= 11 and bone_index <=14) then

say1 = "1 - weapon"

local npc_id = obj
local IA = who:active_item()
local IAS = IA:section()
local group_1 = {wpn_fort = true, wpn_pm = true, wpn_beretta = true, wpn_colt1911 = true}

if npc_id ~= nil then
local who = my_script.who_hit_npc_last(npc_id)
end

if IAS ~= nil and group_1[IAS] then
say1 = IAS
end
news_manager.send_tip(db.actor, say1, nil, nil, 2000)
end

@Smoq2 so now I am waiting for "packet_utils21.script" modified for CS you promised to reupload.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.