I need some Programming help with my Projekt

edited July 2015 in Questions

Hey guys i recently started working on a Projekt and since i am new to Luna it turned out be quite troublesome, so i hoped you could help me out a bit. So i have quite some questions.For starters: I created a "item" that will spawn a creep when i buy it... at least thats what it should do. /edit: i figured out a way how to do it using OnItemPurchased:

function SampleRTS:OnItemPurchased( keys )
    local plyID = keys.PlayerID
    if not plyID then return end

    local point1 = Entities:FindByName( nil, "spawner1"):GetAbsOrigin()

    local TeNum = PlayerResource:GetTeam(plyID)
    ----- good guys=Radiands=2, bad guys=dire =3,
    print(TeNum,plyID)
    if TeNum == 2 then local unit = CreateUnitByName("npc_dota_creature_basic_zombie", point1, true, nil, nil, DOTA_TEAM_NEUTRALS)  end

    -- The name of the item purchased
    local itemName = keys.itemname

    -- The cost of the item purchased
    local itemcost = keys.itemcost

end