DukeeH
Active Member
- Joined
- Dec 6, 2010
- Messages
- 550
- Solutions
- 3
- Reaction score
- 39
Hello, after some search I think that it isn't possible to make critical/dodge perfect by onstatschange using 0.3.7/otx2.
Problem: StatsChange Defenses (absorbPercentAll / armor)
So I'm trying to do it by sources by myself, using tfs default crit system part, because I don't use it, I got where to change, and what to do, but I don't know any c++ syntax or anything.
I got something like:
From what I've search, getstorage returns a string (don't know what it means) so I found this way to make int and do the rest of the thing.
Basically:
Storage 48901 = x% critical chance
It should work for any weapon and spells, but If i manage to fix this code, I can adapt for everything.
I know it would give errors, but still, i've just tried something and put everything together so it would be better than come here and ask for someone to do everything.
Errors from script above (it was a first test):
Thanks.
Problem: StatsChange Defenses (absorbPercentAll / armor)
So I'm trying to do it by sources by myself, using tfs default crit system part, because I don't use it, I got where to change, and what to do, but I don't know any c++ syntax or anything.
I got something like:
Code:
double maxDamage = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor);
std::string valor;
player->getStorage(48901,valor);
int32_t value = atoi(valor.c_str());
if(value*5 >= random_range(1, 1000))
{
maxDamage = std::pow(maxDamage, g_config.getDouble(ConfigManager::CRITICAL_HIT_MUL));
player->sendCritical();
}
From what I've search, getstorage returns a string (don't know what it means) so I found this way to make int and do the rest of the thing.
Basically:
Storage 48901 = x% critical chance
It should work for any weapon and spells, but If i manage to fix this code, I can adapt for everything.
I know it would give errors, but still, i've just tried something and put everything together so it would be better than come here and ask for someone to do everything.
Errors from script above (it was a first test):
Code:
1> weapons.cpp
1>..\weapons.cpp(364): error C2664: 'bool Creature::getStorage(const std::string &,std::string &) const': cannot convert argument 1 from 'int' to 'const std::string &'
1> ..\weapons.cpp(364): note: Reason: cannot convert from 'int' to 'const std::string'
1> ..\weapons.cpp(364): note: No constructor could take the source type, or constructor overload resolution was ambiguous
1>..\weapons.cpp(627): error C2039: 'String': is not a member of 'std'
1> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\iomanip(18): note: see declaration of 'std'
1>..\weapons.cpp(627): error C2065: 'String': undeclared identifier
1>..\weapons.cpp(627): error C2146: syntax error: missing ';' before identifier 'valor'
1>..\weapons.cpp(627): error C2065: 'valor': undeclared identifier
1>..\weapons.cpp(628): error C2065: 'valor': undeclared identifier
1>..\weapons.cpp(629): error C2065: 'valor': undeclared identifier
1>..\weapons.cpp(629): error C2228: left of '.c_str' must have class/struct/union
1> ..\weapons.cpp(629): note: type is 'unknown-type'
Thanks.
Last edited: