• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] Started with LUA, simple trigger not running

Status
Not open for further replies.
Level 14
Joined
Feb 5, 2018
Messages
581
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: 64
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:
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.
 
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.
Back
Top