Spawnage?

Curuinor

New Member
Reaction score
7
Is there any way to take text or number chat input and save it, so that you can turn it into, say, a unit-type, so you can make a spawning trigger in one trigger? I have a map that I'm planning to add a secret RP mode to, so not having to make a trigger for every single spawnable unit-type would be nice.
 

Jazradel

Helping people do more by doing less.
Reaction score
102
I assume S2I would work.

Edit: I tried it out and it doesn't. I also tried using the return bug and that didn't work.

The best thing to do right now would be something like this:

Code:
function S2U takes string s returns integer
      if s == "h005" then
            return 'h005'
      elseif s == "n001" then
            return 'n001'
      endif
      return 0
endfunction
 

Curuinor

New Member
Reaction score
7
I assume S2I would work.

Edit: I tried it out and it doesn't. I also tried using the return bug and that didn't work.

The best thing to do right now would be something like this:

Code:
blah blah blah

That sounds like I'll have to make a secret td mode, then.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
IDs don't work like that...

To turn 'A123' into the actual integer:

"0" = 48
"1" = 49
...
"9" = 57
"A" = 65
"B" = 66
...
"F" = 70

The number is:
(("A" * 256 + "1") * 256 + "2") * 256 + "3"
(After replacing the numbers with the value from the list.)



But, why not make two lists?

One with strings:
Set word[1] = "Hello"
Set word[2] = "world"
...

And one with unit-types:
Set unit[1] = Footman
Set unit[2] = Knight

And, if a word is typed, find it in the word list and create the corresponding unit from the unit list.
As in, if you type "Hello", it would create a footman.



Either way, you have to make sure to test the input before trying to create a unit that doesn't exist.


> I also tried using the return bug and that didn't work.

Trying to return a string as integer will return the handle of the string, not its string converted to a number...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top