• 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] Invalid argument type

Status
Not open for further replies.
Level 6
Joined
Oct 1, 2012
Messages
166
Heloes Hive Workshop

I have encountered a weird problem. When I try to create a unit and then set unit type variable as the last created unit, the editor says it's an invalid argument type. The code goes as follows:

JASS:
set bo = CreateUnitAtLoc(GetPlayerId(mhm),LoadIntegerBJ(liczby[24],0,udg_Tablica_inne),GetRectCenter(GetPlayableMapRect()),0)

Where 'mhm' is Triggering Player, 'liczby[24]' is a number from an array, 'udg_Tablica_inne' is a hashtable of integers. Any solutions? The whole code is kinda long, so I didn't post it here (it's a loading function). Prevously I had everything in GUI and it worked, now I tried converting last of my scripts to JASS (just for them to be JASS) and then I got the problem.
 
Let me fix this,because currently,the script leaks and uses BJS(bjs are those peach or pink-orange in color text,ex : SetStackedSoundBJ):
JASS:
local real x = GetRectCenterX(bj_initialMapPlayableArea)
local real y = GetRectCenterY(bj_initialMapPlayableArea)
local integer unitid = 'hfoo' //Footman for example
local real angle = 270 // Facing angle here
set bo = CreateUnit(mhm,unitid,x,y,myangle)
The reason why your code error is because of this : GetPlayerId(mhm) Here you take the player,not the player's id.
 
Level 6
Joined
Oct 1, 2012
Messages
166
Why, thank you, it was indeed the problem.
And, by the way, you did a typo there, it should be 'initialPlayableMapArea', just for someone with similar problem.
 
Status
Not open for further replies.
Top