New LUA AI Functions

Discussions on development of both the EQ2Emulator LUA Script Engine and Script specifications

Moderator: Team Members

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: New LUA AI Functions

Post by thefoof » Tue Sep 03, 2013 6:16 pm

I know I did the same thing to a spells function also related to casting speed so just fixed that.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: New LUA AI Functions

Post by John Adams » Tue Sep 03, 2013 6:23 pm

Hmm, still erroring on linux compile. Same error.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: New LUA AI Functions

Post by John Adams » Tue Sep 03, 2013 6:27 pm

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.

User avatar
thefoof
Retired
Posts: 630
Joined: Wed Nov 07, 2012 7:36 pm
Location: Florida

Re: New LUA AI Functions

Post by thefoof » Tue Sep 03, 2013 6:28 pm

LOL it returns the percentage of the amount casting speed will mod somebody (capped at 50%)

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA AI Functions

Post by Jabantiz » Tue Sep 03, 2013 6:52 pm

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

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA AI Functions

Post by Jabantiz » Tue Sep 03, 2013 6:56 pm

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

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: New LUA AI Functions

Post by John Adams » Tue Sep 03, 2013 7:03 pm

Not to derail the AI thread :shock: 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!

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: New LUA AI Functions

Post by John Adams » Tue Sep 03, 2013 7:06 pm

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)’

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: New LUA AI Functions

Post by Jabantiz » Tue Sep 03, 2013 7:14 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests