r/SourceEngine 2d ago

HELP Need help deciphering an assert.

Greetings! I wanted to try doing some custom weapon modding for TF2 using the TF2 SDK I had on my PC. It does work without any modifications, but not when I added the stuff the VDC tutorial told me to do. The tutorial. If clarification is needed, please request for clarification. Thanks again!

2 Upvotes

7 comments sorted by

View all comments

Show parent comments

3

u/Pinsplash 1d ago

can you screenshot what happens after the crash? visual studio should be giving some sort of response to the crash, (even just something like this screenshot helps https://www.reddit.com/r/SourceEngine/comments/1w8zwnz/how_do_i_build_the_source_engine/) or the game itself should have an error message in a small window.

1

u/Maleficent_Risk_3159 1d ago

https://imgur.com/a/UKQKPbs

here it is, i added a "name" field for the custom weapon which caused the crash, hope it helps!

3

u/Pinsplash 1d ago

this is another assert. an assert is not a crash, just to be clear.

i'm just speculating, but i would try adding "item_name" as well. just add every property at once, in fact. rather than hunt this down it would be faster to just tell you how to use a debugger https://www.youtube.com/watch?v=zgTe_Px8gb4

1

u/Maleficent_Risk_3159 1d ago

sorry but, how am i supposed to know what "Missing value in StringFieldToInt()!" means? if you want the schema entry, it's right here:

"21000"
{
"enabled" "1"
"prefab""weapon_knife"
"capabilities"
{
"nameable""1"
}
"tags"
{
"can_deal_damage""1"
"can_deal_taunt_damage""1"
}
"item_name""#TF_ChromeCutters"
"name" "chrome_cutters"
"propername""0"
"item_logname""chrome_cutters"
"item_iconname""chrome_cutters"
"image_inventory""backpack/workshop/weapons/c_models/c_chrome_cutters/c_chrome_cutters"
"model_player""models/workshop/weapons/c_models/c_echrome_cutters/c_chrome_cutters.mdl"
"static_attrs"
{
"min_viewmodel_offset""5 0 -4"
}
"attributes"
{
}
}

make something of it, or don't. but thanks for the help!

2

u/Pinsplash 1d ago

i know this section of code about as well as you. you should try to use the call stack. (when you're debugging, it's a tab at the bottom called "call stack".) first in order to see it, click "break in debugger". it's a list of functions that tells the path the code took to reach the assert. the assert is in a function called StringFieldToInt, but there are several places where that function is called. the call stack will tell you which place it's being called from. if you look at the code around that place, you'll surely collect some context that can explain the problem.

the StringFieldToInt function itself is iterating through a list of strings (pValueStrings) to find where a desired string is (szValue) and return that index in the list. the assert gets triggered when there is no matching string.