JASS - create unit at X/Y

Level 12
Joined
Jan 13, 2008
Messages
559
Why does the unit not get created? I use JNGP and don't receive any error while saving, so I guess the custom script is correct?

I have a grid of size 14x16 and want to spawn a unit at a random area in this grid but the unit doesn't appear.

  • PlayerSpawn
    • Events
      • Player - Player 1 (Red) types a chat message containing c as An exact match
    • Conditions
    • Actions
      • Set tempInteger = (Random integer number between 1 and 14)
      • Game - Display to (All players) the text: (String(tempInteger))
      • Set player_X[1] = ((Real(tempInteger)) x 2000.00)
      • Set tempInteger = (Random integer number between 1 and 16)
      • Game - Display to (All players) the text: (String(tempInteger))
      • Set player_Y[1] = ((Real(tempInteger)) x 2000.00)
      • Custom script: call CreateUnit(Player(0), 'htwo', udg_player_X[1],udg_player_Y[1], bj_UNIT_FACING )
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Are you sure the position is on the map? 2000*14 is quite a lot. Apart from that everything seems ok, as long as the unit typde id is correct, as Nowow already said.
 
Top