ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Getting specific_character id from script?

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  18:38:54  26 February 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
02/26/2014 18:39:27
Messages: 454
Getting specific_character id from script?

In the character_desc xml files each entry begins with <specific_character id="esc_stalker_novice_default1" team_default = "1"> (or something like it). Is there any way to find that id field (esc_stalker_novice_default1 in this case) from the script layer, given the level or server object of the character? I wasn't able to locate anything that could do it in lua_help or packet_utils.
Thank you!
  22:48:39  26 February 2014
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349

obj:profile_name()



Where obj is client object.
  01:24:31  27 February 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
Unfortunately, profile_name() is not quite granular enough. It seems to return the value in the <class> tag, which many different entries have in common.
  12:00:35  27 February 2014
profilee-mailreply Message URLTo the Top
Vintar
a bit of this and a lot of that
(Resident)

 

 
On forum: 08/08/2008
Messages: 6349
What are you trying to achieve?
  15:57:21  27 February 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
02/27/2014 15:57:48
Messages: 454
Taking the weapon spawning logic out of the character_desc files and doing it via script; in our mod, to give things a little more variety many NPCs have multiple weapon spawn chances. For instance:

wpn_fort = 1, cond=0.33, prob=0.6\n
wpn_pm = 1, cond=0.44, prob=0.75\n


You get the idea. As you can imagine though, this leads to most characters running around with either a backpack full of guns or no guns at all, both of which are not really desirable.
So I've already set up a nice little system for choosing what weapons to give them, called from xr_motivator:init, but ideally I want to be able to replicate the diversity of the previous xml set-up, and that means I need a way to distinguish between all the different types of NPC. That character ID seems like exactly the right thing, but I can understand if there's just no way to get at it; unfortunately I'm not sure what else I could use instead.
  16:45:38  27 February 2014
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
02/27/2014 16:47:27
Messages: 2230
Don't just do plain random chance then. Make a weighting or point system that factors in rank and community.

For example this is how I generate random stashes: http://pastebin.com/P52mk1n4

The higher the "roll," the more loot and higher chance to get a rare tier item. High rolls mean either a couple rare items or lots of common items.

A similar system can be made for weapon loadouts. You can have separate tables for addon flags and conditions. With packet utils you can create weapons with different addons randomly or even random upgrades.
  17:31:07  27 February 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
The spawning itself is not a big deal, I have a system in place for deciding what to create that I'm happy with for the moment. At the moment, though, we have a bunch of different profiles that have the same class, same faction, and similar ranks, but different sets of possible equipment; for instance some of the Cordon rookies only check from a list of sidearms, whereas others get a sidearm and a primary. I would like to pretty much replicate that exactly, which requires being able to uniquely identify each character profile.
Unfortunately it's sounding like that's just not possible, so I guess I will just have to smear things out a bit and rely on other factors to keep it interesting. Thank you guys for your help.
  19:25:14  1 March 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
03/01/2014 19:30:35
Messages: 454
Another issue's come up so I figure I'll just post it here. Spawning works fine, changing addons works fine, but I'm not sure how to get it into the NPC's inventory. If I spawn it there directly I can't set the custom object data because it's immediately switched online (I think). If I spawn it in the world it's offline so I can set the data, but then I have no idea how to transfer it to the inventory.
Is there a way to transfer offline items? Can I force it online temporarily to use the transfer_item function?

Second problem: when I try to edit the condition through packet_utils (by setting the upd_condition field), it always rounds it either up to 1 or down to 0, even though I'm passing it a float. I'm probably missing something really obvious here, but if anyone could enlighten me as to what I'm doing wrong that would be great.

Sorry for all the random questions! If it helps, here's the current script: http://pastebin.com/iUPqSb9z
  20:31:11  1 March 2014
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4302
I think upd_condition uses an eight bit integer (0-255, where 255=1.0 condition).
  16:42:04  3 March 2014
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
 

Message edited by:
TKGP
03/03/2014 16:42:31
Messages: 454
Thanks NatVac I probably should have figured that out!
 
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-2021 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.