Script-Modify Item Base Cost?
#1
Posté 02 novembre 2010 - 11:11
Thanks in advance for any feedback!
#2
Posté 02 novembre 2010 - 12:24
It seemed unduly heavy to me though.
Does DMFI tools not have a set item cost function?
#3
Posté 02 novembre 2010 - 01:46
TSMDude wrote...
There was a script at one time that set the base price for every item by a script but I cannot seem to locate it. I am off to work and will look again but if I remember they basically had it loop through and set the base items to a pre price... It seemed unduly heavy to me though.
Thanks for offering to check! For the record all I really need is an API function or an algorithm that will take an item object reference and alter its base price. I can handle writing any required accessory code with no trouble.
Does DMFI tools not have a set item cost function?
I don't use the DMFI tools, so I don't know. This is for an SP module.
#4
Posté 02 novembre 2010 - 03:16
#5
Posté 02 novembre 2010 - 04:29
It's not very precise but it's an option.
#6
Posté 02 novembre 2010 - 04:59
I've already heavily customized baseitems and many of the cost-related 2DAs. But that won't accomplish this particular need, which is to be able to dynamically alter the cost, not just statically.kalbaern wrote...
You can modify the base item 2da and include it as a hak for your module. It'd be a small hak as 2das are essentially text files.
Now that is a very clever idea that just might work for what I have in mind! Thanks -- I'll take a look at trying that out.GhostOfGod wrote...
If you want to do something like this via scripting, You could use the item properties such as material and quality. But you need to alter the iprp_qualcost.2da to have specific cost values for each type. Then in game add those item properties and whatever cost amount you put in your 2da will be added. It's not very precise but it's an option.
Modifié par AndarianTD, 02 novembre 2010 - 05:03 .
#7
Posté 02 novembre 2010 - 05:37
#8
Posté 03 novembre 2010 - 01:36
For windows:
http://nwvault.ign.c....Detail&id=1447
For Linux:
http://data.virusman...tions-1.9.0.rar
#9
Posté 03 novembre 2010 - 12:01
#10
Posté 03 novembre 2010 - 12:01
Modifié par AndarianTD, 03 novembre 2010 - 12:02 .
#11
Posté 06 novembre 2010 - 05:00
AndarianTD wrote...
GOG: Yep, that looks like that'll do it quite nicely. From the description here, it looks like all that's needed is to add entries to iprp_addcost.2DA, iprp_additional.2DA, and my custom tlk. Then using ItemPropertyAdditional will add the property associated with the extra cost. Thanks!
Hmm... well, this doesn't seem to be working as expected. Here's what I'm doing:
1. Modifying iprp_addcost.2da as follows:
[nwscript]2DA V2.0
Name Label Cost
0 111775 Unknown 0
1 111874 Cursed 0
2 111775 Testprop 5.0[/nwscript]
2. Modifying iprp_additional.2da as follows:
[nwscript]2DA V2.0
Label Name
0 Unknown 111775
1 Cursed 111874
2 Testprop 111775[/nwscript]
3. Running this script (as a unique power) from one item on another:
[nwscript]
#include "x2_inc_switches"
#include "nw_i0_spells"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
object oPC;
object oItem;
//SendMessageToPC(GetFirstPC(),IntToString(nEvent));
// * This code runs when the item has the OnHitCastSpell: Unique power property
// * and it hits a target(weapon) or is being hit (armor)
// * Note that this event fires for non PC creatures as well.
if (nEvent == X2_ITEM_EVENT_ONHITCAST)
{
// The item casting triggering this spellscript
oItem = GetSpellCastItem();
object oSpellOrigin = OBJECT_SELF ;
object oSpellTarget = GetSpellTargetObject();
oPC = OBJECT_SELF;
}
// * This code runs when the Unique Power property of the item is used
// * Note that this event fires PCs only
else if (nEvent == X2_ITEM_EVENT_ACTIVATE)
{
oPC = GetItemActivator();
oItem = GetItemActivated();
object oPT = GetItemActivatedTarget();
if (oPT != OBJECT_INVALID)
{
SendMessageToPC(GetFirstPC(),"Adding Additional Property to "+GetName(oPT));
AddItemProperty(DURATION_TYPE_PERMANENT,ItemPropertyAdditional(2),oPT);
}
}
}
[/nwscript]
Both 2das are in my top (patch) hak. The script is running and displaying the correct message, but nothing seems to be happening to the item it is used on -- either with regard to price (tested in a store) or visible properties on the item. Has anyone confirmed that this does in fact work, and if so know what I may be missing? For example, do I also need to add an entry to itemprops.2da?
Thanks in advance for any feedback -- Andarian
#12
Posté 06 novembre 2010 - 05:17
#13
Posté 06 novembre 2010 - 07:17
GhostOfGod wrote...
From what little info I gathered you should modify the iprp_qualcost.2da. I've never actually worked with this. But take a loot there and see if that helps.
Hmm... That's for use with ItemPropertyQuality, though. ItemPropertyAdditional references iprp_addcost.2da.
However, in double-checking this I think I've found the problem. The links above mention a need to also add entries to iprp_costtable.2da so that the (presumably internal) calls to GetItemPropertyCostTable work correctly. I'm going to add those and see how it goes.
Modifié par AndarianTD, 06 novembre 2010 - 07:19 .
#14
Posté 06 novembre 2010 - 10:42
Thanks -- Andarian
#15
Posté 06 novembre 2010 - 11:25
Dagesh wrote...
If you use NWNX you can set the price as needed.
For windows:
http://nwvault.ign.c....Detail&id=1447
My bad as this was what I remembered reading...sorry about that...
Modifié par TSMDude, 06 novembre 2010 - 11:26 .
#16
Posté 07 novembre 2010 - 12:02
AndarianTD wrote...
Hmm... The entries are already there in the file, but there's a "ClientLoad" column with a zero in it. Does anyone know what that's for? Presumably it somehow controls whether the file is loaded on the client or on the server for MP play -- can anyone confirm or explain that?
Thanks -- Andarian
I believe that the client load collumn is for refferance only. It may have been used in compiling the original code for the game as an external resource. Now I believe it to be hard coded into the game. I could be wrong, This is just my thoughts when i first seen the collumn.
#17
Posté 07 novembre 2010 - 07:29
nwn.bioware.com/forums/viewtopic.html
Pretty good info in there.
EDIT: Just checked the ItemPropDef.2da. The last 3 lines are for the Material, Quality, and Additional_Property. The cost colums are all currently set to "****". So adding a cost multiplier to the last might be what ya need. Hopefully.
Good luck.
Modifié par GhostOfGod, 07 novembre 2010 - 07:50 .
#18
Posté 07 novembre 2010 - 02:16
http://nwn.bioware.c...Item_Format.pdf
#19
Posté 07 novembre 2010 - 02:41
I tried GOG's suggestion and it's still not working. Based on all the references, I think I must be missing something very simple and obvious. I'm going to try it again from scratch on a plain module with no other modifications and see how that goes. Since this is veering a lot into CC, I'll probably try cross-posting the question to the CC forums as well.
#20
Posté 07 novembre 2010 - 03:39
Modifié par AndarianTD, 07 novembre 2010 - 03:40 .
#21
Posté 07 novembre 2010 - 05:08
Thanks again for all the help! - Andarian
Modifié par AndarianTD, 07 novembre 2010 - 05:46 .





Retour en haut






