• 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.

[Solved] Create 1 unit and set it in a variable (not last created unit)

Status
Not open for further replies.
Level 2
Joined
Sep 1, 2023
Messages
7
Hey guys how can I 'convert' this trigger to a custom script? Or something...any ideas?
 

Attachments

  • dummyunit.jpg
    dummyunit.jpg
    29 KB · Views: 17

Remixer

Map Reviewer
Level 33
Joined
Feb 19, 2011
Messages
2,112
Hey guys how can I 'convert' this trigger to a custom script? Or something...any ideas?
Hello!
You can convert the whole trigger into a custom script through the Edit menu:
UcFGhW2[1].png

But if you want to use just one command of custom script, you need to add the action Custom Script from the regular actions menu and write the action.
vajJ835[1].png
 
Level 2
Joined
Sep 1, 2023
Messages
7
Hello!
You can convert the whole trigger into a custom script through the Edit menu:
View attachment 451555
But if you want to use just one command of custom script, you need to add the action Custom Script from the regular actions menu and write the action.
View attachment 451556
Not exactly the answer I was looking for, but it definitely helped me find the solution (which answered my question). Thanks! +REP
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,875
Not exactly the answer I was looking for, but it definitely helped me find the solution (which answered my question). Thanks! +REP
It's the exact answer to your question, lol.

I think you meant convert the Action to Custom Script, in which case it would be this:
  • Custom script: set udg_Dummy1 = GetLastCreatedUnit()
 
Level 2
Joined
Sep 1, 2023
Messages
7
It's the exact answer to your question, lol.

I think you meant convert the Action to Custom Script, in which case it would be this:
  • Custom script: set udg_Dummy1 = GetLastCreatedUnit()
I guess that's what I said but what I meant is this:

create a unit and set a variable to it without setting it to last created unit. i know its only possible with custom scripts or jass so thats how i found the answer
 

Attachments

  • adadassss.jpg
    adadassss.jpg
    29.6 KB · Views: 12
Level 20
Joined
Jan 3, 2022
Messages
364

JASS:
// var used for the first time
unit myCustomVar = CreateUnit(Player(0), 'hfoo', -30, 0, 90)

// var is reused
set myCustomVar = CreateUnit(Player(0), 'hfoo', -30, 0, 90)
If you want to use a var in GUI triggers, create a variable in GUI and then reuse it with udg_ prefix in custom Jass code. like udg_myGuiVar
 
Last edited:
Status
Not open for further replies.
Top