Page 1 of 1
Associating strings with in-game objects/things
Posted: Wed Feb 17, 2021 9:00 pm
by cbadal
I'm Trying to better understand how the game associates string keys with stuff in game.
Like how does the game associate the string key
'weapons.wok.weap.inf_bowcaster'
with the object/thing
'wok_weap_inf_bowcaster'
?
I see that there is an odf file called 'wok_weap_inf_bowcaster', but it doesn't mention anything about what string key to use with it.
Re: Associating strings with in-game objects/things
Posted: Thu Feb 18, 2021 9:59 am
by Anakin
well you are right if you'd rename wok_weap_inf_bowcaster to wok_weap2_inf_bowcaster, you'd need to make a string with the key weapons.wok.weap2.inf_bowcaster. But i think weapons.wok.weap2_inf_bowcaster would do, too
Re: Associating strings with in-game objects/things
Posted: Thu Feb 18, 2021 1:00 pm
by cbadal
I think I get it now.
The logic goes something like this:
Code: Select all
if( odfFileName.IndexOf("_weap_") > -1)
{
stringKey = "weapons."+odfFileName.Replace("_weap_",".weap.");
}
else if( odfFileName.IndexOf("_hero_") > -1 )
{
stringKey = "entity."+ odfFileName.replace("_hero_",".hero_");
}
else if( odfFileName.IndexOf("_fly_") > -1 )
{
stringKey = "entity."+ odfFileName.Replace("_fly_",".fly_");
}
else if( odfFileName.IndexOf("_inf_") > -1 )
{
stringKey = "entity." + odfFileName.Replace("_inf_", ".inf_");
}
Re: Associating strings with in-game objects/things
Posted: Thu Feb 18, 2021 5:19 pm
by Sporadia
I think it's for organisation. In the editlocalize tool it uses a . whenever there is a scope (ie it uses the . to group things). So if you have the odf wok_weap_inf_bowcaster, I guess the engine recognizes the object as a weapon and automatically puts it in the scope weapons, making it weapons.wok_weap_inf_bowcaster. Then if you had another weapon that starts with wok_, eg weapons.wok_weap_inf_fusioncutter, and you wanted to make a subgroup for all wookiee weapons, you just make wok into a scope (inside weapons). Then the keys become weapons.wok.weap_inf_bowcaster and weapons.wok.weap_inf_fusioncutter. It's like putting things in folders. To work backwards you just replace every . with an _. But the first scope like weapons or entity probably tells you something about the object itself.
EDIT: It's more likely that the first scope is assigned based on the object's class (inside the odf), not the odf's file name. Things like inf_ and fly_ or even rep_ are all completely arbitrary. On PC, you can see where the game puts scopes by default if you look at objects which haven't been localized. Weapons automatically have 1 scope ie weapons.abc_something_something. But entities seem to have 2 scopes by default ie entity.abc.something_something. Though this changes the moment you start localizing them.