• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Started with LUA, simple trigger not running

Status
Not open for further replies.
Level 13
Joined
Feb 5, 2018
Messages
567
function OnMapStart()
local u = CreateUnit(Player(0), 'hfoo', 0, 0, 270)
BlzSetUnitName(u, "Footy")
end
function luainit()
TimerStart (CreateTimer(), 00, false, OnMapStart)
end

I just tried to create one unit on map start.
Here is the text I copied to the custom script.

And an I mage below of the Lua Script made with VS code.
 

Attachments

  • ImageA.png
    ImageA.png
    11.1 KB · Views: 43

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
Your timer is set to "00". Set it to 0.00.
Also, where are you calling luainit? luainit isn't going to run until you call it.

And you can copy and paste your lua code like so:

[*code=lua]
function OnMapStart()
local u = CreateUnit(Player(0), 'hfoo', 0, 0, 270)
BlzSetUnitName(u, "Footy")
end
function luainit()
TimerStart (CreateTimer(), 00, false, OnMapStart)
end
[*/code]

Remove the asterisks (*)

Lua:
function OnMapStart()
local u = CreateUnit(Player(0), 'hfoo', 0, 0, 270)
BlzSetUnitName(u, "Footy")
end
function luainit()
TimerStart (CreateTimer(), 00, false, OnMapStart)
end
 
Last edited:
Level 13
Joined
Feb 5, 2018
Messages
567
Lua:
function OnMapStart()
local u = CreateUnit(Player(0), 'hfoo', 0, 0, 270)
BlzSetUnitName(u, "Footy")
end
function luainit()
TimerStart (CreateTimer(), 0.00, false, OnMapStart)
end

  • Start
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: luainit()
So like this, but it's still not working.
 
Level 8
Joined
Jun 16, 2008
Messages
333
You don't need a timer either if its going to be instant. just call the function OnMapStart()

Lua:
function OnMapStart()
local u = CreateUnit(Player(0), FourCC("hfoo"), 0, 0, 270)
BlzSetUnitName(u, "Footy")
end

  • Start
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: OnMapStart()
 
Status
Not open for further replies.
Top