[Help] Say() function and Hero Selection Remove

As the titles suggests, I'm trying to do two things.

When i use the "Say()" function it returns an error: [ W VScript ]: Script Runtime Error: scripts/vscripts/events.lua:340: attempt to index a nil value [ W VScript ]: stack traceback: [ W VScript ]: scripts/vscripts/events.lua:340: in function <scripts/vscripts/events.lua:337> [ W VScript ]: [C]: in function 'Say' [ W VScript ]: scripts/vscripts/events.lua:355: in function <scripts/vscripts/events.lua:337>

It works fine, shows the COnsole message to all players, but this log shows up in'game as a red text.

Also, I'm trying to find a way to have no hero picked to everyone, like removing the Hero Selection phase, and give a hero to a player in another situation.

What I have to do?


  • Posts: 184

    we obviously can't help you with just the error messages. please pastebin your events.lua.

    Treat everyday as if you are a student, not a master. The student learns, grows and sees beauty. The master becomes bitter, resentful, and stagnates.

    Posts: 8

    function GameMode:OnPlayerChat(keys) local teamonly = keys.teamonly local userID = keys.userid local playerID = self.vUserIds[userID]:GetPlayerID() local text = keys.text if self.firstLoad[playerID] == nil then self.firstLoad[playerID] = 1 end print(self.firstLoad[playerID]) if(text == "load")then if self.firstLoad[playerID] == 1 then self.firstLoad[playerID] = 2 local hero = CreateHeroForPlayer("npc_dota_hero_axe", PlayerResource:GetPlayer(self.vUserIds[userID]:GetPlayerID()) ) hero:SetControllableByPlayer(playerID, true) item1=CreateItem("item_blink", hero, hero) item1:SetPurchaseTime(0) hero:AddItem(item1) else Say(self, "You can't load more than once per game!", true) end end return text end

    this is the code.

    Posts: 8


    Disconsider above ...