ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
[PoC] Progressive weapons

« Previous 10 events | 1 2 3 4 5 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  19:23:13  5 November 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133
This is an excellent mod, and has some very well-done scripting, but the way it handles the exchanging of weapons is too generalized for what I am currently trying to accomplish.

The script I am working on is a system that exchanges a specific weapon for another specific weapon when an item is used, it is more or less, a primitive upgrading system.

Right now it is being used to convert standard weapons to be able to mount night vision optics, but the principle of this could be adapted to other purposes.

I still haven't gotten this working yet, because whenever I include the wpn_mod.itemuse(obj) in the bind_stalker.script under the actor binder for item drop. It CTDs with this error.

FATAL ERROR

[error]Expression : fatal error
[error]Function : CScriptEngine::lua_error
[error]File : E:\stalker\patch_1_0004\xr_3da\xrGame\script_engine.cpp
[error]Line : 73
[error]Description : <no expression>
[error]Arguments : LUA error: ...ow of chernobyl\gamedata\scripts\bind_stalker.script:197: attempt to index global 'wpn_mod' (a nil value)

For now I have the functionality of the conversion kit commented out, but here's the part of the wpn_mod.script that I altered, if anyone wants to have a look.

http://pastebin.com/FcMEBMfA

In a week or so I'll come up with a version over vanilla with dynamic shaders, for people that want to test it out or mess around with it.

How this system works is that each weapon has a base state, and 2 upgraded states, the kit is supposed to exchange the base weapon in the slot with the upgraded weapon in the slot, and the tier 1 upgrade can also be switched out for a tier 2 weapon.

The object that initializes it is the nv_kit, and there are 2 tiers of these, the first only upgrades the base weapon, and the second can upgrade (or rather exchange) both weapons for a third one.
  20:27:31  5 November 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735
@ FatalFunnel The syntax in your pastebin is either unfamiliar to me or wrong - or both Do you have an example of the script you used as your working example?
  21:41:12  5 November 2012
profilee-mailreply Message URLTo the Top
gannebamm
has abondened XRay and uses Unity3D now
(Resident)

 

 
On forum: 05/02/2007
Messages: 1077
the error says that the script you have written is:
a. not in the right folder /scripts
b. has a syntax error and cant get imported at gamestart (so draws a "nil" call)

The pastebin you have set up for us isn´t written in LUA. You have various issues in there:
http://pastebin.com/ZQRWEFec

you come from python eh?
  22:50:12  5 November 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133

---QUOTATION---
@ FatalFunnel The syntax in your pastebin is either unfamiliar to me or wrong - or both Do you have an example of the script you used as your working example?
---END QUOTATION---



I used this, the part I posted earlier was just what I added on to it.
http://www.sendspace.com/file/344yr3


---QUOTATION---
the error says that the script you have written is:
a. not in the right folder /scripts
b. has a syntax error and cant get imported at gamestart (so draws a "nil" call)

The pastebin you have set up for us isn´t written in LUA. You have various issues in there:
http://pastebin.com/ZQRWEFec

you come from python eh?
---END QUOTATION---



No, I'm completely unfamiliar with scripting, I just know how to edit small bits of LUA, not write an entire section.
  22:49:04  6 November 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
 

Message edited by:
Vintar
11/06/2012 22:52:38
Messages: 6349
I f you just made a very simple upgrade structure which would be linear from upgrade 1 .. 4 then you could try something like this (add to wpn_mod.script)
local weapons table = {

"wpn_ak74" = {"wpn_ak74","wpn_ak74_up1","wpn_ak74_up2","wpn_ak74_up3","wpn_ak74_up4"}
}


function get_upgrade(section)
	local sect = org_wpn_sect(section)
	local upg = nil
	if weapons_table[sect] then
		for k, v in pairs weapons_table[sect] do
			if v == section then
				if k == 5 then
					return --add "fully upgraded" message
				else
					upg = k + 1
				end
			end
		end
	end
	return weapons_table[sect].upg
end


I`m no expert scripter, so "something like that"

PS: you would have to make all new weapon sections IE : "wpn_ak74_up1","wpn_ak74_up2","wpn_ak74_up3","wpn_ak74_up4"
  07:31:45  7 November 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

function get_upgrade(section)
	local sect,new_sect = section
	local ids,idx,ver = string.find(sect,"_up(%d+)", string.len(sect)-4)
	if ids ~= nil then
		sect = string.sub(sect, 1, ids-1)
		new_sect = sect.."_up"..tonumber(ver)+1
	else
		new_sect = sect.."_up1"
	end
	if system_ini():section_exist(new_sect) then return new_sect end
	return sect
end	



Something close to this might avoid the need for tables.
  01:52:40  8 November 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
 

Message edited by:
FatalFunnel
11/08/2012 1:53:04
Messages: 133

---QUOTATION---

PS: you would have to make all new weapon sections IE : "wpn_ak74_up1","wpn_ak74_up2","wpn_ak74_up3","wpn_ak74_up4"
---END QUOTATION---



I have no problem with that, but could I still define the old sections as n1, n2, right? I suppose not.



---QUOTATION---

function get_upgrade(section)
	local sect,new_sect = section
	local ids,idx,ver = string.find(sect,"_up(%d+)", string.len(sect)-4)
	if ids ~= nil then
		sect = string.sub(sect, 1, ids-1)
		new_sect = sect.."_up"..tonumber(ver)+1
	else
		new_sect = sect.."_up1"
	end
	if system_ini():section_exist(new_sect) then return new_sect end
	return sect
end	



Something close to this might avoid the need for tables.
---END QUOTATION---



So it wouldn't have to use a table to define the weapon variant, it just updates the weapon state as a new version, then defining what that version is with the new section, correct?

I'll see how this works, when I can make a build of it over vanilla with dyn shaders.

Thanks a lot, you guys have been a real help here.
  23:10:14  8 November 2012
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

---QUOTATION---

function get_upgrade(section)
	local sect,new_sect = section
	local ids,idx,ver = string.find(sect,"_up(%d+)", string.len(sect)-4)
	if ids ~= nil then
		sect = string.sub(sect, 1, ids-1)
		new_sect = sect.."_up"..tonumber(ver)+1
	else
		new_sect = sect.."_up1"
	end
	if system_ini():section_exist(new_sect) then return new_sect end
	return sect
end	



Something close to this might avoid the need for tables.
---END QUOTATION---



firstly, yeah, I only used a table because he had one in his example.
Secondly, well, theres no need to show off
  23:47:05  8 November 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735
-


---QUOTATION---

Something close to this might avoid the need for tables.

firstly, yeah, I only used a table because he had one in his example.
Secondly, well, theres no need to show off
---END QUOTATION---



Ha - I know your "real" motive was you wanted the poor guy to write out an extra 500 lines of weapon tables.
  02:19:45  14 November 2012
profilee-mailreply Message URLTo the Top
FatalFunnel
(Senior)
 
On forum: 11/07/2011
Messages: 133

---QUOTATION---

function get_upgrade(section)
	local sect,new_sect = section
	local ids,idx,ver = string.find(sect,"_up(%d+)", string.len(sect)-4)
	if ids ~= nil then
		sect = string.sub(sect, 1, ids-1)
		new_sect = sect.."_up"..tonumber(ver)+1
	else
		new_sect = sect.."_up1"
	end
	if system_ini():section_exist(new_sect) then return new_sect end
	return sect
end	



Something close to this might avoid the need for tables.
---END QUOTATION---




Added that to wpn_mod.script, I get this error when I use either of the kits.

FATAL ERROR

[error]Expression : fatal error
[error]Function : CScriptEngine::lua_error
[error]File : E:\stalker\patch_1_0004\xr_3da\xrGame\script_engine.cpp
[error]Line : 73
[error]Description : <no expression>
[error]Arguments : LUA error: ... shadow of chernobyl\gamedata\scripts\wpn_mod.script:254: bad argument #1 to 'len' (string expected, got nil)


stack trace:

On the bright side of all this, at least it is using that part of the wpn_mod.script.
 
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-2020 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.