How to use Vector(Harrowland)

well, she just don’t let me move

Like this:

No… Limit it to a number you want it to stand

What did you mean, ex?

изображение
Like this. You limit the vector to a number

then what num should i use?

You command the archer to shield??? :laughing: :laughing: :laughing:

Any number you want. For example, I use 4,5 because if the paladin will move too close to me, it will not be good, so I keep 4,5

Then mabye I should use 4.5 too

Nah, 2 years ago I was summoning archers instead of paladins, and friends were called archers, and now I’m lazy to change it to “friend”.

Where should i put:

def onSpawn():
    while True:
        pet.moveXY(49, 33)
        pet.shapeShift()
def findStrongestEnemy():
    strongest = None
    strongestHealth = 0
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy.health > strongestHealth:
            strongestHealth = enemy.health
            strongest = enemy
    return strongest
pet.on("spawn", onSpawn)
while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != 'sand-yak':
        hero.scattershot(enemy)
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", enemy)
    if hero.gold >= hero.costOf('paladin'):
        hero.summon('paladin')
    paladins = hero.findByType("paladin",hero.findFriends())
    for paladin in paladins:
        if paladin.canCast('heal'):
            hero.command(paladin, "cast", 'heal',hero)
        else:
            enemyHero = findStrongestEnemy()
            if enemyHero:
                palaVec = Vector.limit(hero.pos, enemyHero.pos)
                if paladin.pos == palaVec:
                    hero.command(paladin, "shield")
                else:
                    hero.command(paladin, "move", palaVec)
    for friend in hero.findFriends():
        if friend.type != 'fake-peasant' and friend.type != 'paladin':
            hero.command(friend, "defend", hero)
    if hero.isReady("heal"):
        hero.heal(hero)

Put what? The limit? To the Vector you want your paladin move.

doesn’t work:


mabye my code is wrong

yeah, it’s wrong
why did you remove the subtract vector?
you should limit it, not something else


nooo…

You use () wrong.
Vector.limit is Vector.limit()

so two limit? :thinking:??

No…
Vector.limit(Vector.subtract(hero.pos,enemyHero.pos),4.5)
That is the Vector you have
I don’t know which one you want

SO, just this:

def onSpawn():
    while True:
        pet.moveXY(49, 33)
        pet.shapeShift()
def findStrongestEnemy():
    strongest = None
    strongestHealth = 0
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy.health > strongestHealth:
            strongestHealth = enemy.health
            strongest = enemy
    return strongest
pet.on("spawn", onSpawn)
while True:
    enemy = hero.findNearestEnemy()
    if enemy and enemy.type != 'sand-yak':
        hero.scattershot(enemy)
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", enemy)
    if hero.gold >= hero.costOf('paladin'):
        hero.summon('paladin')
    paladins = hero.findByType("paladin",hero.findFriends())
    for paladin in paladins:
        if paladin.canCast('heal'):
            hero.command(paladin, "cast", 'heal',hero)
        else:
            enemyHero = findStrongestEnemy()
            if enemyHero:
                palaVec = Vector.limit(hero.pos, enemyHero.pos)
                if paladin.pos == palaVec:
                    hero.command(paladin, "shield")
                else:
                    hero.command(paladin, "move", palaVec)
    for friend in hero.findFriends():
        if friend.type != 'fake-peasant' and friend.type != 'paladin':
            hero.command(friend, "defend", hero)
    if hero.isReady("heal"):
        hero.heal(hero)

Try if it works.
That’s not the Vector that I use though.