Is it possible to create a tool that when used on an item in game, will return the variable's and their names a message to the PC? I've been fumbling about trying to create code that can do this for a while now.
Obtaining All Variables On An Object By Script
#1
Posté 04 février 2016 - 08:19
#2
Posté 04 février 2016 - 09:09
If you know the names and types of all of the variables you care about it's easy. If you don't know that information you need NWNX. The Linux version of nwnx_funcs for example has these:
/* Get the first local variable from an object. */ struct LocalVariable GetFirstLocalVariable (object oObject); /* Get the next local variable from an object. */ struct LocalVariable GetNextLocalVariable (struct LocalVariable lv);
#3
Posté 04 février 2016 - 09:12
It can not be done in vanilla nwn script. There is a way to do it with nwnx, But I have never used nwnx.
If you are just looking for a way to see the variables on an object you can do that by saving the game. then opening the game in the toolset.
#4
Posté 04 février 2016 - 11:36
You mention "the PC" so I guess you mean SP, for which NWNX isn't available!
#5
Posté 05 février 2016 - 02:13
If this is for debugging, I imagine you could analyse a saved game using moneo.
You mention "the PC" so I guess you mean SP, for which NWNX isn't available!
If its for a single player module, saved or otherwise, there are no variables stored on items unless you are launching it as a server and using server vault PCs. Variables aren't saved onto items in local vault uses.
#6
Posté 05 février 2016 - 03:25
Solid info, thanks guys!
EDIT: Are you saying you can't store variables on items in Single Player Modules... at all? Including by script?
#7
Posté 05 février 2016 - 06:01
Solid info, thanks guys!
EDIT: Are you saying you can't store variables on items in Single Player Modules... at all? Including by script?
I you launch the games as a server/LAN and join using a server vault PC it works. Variables however don't get written to items when using a local vault PC (or for DM Avatars in MP).
#8
Posté 05 février 2016 - 08:05
I did a test which seems to disprove this.If its for a single player module, saved or otherwise, there are no variables stored on items unless you are launching it as a server and using server vault PCs. Variables aren't saved onto items in local vault uses.
On acquiring an item in SP, I set a local int. Put it down on the ground. Save. Open the save container with NWN Explorer. The area .git file has List > Entry 1 for the item, which has a Var_Table with the Name, Type and Value of the local int.
In game, loading the saved file and picking up the item again, the script recognizes that the variable is already set.
Incidentally, this use of NWN Explorer might satisfy the OP, if the number of items to examine is small.
Remember, we're talking about saving a game, not exporting a character (which might be different).
Perhaps I'm missing something?
#9
Posté 05 février 2016 - 02:16
No. That's right. Variables work on items just fine in SP. They just don't export with the exported character I think. As long as you are looking at them in game or in a saved game they will be there. Otherwise all sorts of things would not work that do work ...
- henesua aime ceci





Retour en haut






