How do you use boss star 1


#1

i need help with using the boss star 1 pls help
:disappointed_relieved::disappointed_relieved::disappointed_relieved::disappointed_relieved::disappointed_relieved::disappointed_relieved:


#2

What do you need help with? :slightly_smiling_face:


#3

In what ways? Commanding? Summoning?


#4

i need help with commanding


#5

You can click here on the Boss Star’s methods. I have highlighted it by inverting the color. (I use a Boss Star III but Boss Star I works pretty much the same way, just with less units to command and fewer commandable methods.)


Something like this will pop up once you click a method (in this case, command()).

Some come with a brief tutorial on usage, like this, for instance.
I hope this helps you :slightly_smiling_face:


#6

but when i command and summon command says find friends when i did that it says agan find nearest friends


#7

but when i command and summon command says find friends when i did that it says agan find nearest friends


#8

here’s an example code:

friends=hero.findFriends()
for friend in friends:
    if friend.type=='artillery':
        hero.command(friend,'defend',self)

#9

i want to have it easier
pls :grinning:


#10

Try this:

while True:
    soldier=hero.findByType('soldier')[0]
    if soldier:
        hero.command(soldier, defend,self)

#11

ok trying it (20 chars )


#12

it doesn’t work (20 chars)


#13

EDIT: This is python. Scroll down to next post for Lua.

Here you go. (Click picture to expand)

Notes
  • You can’t command peasants, paladins, or griffin-riders with the Boss Star I
Code (if you really need it...)
# Boss Star I -- How to use

# hero.summon(summonType)
# For Boss Star I, the only summonType available is "soldier".
hero.summon("soldier") # make sure to include quotes

# However, summoning a unit will cost gold.
# You should check to see if you have enough gold to summon a unit:
if hero.gold > hero.costOf("soldier"):
    hero.summon("soldier")

# If you have a soldier summoned, or if you have any friends,
# you can command them by using hero.command()
# However, you need to find your friends first:
friends = hero.findFriends() # (list of all friends)
# or
soldiers = hero.findByType("soldier") # (list of all soldiers)
# and there are other ways...

# With your list of friends, you can simply pick a friend
# and then you can hero.command() it:
nearestFriend = hero.findNearest(friends)
hero.command(nearestFriend, "move", hero.pos)
# or you can command all your friends:
for friend in friends: # friend = one item, friends = list of items
    hero.command(friend, "move", hero.pos)

# You can command your friends to do other things than just "move".
# With the Boss Star I, the available commands are:
# "move", "attack", and "defend"

# "move" command examples:
hero.command(friend, "move", {'x': 15, 'y': 15})
hero.command(hero.findNearest(friends), "move", enemy.pos)
# tip: you can insert a position into your code by holding shift
# and clicking any point on the map

# "attack" command example:
friendTarget = friend.findNearestEnemy()
if friendTarget:
    hero.command(friend, "attack", friendTarget)

# "defend" command example:
hero.command(friend, "defend", hero) # can target a unit
hero.command(friend, "defend", {'x': 15, 'y': 15}) # or position

# The Boss Star I can also command archers:
archer = hero.findNearest(hero.findByType("archer"))
hero.command(archer, "move", {'x': archer.pos.x, 'y': 15})

#14

@Benjamin_van_den_Bra I forgot that you use Lua. Anytime you ask another question, remember to at least tell us what programming language you are using. If you don’t, you’ll probably get answers in python, where most of the code won’t work in Lua.

I recommend switching to python if you are a beginner. The documentation and examples for the Lua commands (the API list that Hellenar posted pictures of) aren’t completely developed.

How to use the Boss Star I (Lua)
-- Boss Star I -- How to use, Lua version

--------------------------------------------------------
-- To summon a soldier:
hero:summon("soldier")

-- Summoning units costs gold.
-- So, you should probably check if you have enough gold first:
if hero.gold >= hero:costOf("soldier") then
    hero:summon("soldier")
end

-- summoning as many soldiers as you can afford:
while hero.gold >= hero:costOf("soldier") do
    hero:summon("soldier")
end

--------------------------------------------------------
-- The Boss Star I can only command soldiers and archers
local friends = hero:findFriends()
for i, friend in pairs(friends) do
    if friend.type == "soldier" then
        hero:command(friend, "move", hero.pos)
    elseif friend.type == "archer" then
        hero:command(friend, "move", {x=15, y=15})
    end
end
--------------------------------------------------------
-- The Boss Star I has only 3 types of commands:
-- "move", "attack", and "defend"

-- "move" examples
local friend = hero:findNearest(hero:findFriends())
hero:command(friend, "move", hero.pos)
hero:command(friend, "move", {x=15, y=15})

-- "attack" example
local enemy = friend:findNearestEnemy()
if enemy then hero:command(friend, "attack", enemy) end

-- "defend" example
hero:command(friend, "defend", hero)
hero:command(friend, "defend", {x=15, y=15})

(continued ramble) Ok, I’ve worked with Lua before I played CodeCombat, but there is barely anything documented over here. You have to search for documentation elsewhere if you want to learn Lua. Learning Lua on CodeCombat as your first programming language is definitely not beginner friendly.


#15

but boss star 1 says that i can summon a archer but i cant do it


#16

Nope, you can only command archers with the Boss Star I.

Screenshot (38)

-- works:
hero:command(archer, "move", hero.pos)

-- does not work:
hero:summon("archer")

#17

now i understand that thx