ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Loading a custom table name issue, called from logic

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  16:11:33  9 November 2018
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070
Loading a custom table name issue, called from logic

I have a spawn table in xr_effects like this...


---QUOTATION---


local faction_ecolog =
-- Count Possible = 5

{
"ecolog_new_novice", -- Novice Starts/Ends
"ecolog_new_regular", -- Regular Starts/Ends
"ecolog_new_veteran", -- Veteran Starts/Ends
"ecolog_new_master", -- Master Starts/Ends

"yan_ecolog_respawn_1" -- Default Ecolog
}


---END QUOTATION---



And also in xr_effects for logic support:


---QUOTATION---


-- Usage %=create_table_min_max_path_index_amount(faction_ecolog:5:5:val_way_if_reject_to_gar:1:3)%

function create_table_min_max_path_index_amount(actor, npc, p)

if p and p[1] and p[2] and p[3] and p[4] and p[5] and p[6] then

news_manager.send_tip(db.actor, "P1="..tostring(p[1]), nil, nil, 7000)
news_manager.send_tip(db.actor, "P2="..tostring(p[2]), nil, nil, 8000)
news_manager.send_tip(db.actor, "P3="..tostring(p[3]), nil, nil, 9000)
news_manager.send_tip(db.actor, "P4="..tostring(p[4]), nil, nil, 10000)
news_manager.send_tip(db.actor, "P5="..tostring(p[5]), nil, nil, 11000)
news_manager.send_tip(db.actor, "P6="..tostring(p[6]), nil, nil, 12000)

local table_name = p[1]
local min_size = p[2] or 1
local max_size = p[3] or 1

local path_name = p[4]
if path_name == nil then
abort("Wrong path_name for 'create_table_min_max_path_index_amount' function %s. For object %s", tostring(path_name), obj:name())
end

if not level.patrol_path_exists(path_name) then
abort("Path %s doesnt exist. Function 'create_table_min_max_path_index_amount' for object %s ", tostring(path_name), obj:name())
end
local ptr = patrol(path_name)

local index = p[5] or 0
local value = tonumber(p[6])
if value then
local table_bandit_index
for table_bandit_index = 1,value, 1 do


local x = alife():create(table_name[math.random(min_size,max_size)],
ptr oint(index),
ptr:level_vertex_id(0),
ptr:game_vertex_id(0))
end
end
end
end


---END QUOTATION---



On a space restrictor i have:


---QUOTATION---


[sr_idle@whatever]
on_info = nil %=create_table_min_max_path_index_amount(faction_ecolog:5:5:val_way_if_reject_to_gar:1:3)%


---END QUOTATION---



This is supposed to execute the table with name "faction_ecolog" with the last size variation possible 5 out of 5 "yan_ecolog_respawn_1" on path name "val_way_if_reject_to_gar", subpoint 1... and spawn 3 npcs.

The game doesnt crash and no "white errors" in console, but it doesn't create the npcs.

The "table_name" is not executed, here:


---QUOTATION---


alife():create(table_name[math.random(min_size,max_size)],


---END QUOTATION---



Any Idea? Thanks in advance.
  08:48:09  18 November 2018
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4303
It might be a scope problem. Try removing the "local" qualifier from the faction_ecolog table declaration, and changing this:

%=create_table_min_max_path_index_amount(faction_ecolog:5:5:val_way_if_reject_to_gar:1:3)%

to this:

%=create_table_min_max_path_index_amount(xr_effects.faction_ecolog:5:5:val_way_if_reject_to_gar:1:3)%

There may be other major issues; the above is just the first thing I would try.
  01:34:30  19 November 2018
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070
Sorry NatVac, i had to clear my browser and its hard to see new replays in forums. I managed to solve this by doing something like this:


---QUOTATION---


if table_name == "faction_ecolog" then
local table_bandit_index
for table_bandit_index = 1,value, 1 do
local x = alife():create(faction_ecolog[math.random(min_size,max_size)],ptr oint(index),ptr:level_vertex_id(0),ptr:game_vertex_id(0))
end -- for table...
end -- if table ==


---END QUOTATION---



And it works ok, but later i will try your idea.

Thank you NatVac.
 
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.: Shadow of Chernobyl Forum » Mod discussion
 

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


 

Copyright © 1995-2022 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.