Jump to content

FightClass lua script...


Recommended Posts

ok, well, I am not sure I understand...  Here is what I want to run... 

 

CastSpellByName("Misdirection"); SpellTargetUnit("pet");

 

Because I'm not sure how to set a target for a spell besides my main target... when I made that statement as the spell name, i got a big long half kanji error msg that I couldn't read.  Does the LUA have to be an unsecured function?

 

Another thing I'm trying to do is set a spell to do /PetAttack but only if the pet is not already attacking, here is the xml code (since it's maintenance, and I can't start up WRobot in edit only mode...

 

 

<FightClassSpell>
      <SpellName>PetAttack()</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>retValue = IsPetAttackActive()</LuaScript>
            <VarRet>retValue</VarRet>
            <ValueRet>False</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <Priority>56</Priority>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
    </FightClassSpell>

 

any advice on how I could make this work would be appreciated.  I'm waiting for a bit more knowledge to release my FightClass's.

Link to comment
Share on other sites

Try this code for Misdirection:

ClearTarget(); CastSpellByName("Misdirection"); SpellTargetUnit("pet"); TargetLastTarget();
IsPetAttackActive return bool and fight class read only string.

You need to use this code:

retValue = "False"; if IsPetAttackActive() then retValue = "True" end
Link to comment
Share on other sites

I was under the impression that SpellTargetUnit(unit) was a way to set a unit as the target of the spell, without having to actually target it, kind of like when you click misdirection, it beings up a pointer that you can just click on the unit you want to misdirect to.  As opposed to just SpellTarget().

 

The second part, what I was having a problem with was having PetAttack() as the spell name, i think, but it's hard to tell, cuz the error msg in debug was kanji.

 

thanks for helping.

Link to comment
Share on other sites

I tried the Misdirection code you posted, but it seems if I use a " in the spell name, I get a big ugly long error msg... I can post a log, but it basically looks like this

[Error] 07:37 - Compilator Error :
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(177,19) : warning CS0436: The type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs' conflicts with the imported type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\jzn5utd4.dll'. Using the type defined in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs'.
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,63) : error CS1026: ) expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,66) : error CS1003: Syntax error, ',' expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,139) : error CS1003: Syntax error, ',' expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,139) : error CS1525: Invalid expression term ')'
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,140) : error CS1002: ; expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,140) : error CS1525: Invalid expression term ','
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,141) : error CS1002: ; expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(51,141) : error CS1514: { expected
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(54,9) : error CS1525: Invalid expression term '}'
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(74,9) : warning CS0436: The type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs' conflicts with the imported type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\jzn5utd4.dll'. Using the type defined in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs'.
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(199,26) : warning CS0436: The type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs' conflicts with the imported type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\jzn5utd4.dll'. Using the type defined in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs'.
c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs(203,34) : warning CS0436: The type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs' conflicts with the imported type 'HunterSettings' in 'c:\Users\tonyd\AppData\Local\Temp\jzn5utd4.dll'. Using the type defined in 'c:\Users\tonyd\AppData\Local\Temp\zcc3x2i1.0.cs'.
is there a way to escape the character?

 

edit: used \ and escaped the "s, doesn't error out anymore, but now it stops after it successfully casts the misdirection...

Link to comment
Share on other sites

Wow, that post got messed up.  Anyways, I mostly hacked my way thru it, still seems inconsistent in the results, but I think i'll play with it for a bit.  

 

A few questions, tho

 

are the spell conditions inclusive or exclusive?  Like, AND or OR?  In the lua script condition,can i use AND and OR in the "return value research"?  Say If the script returns anything except 0 or nil i want it to activate.

Link to comment
Share on other sites

I have tried this code works fine for change target:

ClearTarget(); TargetUnit("pet");  CastSpellByName("Misdirection"); TargetLastEnemy();
(you can try lua script in: "General Settings" > "Others" tab > "Development Tools" (put lua script in textbox and launch script with button "Lua ..."
Link to comment
Share on other sites

I have tried this code works fine for change target:

ClearTarget(); TargetUnit("pet");  CastSpellByName("Misdirection"); TargetLastEnemy();
(you can try lua script in: "General Settings" > "Others" tab > "Development Tools" (put lua script in textbox and launch script with button "Lua ..."

Got that working with just CastSpellByName("Misdirection"); SpellTargetUnit("pet"); it was just the "'s that were giving me errors earlier.  Is there a way to make Conditions OR besides making 2 copies of the spell?  Also, would it be possible to add a debugging type option, to make the log show decisions it made in a lot more detail?  Would help a lot for troubleshooting profiles, cuz i'm having some difficulty figuring out why a few conditions are firing off irregularly.

Link to comment
Share on other sites

For OR conditions there is no other solution than to make a spell copy (I don't view how I can add "OR" condition without adding difficulty for create fightclass).

 

And I'll add debug mode in fightclass (I'll add more log in this mode).

 

You can also convert your fightclass in C# for more flexibility (and debug).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...