Aller au contenu

Photo

Adding Crafting Scripts problem


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
Anotherone773

Anotherone773
  • Members
  • 24 messages
I want to add the Storm crafting system to my campaign without the trade system. I found a dev tutorial on this"NX2_Crafting_Tutorial".

Since i only want to add and modify blueprints i figured this would not be hard. I followed the tuts instructions putting the approriate files in my campaign folder. I opened my campaign version of the x2_mod_def_act.nss and x2_mod_def_aqu.nss.

It says to remove the trade system to replace:

#include "kinc_trade_crafting"

with

#include "kinc_crafting"

Instead of   #include "kinc_trade_crafting" there is only a  #include "kinc_trade" along with 2 others. So i replaced this one on both and tried to compile and this is what i got: kinc_crafting.nss(101): error: varible defined without type.

I have the .2da files i need the scripts i need and the recipe blueprints in my campaign folder. I closed out the toolset and reopened to make sure it registered the scripts being in the campaign folder.

I have two questions:

1) What am i doing wrong/forgetting?I followed the tutorial.

2) Can i use the above scripts without  changing them  and still not use the trade system? or will this cause problems? In other words is it even necessary to change the scripts if i am not using the trade system?

#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
Read through this thread and then download my King's Festival Campaign or the OC Makeover SoZ Edition and use the included CraftingPlus content.



Regards

#3
Anotherone773

Anotherone773
  • Members
  • 24 messages
@Kaldor: Thanks that thread helped me solve my problem. I know that tutorial had some errors but it has some major ones. Recipes now work fine in game.

I use the OC Makeover as well ( for the OC). I am glad someone( you) came up with it. It makes the OC and first xpack more interesting.

My next problem that is related to this is I have tested in games several times and i cannot get any objects to drop crafting material. I know these specific objects drop crafting material and what they drop because i looked it up in the .2da file.

I am wondering if their is script i need to add to the placeables to tell them to drop their crafting materials upon destruction?

Modifié par Anotherone773, 03 décembre 2010 - 07:37 .


#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages

Anotherone773 wrote...
My next problem that is related to this is I have tested in games several times and i cannot get any objects to drop crafting material. I know these specific objects drop crafting material and what they drop because i looked it up in the .2da file.

I am wondering if their is script i need to add to the placeables to tell them to drop their crafting materials upon destruction?


Look at this thread. Should help you figure it out. Also make sure that variable X2_L_NOTREASURE is not set on the module. This will prevent creatures from dropping anything. See this thread.

Regards

Modifié par Kaldor Silverwand, 06 décembre 2010 - 07:20 .


#5
Anotherone773

Anotherone773
  • Members
  • 24 messages
Hmm that really didnt help with my problem. I know how to do the script to prevent creatures from dropping random treasure. I am more interested in "non living" objects such as door, chest, tables, etc when bashed. Doors have a default death script that says it should create a craftable item on death( such as a plank of wood or ingot) but no matter how many of this door type i bash it never drops nor does any other objects upon bashing. I am using a test character that has 20 points in all crafting skills and ( as i heard it does a skill check on killer to prevent it from dropping loot for people that are not interested in crafting) as well as all crafting feats.




#6
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
The x2_inc_compon script contains the code that does the check. Crafting resources are dropped for items and creatures only if the killer/basher has an armor or weapon crafting skill level greater than 5.

It uses the des_crft_drop.2DA, with the index being the appearance type, and columns Placeable_Drop, Placeable_Num, Creature_Drop, Creature_Num, Door_Drop, and Door_Num. If a placeable has inventory then the craft item is placed in the inventory, otherwise it is dropped in the location.

I don't see in the des_crft_drop.2DA file any appearance types for non-creatures though. So it looks to me like placeables aren't going to drop anything unless you add the lines to the 2DA.

Regards

Modifié par Kaldor Silverwand, 07 décembre 2010 - 05:45 .


#7
Anotherone773

Anotherone773
  • Members
  • 24 messages
I distinctly remember the OC of NWN2 dropping crafting materials when you bash stuff. This was before i had the xpacks and your makeover for the OC. The 2da  you mention does have the placeables in it. You even read them off. Each  row contains a  creature, placeable and door   and it tells you what each on that row drop. Instead of using a long list of rows it seems they condensed them by having multiple columns  with  one of each per row. If you look at row 1. The elf drops nothing,the bookshelf drops a wooden plank and a wall1door drops a plank of wood.

The creatures( outside the OC ) are not  dropping anything as well.

This is the default door death script:

//::///////////////////////////////////////////////
//:: x2_door_death
//:: Copyright © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
    On death of a door it spawns in an appropriate
    item component.
*/
//:://////////////////////////////////////////////
//:: Created By: Brent
//:: Created On: August 2003
//:://////////////////////////////////////////////
// MDiekmann 5/21/07 - Modified so door explosion effect plays

#include "x2_inc_compon"

void main()
{
    craft_drop_placeable();
    effect eDoorExplode = EffectNWN2SpecialEffectFile( "fx_wooden_explosion_big");
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDoorExplode, OBJECT_SELF);
}



However it is not dropping what the 2da says it should be dropping.  That is why i am wondering if i need to add a script somewhere to enable placeables to drop crafting items.

#8
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
I'll take a closer look at x2_inc_compon tonight, but I think that it is bugged. For non-creatures they should be using the resref of the item to determine the appropriate index in the 2da, rather than the appearance type.

#9
Anotherone773

Anotherone773
  • Members
  • 24 messages
Looking at the x2_inc_compon and the 2da, the script references the door drop column and the door num column. But if it is using the door num column to tell it what craftable to drop then it may be getting confused. The door num column has a "1" value for the first door and then "2" for the rest of the doors. Since none of them have a unique number, i think it may be causing a bug.



I am not for sure how they have it setup to call the appropriate line out of the 2da. I would set mine up according to the crafting item the door dropped. "1" would be nothing, "2" would be wooden plank, "3" iron ingot, etc. Then each door would have a number assigned to it . A door assigned "3" would drop iron ingot. A script would check the door num value and drop the placeable that cordinates with that number.



The way they have it set up doesnt make a lot of sense to me though. This might be a 2da leftover from NWN and they modded it. And it may be NWN i was thinking of. But that doesnt seem right to me. NWN had a rather pathetic and almost useless crafting system.



For placeables they have no number reference. I wonder if the OC uses a different 2da than what is normally available for modding? Crafting , at least SoZ style, is something you have to actively add to your mods/campaigns. Perhaps this 2da is meant for modders so they dont have to mess with removing crafting and its items from their mods.



But your right this 2da doesnt look like it is setup to call from as far as what to drop.

#10
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages
The problem is that there is nothing in the 2da that corresponds to the characteristics of the doors or placeables. The appearances are only for creatures, and the label columns do not contain the ResRefs of the placeables and doors. I can provide a fix to x2_inc_compon and x2_door_death that will allow it to work generically and with some placeables, but it will not be perfect.

Making it work properly with placeables would really require either completely altering the 2da (might be safe, but I don't know what other scripts use it) or adding columns to other 2das like placeables.2da or creating a new 2da. Each of these options would require some significant time and it doesn't seem like a really wise thing to spend time on since NWN2 modules should not have a large number of bashable placeables anyway. Why not? Here is why not:

- a large number of placeables prevents baking from working properly. This is why they are normally set to environmental, but environmental placeables cannot be destroyed.

- allowing placeables to be destroyed means special code to also destroy placeables stacked on the bashed placeable or avoiding stacking placeables which makes for a less attractive display.

- if a placeable is bashed then you should be able to walk through the space. But that would mean the placeable must be dynamic and in the walkmesh. Placeables in the walkmesh tend to interfere with pathing because of their edges which is why normally you surround placeables with a smooth walkmesh cutter. If a non-environmental placeable is in the walkmesh cutter and you bash it then you will still not be able to walk through the space because of the walkmesh cutter.

So it really makes more sense that few placeables in a module will be bashable. And for those that are a custom death script would be an easy way to drop something.

Doors make more sense, but since most doors are wood and most doors in the OC are not actually usable, again it makes more sense to just use a custom death script that drops a plank of wood than to go to an extensive length to define specialized drops for every type of door.

Nonetheless, I'll post what I have in a day or so. Need to do a little more testing with it. There is a fix I think should be made in x2_door_death anyway to properly handle locked transition doors.

Regards

Modifié par Kaldor Silverwand, 08 décembre 2010 - 06:28 .


#11
Anotherone773

Anotherone773
  • Members
  • 24 messages
Hmm you didnt have to go through all that. I have a work around for it. I just have to add more crafting items to the areas. My campaign is heavily dependent on crafting. I never liked that in the OC you can make stuff but their is no purpose to making it because you can buy it usually cheaper and faster. So i rebalanced the crafting system so you can make a small profit off crafting and made my campaign very crafting dependent. You must craft your own gear to be able to make it through the campaign ( well or cheat). I find it a much more interesting way to play.



I noticed the problem with placeables. in a large storage room in a cave i made. The placeables had a much larger area of effect for walking than the placeable took up. These were all set to static. So i had to ditch a few. I removed some and set some as walkable. The walkable ones are mainly usable chest and such. While you actually walk through them because they are so low to the floor you could actually step over them. I rarely end up walking through them but it kept my walk paths open and still gave the effect of a full storage room, though not as full as i originally had it.



I have not had problems elsewhere with it, but i am only picky on certain aspects of the game( like it annoys me that you can be in a dark cave with no light and still see everything. I would rather have indoors heavily light dependent and you can get by without any lights though it does look drab.