Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Weapon & Item Refinement » Question about ITEM Modding
Question about ITEM Modding[message #330891] Thu, 27 February 2014 11:30 Go to next message
SHarper

 
Messages:11
Registered:February 2013
Hello,

I stumbled across the latest builds, especially the food System.

So i started to work with the XML Editor and the Merging System,
my intention was to enable some kind of "crafting".

I'm already done with the Cooking-Equipment and now i start with some cooking recipes.

While modding and editing around i thought of some may useful stuff for example:
"Improvised Bandage"
You take a "Rag" an an Bottle of Alcohol and you get an
improvised Bandage, which you can use as "first aid kit"

This is quite easy to realize but i tried to find an option
to restrict the Improvised Bandage to a "One time use only"
OR at least to restrict it to bandage a max of 15HP.
I didn't find any option to realize that.

I thought about several ways to realize this:
The Merge create a "First Aid Kit" which is not "filled" completely
(Is there a way to define the ITEM Status after a merge ?)

I create a new Item which has a smaller "Status"
(like Drink/Food Points)

May someone has an Idea how to realize it, i will try to look at the SVN Source-Codes an try to find it myself but i would appreciate your help very much.

Re: Question about ITEM Modding[message #330892] Thu, 27 February 2014 11:44 Go to previous messageGo to next message
sevenfm

 
Messages:1169
Registered:December 2012
Location: Russia
You can use
-100
tag, as Strohmann does in his Overhaul mod for 'small toolkit'.

Though i didn't test it for first aid kits.


Re: Question about ITEM Modding[message #330893] Thu, 27 February 2014 12:04 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
I that still implemented in the actual Revision ?
I've looked into the Items.xml an i just found this "flag" in the "Nada" Item.

I will try it this evening.
Re: Question about ITEM Modding[message #330894] Thu, 27 February 2014 13:20 Go to previous messageGo to next message
sevenfm

 
Messages:1169
Registered:December 2012
Location: Russia
At least it is present in current code:

UINT16 UseKitPoints( OBJECTTYPE * pObj, UINT16 usPoints, SOLDIERTYPE *pSoldier )
...
// SANDRO - revisited this code, make the percentstatusdrainreduction count always
if( (usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction)))/100) < (*pObj)[bLoop]->data.objectStatus )
{
    (*pObj)[bLoop]->data.objectStatus -= (INT8)(usPoints * (max( 0, (100 - Item[pObj->usItem].percentstatusdrainreduction) ) )/100);
...


Re: Question about ITEM Modding[message #330896] Thu, 27 February 2014 17:35 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
I thought about several ways to realize this:
The Merge create a "First Aid Kit" which is not "filled" completely
(Is there a way to define the ITEM Status after a merge ?)

I worked myself through the newest Source Code and found out, that it
the Resulting "Status" is hardcoded as "(Obj1.status+Obj2.status)/2"

i will try myself to add some kind of "maximum result.status after merge"
and maybe i make it to externalize that into the XML Table for "Merge".

But this will take me some time...


Re: Question about ITEM Modding[message #330927] Fri, 28 February 2014 22:11 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
Sooo

It took my some Time but i managed to extend the MERGE System.

I decided to externalize the "Max Result Object Status" to the MERGE.XML
new XML struct example:

1546
1546
1546
100
0
1
1
32




I just redefined a litte bit in the NAS function:

(*pAttachment)[0]->data.objectStatus = min(ubRes2MaxStat,(((*pAttachment)[0]->data.objectStatus + (*this)[subObject]->data.objectStatus) / 2));



If you merge an Item (5%) with Item(5%) it's result status would be 5% (obj1.status + obj2.status)/2
Now if you define a max result stat of 2 the result status will be 2
If you define a max result of 10 the result status will be 5%


This could make the hardcoded definition for tripwires obsolete:
// Flugente: if the new item has the TRIPWIREROLL property, it only gets status 2 upon creation via merges
if ( Item[ this->usItem ].usItemFlag == TRIPWIREROLL )
{
(*this)[subObject]->data.objectStatus = 2;
}
This could now be defined in the XML.

Re: Question about ITEM Modding[message #330975] Sun, 02 March 2014 18:30 Go to previous messageGo to next message
Flugente

 
Messages:3045
Registered:April 2009
Location: Germany
Good idea. However, this would require one to always set to 100 for existing merges - otherwise a new item's status will be 0, which is bad, as that should never happen. You can modify the xml reading so that if the value is 0, 100 is used (still somewhat confusing if one does not know this).

The function you modified is only called if merge has a second resulting item, so this won't be called in all relevant cases.


Re: Question about ITEM Modding[message #331366] Tue, 18 March 2014 18:37 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
I've just posted the one for the second result, the first one is modified as well.

For the "Zero-Status-Problem" i've changed the merges.xml via batch and added those 2 columns to the xml-editor View AND included a DEFAULT=100 Value if the XML Parser can't find the columns (or if the found value = 0)

btw.: The first Code just was some kind of "Prove of Concept"

At the moment I'am tuning it to give you a little more options, for example at the moment you have no option to split things right.

For Example you can't fill a Canteen with another canteen if my interpretation is right, you're just able to "Combine" those which will result in One-Item if the status of both items together is less than 100%. In my opinion it would make sense to be able to fill some (e.g. One Portion-Size Value) to the Other Canteen.

So now i'am working on a solution to this, at this point I'm not completely sure how i will implement that.
For now i think i add a Merge-Type which wouldn't touch the existing Merges.

I keep you updated.

I've just created some items, but making those high resolution (irony) pics takes some time took some time.

But at least in my Version you can now throw a frying pan on a stove and grill yourself some bloodcat steak...



Re: Question about ITEM Modding[message #331367] Tue, 18 March 2014 19:18 Go to previous messageGo to next message
sevenfm

 
Messages:1169
Registered:December 2012
Location: Russia
My humble idea of improving merges in ja is to allow some sort of limited 'crafting':
Leave the merges.xml as it is now for compatibility.
Create new .xml file for 'special' merges with a lot of really useful tags:

1. source item
2. target item
3. resulting items 1..5
4. % of status point of source item which are used to perform 'merge'
5. % of status point of target item ...
6. maybe some tags to work with for temperature points (recharge batteries, make bad food clean etc)
7. number of skill-related tags needed to perform action
8. items needed to be in inventory to perform action
9. 'class' related tags - for example, make all knives usable on all 'cloth' items, instead of writing every possible combination
10. etc

I think that making separate system makes more sense in long term, because you cannot do much with current merges without complicating existing things or accidentally breaking something.


Re: Question about ITEM Modding[message #331372] Tue, 18 March 2014 20:30 Go to previous messageGo to next message
Gambigobilla

 
Messages:719
Registered:July 2008
@Sevenfm
totally agree with you and double agree with you about 9.
t-shirt to rag merges and c-18 & creature elixir stuff takes to much at merges.xml, especially in mods
Re: Question about ITEM Modding[message #331381] Wed, 19 March 2014 08:03 Go to previous messageGo to next message
smeagol

 
Messages:2688
Registered:June 2008
Location: Bremen, Germany
I simply moved the t-shirt to rag to transformations. Ripping apart a shirt shouldn't really need a knife and this way I only need one line of xml text (and you also get 4 rags out of a shirt).


Re: Question about ITEM Modding[message #331527] Thu, 27 March 2014 18:35 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
Well OK,

I will try to find a way, but it will require a complete different Validate Function's at it will be quite a bunch of work todo.

But Sevenfm Your IDEA is great, it would allow some real nice stuff.
At this Point i just say i will try to find a way to accomplish your "wish".
In the Century of Quad Core CPUs the extra loop should not create that much performance issues.

Tomorrow and Saturday i have about 12 Hours for programming, i'll inform you about any progress...

So far there is non i had to much "real work" over the last 10 days
Re: Question about ITEM Modding[message #331528] Thu, 27 March 2014 20:50 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3728
Registered:July 2009
S.Harper
In the Century of Quad Core CPUs the extra loop should not create that much performance issues.
That's what everyone thinks and why the inventory is slow as f*** with sufficient items.


Re: Question about ITEM Modding[message #331530] Thu, 27 March 2014 23:22 Go to previous messageGo to next message
sevenfm

 
Messages:1169
Registered:December 2012
Location: Russia
@S.Harper

As for performance issues, I think it's not about CPU speed, it mostly depends on the proper programming technique.

For those mentioned class-related merges - they could be done in two ways:
1. Define number of hard-coded conditions (all 'cloth' tagged items)
2. Add tag 'merge class' to items.xml:
for example, all clothes have merge class 1, all knives have merge class 2, then define new merge
, , , etc..
Those class tags could be simple numbers or bitmasks, each way has it's own advantages and disadvantages.

I can help with testing your crafting system, when (and if Smile it will be implemented.


Re: Question about ITEM Modding[message #331538] Fri, 28 March 2014 09:05 Go to previous messageGo to next message
SHarper

 
Messages:11
Registered:February 2013
i've started yesterday and i only used the "item->class" (lookup table itemClass.xml)

But i found out that this does not work as intended, for example if you would like
to create a new class merge based on food, you have to use foodtype tag from the items.xml
(itemClass is MISC like the Handcuffs, which for example would mean you can merge 2 Handcuffs and Get a new MEAL, yeah i like eating handcuffs for breakfast)

To Add a TAG in items.xml seems to work (if there is none its set to 0) so don't use the class 0
in SpecialMerges .... or else ...

I although tried to make the "treat armor merges" class based, but this is kind of tricky because the only chance is to find the corresponding item by Name not by Index. (so this will be moved to the "maybe next time-List" (its possible but may throw some errors in localized versions)

At least the cloth on knife stuff does work for now just with a max of 2 Resulting Items (i have to handle the "not enough space issue, i may be able to use it from the item transformation part)

If my work continues this well i maybe able to commit an early version on Sunday.

@DEPRI: the extra loop is only called if you MERGE things, you just have to loop through the SpecialMerges , due to the class based merges the SpecialMerges list is a lot shorter then the actual Merges.xml which means it should work faster.
in my early version its slower because both lists are called.
Well the extra Item Tag increases the Volume of the ITEM.XML
But give the ITEM TAGs a close look, there is just every fu*ing thing in an extra tag (round about 210 possible Tags)
one more will may slow the item system down by what 0,5% at max)

[Updated on: Fri, 28 March 2014 09:17] by Moderator

Re: Question about ITEM Modding[message #331541] Fri, 28 March 2014 14:37 Go to previous messageGo to next message
sevenfm

 
Messages:1169
Registered:December 2012
Location: Russia
@S.Harper

One possible way of implementing class merges for armour is using simple index offset Smile
For example, we have items:
100 kevlar vest
101 kevlar helmet
...
200 treated kevlar vest
201 treated kevlar helmet

Then we define merge and set index offset +100 instead of exact resulting index.

Not sure if this approach will works with all existing mods, but afaik these types of items are usually organized in some arrays.

p.s. what is a 'not enough space' issue?
you simply call one function to place item to inventory, then, if it fails, you just call another to drop it on the ground.


Re: Question about ITEM Modding[message #331543] Fri, 28 March 2014 18:13 Go to previous message
Gorro der GrĂ¼ne

 
Messages:1566
Registered:March 2009
Location: Broadwurschd-City
how can anybody namining himself after Seamus S. Harper DARE to ask 4 technical support
Previous Topic: MAM 2.4.5 - Caliber driven damage, penetration and tumble values - RELEASE!
Next Topic: gun sound mod anywhere?
Goto Forum:
  


Current Time: Thu Mar 30 03:40:42 EEST 2017

Total time taken to generate the page: 0.01056 seconds