Xagul
deathzot.net
- Joined
- Jun 30, 2008
- Messages
- 1,294
- Solutions
- 3
- Reaction score
- 1,037
I am trying to add a custom attribute to items.xml that I can check in-game using the function "getItemInfo". Basically what I did was take the attribute "runeSpellName" and just copy it with a different name. Here is the process of what I did, and the results of what happened after:
I am using TFS 0.4 rev. 3884
Starting out with the items.xml I added this:
Then I started up the server and got this error:
Well of course I got this error because I did not add the attribute to the source yet, so off I went to add this neat little attribute, and this is how I did it:
In items.h I located:
And I added ", runeSpellTest" to it like so:
In items.cpp I located:
Below it I added:
In luascript.cpp I located in the function "getItemInfo":
Below it I added:
From here I recompiled the server. Time to test it out!
I start up the server:
Sweet, as you can see there is no more error!
So I log into the server to check out my sweet new attribute and I find my character teleported to temple unable to walk at all and every ground tile in the game is completely screwed up:
At this point I have been troubleshooting this issue for about 3 hours and I am extremely frustrated. If anyone knows why this is happening and how I can overcome this issue I would be extremely grateful.
I am using TFS 0.4 rev. 3884
Starting out with the items.xml I added this:
Code:
<item id="2263" article="a" name="Test Rune">
<attribute key="runeSpellName" value="real rune" />
<attribute key="runeSpellTest" value="test rune" />
</item>
Then I started up the server and got this error:
Code:
[12:33:16.698] >> Loading items (XML)
[12:33:16.732] [Warning - Items::loadFromXml] Unknown key value runeSpellTest
[12:33:16.771] >> Loading groups
In items.h I located:
Code:
std::string name, pluralName, article, description, text, writer, runeSpellName, vocationString;
Code:
std::string name, pluralName, article, description, text, writer, runeSpellName, runeSpellTest, vocationString;
In items.cpp I located:
Code:
else if(tmpStrValue == "runespellname")
{
if(readXMLString(itemAttributesNode, "value", strValue))
it.runeSpellName = strValue;
}
Code:
else if(tmpStrValue == "runespelltest")
{
if(readXMLString(itemAttributesNode, "value", strValue))
it.runeSpellTest = strValue;
}
In luascript.cpp I located in the function "getItemInfo":
Code:
setField(L, "runeSpellName", item->runeSpellName.c_str());
Code:
setField(L, "runeSpellTest", item->runeSpellTest.c_str());
From here I recompiled the server. Time to test it out!
I start up the server:
Code:
[12:46:02.112] >> Loading items (XML)
[12:46:02.187] >> Loading groups
So I log into the server to check out my sweet new attribute and I find my character teleported to temple unable to walk at all and every ground tile in the game is completely screwed up:
At this point I have been troubleshooting this issue for about 3 hours and I am extremely frustrated. If anyone knows why this is happening and how I can overcome this issue I would be extremely grateful.