Page 2 of 2
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:16 pm
by thefoof
I know I did the same thing to a spells function also related to casting speed so just fixed that.
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:23 pm
by John Adams
Hmm, still erroring on linux compile. Same error.
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:27 pm
by John Adams
What the hell is this? LOL
Code: Select all
return 100 * max((float) 0.5, (float) 1 + (1 - (1 / (1 + (cast_speed * .01)))));
I think my own Brain just exploded.
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:28 pm
by thefoof
LOL it returns the percentage of the amount casting speed will mod somebody (capped at 50%)
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:52 pm
by Jabantiz
John Adams wrote:Hmm, still erroring on linux compile. Same error.
Sorry was in a hurry to commit the fix forgot to add the ( ) around the equation
thefoof wrote:LOL it returns the percentage of the amount casting speed will mod somebody (capped at 50%)
If you want the maximum to be 50% (0.5) you should use min() not max(), max will take the higher value of the two numbers so if you have 0.5 and 0.75 it will return 0.75 giving you a 75% boost
Proper fix is on Dev SVN
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 6:56 pm
by Jabantiz
Jabantiz wrote:
thefoof wrote:LOL it returns the percentage of the amount casting speed will mod somebody (capped at 50%)
If you want the maximum to be 50% (0.5) you should use min() not max(), max will take the higher value of the two numbers so if you have 0.5 and 0.75 it will return 0.75 giving you a 75% boost
Reading the code again I think I miss read it, the return value will be multiplied against the base cast time, if that is the case you have it correct sorry for the confusion
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 7:03 pm
by John Adams
Not to derail the AI thread

but it would be nice if complex stuff like that were broken down into local vars that made more sense. Me looking at it, I have no idea what I'm looking at - though I am pretty good with math
And... // comments! Jab, what are you teaching your apprentice?
And finally (again) I must ask, Rules! When at all possible, consider using Rules if you can imagine yourself as an Admin wanting to tweak an offset/modifier without having to recompile the code.
Other than that, the mind-numbingly complex return looks good!
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 7:06 pm
by John Adams
Looks like the other one needs to be fixed too.
Code: Select all
Spells.cpp: In member function ‘void Spell::ModifyCastTime(Entity*)’:
Spells.cpp:444: error: no matching function for call to ‘min(float, double)’
Re: New LUA AI Functions
Posted: Tue Sep 03, 2013 7:14 pm
by Jabantiz
About to do a commit of my instance code, I can add the fix in there unless some one beats me to it
EDIT: Fix is on Dev SVN