[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: 25
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
 
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
 
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()
 
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: 22

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.
Back
Top