• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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