• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

JASS - create unit at X/Y

Status
Not open for further replies.
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.
 
Status
Not open for further replies.
Top