Jump to content

Recommended Posts

For an extensive treatment I use a healing potion. In the fourth cell of the character's backpack is a healing potion. as in 3 and 5. Just in case. In the class of the character, the following is written.

    <FightClassSpell>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>HealthPercent</ContionType>
          <Param xsi:type="FightClassConditionNumber">
            <Type>Smaller</Type>
            <Value>50</Value>
          </Param>
        </FightClassCondition>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>UseContainerItem(0, 4); </LuaScript>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>Heal Use </SpellName>
      <Priority>1</Priority>
      <AddToSettings>true</AddToSettings>
      <AddToSettingsActiveByDefault>true</AddToSettingsActiveByDefault>
      <Timer>60000</Timer>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <DescriptionSpell>Маленький флакон с лечебным зельем</DescriptionSpell>
      <CastOnSelf>true</CastOnSelf>
      <CastOn>player</CastOn>
    </FightClassSpell>

But

11:13:18 - [Fight] Player Attack Большой шкуродер (lvl 17)
[F] 11:13:19 - [Spell] Cast Порча (Corruption)
[F] 11:13:19 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:22 - [Spell] Cast Жертвенный огонь (Immolate)
[F] 11:13:22 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:22 - [FightClass] Launch LUA script: Heal Use 
[F] 11:13:24 - [Spell] Cast Проклятие агонии (Curse of Agony)
[F] 11:13:24 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:29 - [Spell] Cast Страх (Fear)
[F] 11:13:29 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:32 - [Spell] Cast Страх (Fear)
[F] 11:13:32 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:34 - [Spell] Cast Похищение жизни (Drain Life)
[F] 11:13:38 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:41 - [Spell] Cast Похищение души (Drain Soul)
[F] 11:13:41 - [Spell] Cast Выстрел (Shoot)
[F] 11:13:49 - [Spell] Cast Похищение души (Drain Soul)
11:13:49 - [Resurrect] Player dead
11:14:38 - [Resurrect] Player retrieve corpse

The bot reports the execution of the command. But the healing potion does not suffer.

[F] 11:13:22 - [FightClass] Launch LUA script: Heal Use 

Through the tool DevelopmentTools, the command is executed and 1 unit of the potion is consumed.

UseContainerItem(0, 4);

// ret = nil
// Execute time: 15

How the code should be written to treat the character in combat with the help of the Potion of Healing. Anyone. Located in the 4th compartment of the backpack.

 

Link to comment
https://wrobot.eu/forums/topic/9023-the-lua-code-is-not-executed-by-the-bot/
Share on other sites

It Work )))

[F] 06:36:22.552 - [Spell] Cast Правосудие (Judgement)
[F] 06:36:26.606 - [FightClass] Launch LUA script: UseContainerItem(0, 4);
[F] 06:36:28.858 - [Spell] Cast Вспышка Света (Flash of Light)

Now the spell is CALLED AND EXECUTED.  The final version looks like this.

    <FightClassSpell>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>HealthPercent</ContionType>
          <Param xsi:type="FightClassConditionNumber">
            <Type>Smaller</Type>
            <Value>20</Value>
          </Param>
        </FightClassCondition>
        <FightClassCondition>
          <ContionType>ManaPercent</ContionType>
          <Param xsi:type="FightClassConditionNumber">
            <Type>Smaller</Type>
            <Value>10</Value>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>UseContainerItem(0, 4);</SpellName>
      <Priority>43</Priority>
      <Timer>60000</Timer>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
    </FightClassSpell>

Thx Master Droidz

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...