• 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.

Type mismatch in assignment?

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
thanks, i fixed that part at least, but now
  • Custom script: call CreateNUnitsAtLoc( 1, ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())], 270
expects '
i've tried putting apostrophes around all of the things in the list (i think) but then it expects an expression.

JASS is like my maths teacher :/
 
Last edited:
Level 14
Joined
Jul 26, 2008
Messages
1,009
Your new problem is that you're trying to use whatever ii is as a unit, when it needs a unittypeid. So find the rawcode of the unit you want to create, and do the ' ' around that rawcode. Or if you've already saved the unittype you want created, then place the variable in that spot (Like utype).

Also, try using the native, it doesn't create a leak and it's a little easier to use. Also, try using coordinates instead of location. (Not sure why, was just suggested to me :0 )

CreateUnitLoc( Player(11), 'unit', udg_Creep_Point[GetUnitUserData(GetTriggerUnit())], 270)

Also, you can use bj_UNIT_FACING if you want to use the default facing degree instead of 270.

If you want to avoid using locations, and use X and Ys, you may need new variables for that.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
That all depends on how you filled in the variable ii. I mean, what did you set it as? Are you trying to make the trigger target a unit and save that unit's unit type, then spawn more of that unit type?

Or . . . ? I'm not sure.

But if it helps, GetUnitTypeId(ii) should get the unit type of the unit for you.
 
  • Custom script: local unittype utype = GetUnitTypeId(GetTriggerUnit())
I gets a compile error saying "type mismatch in assignment"
is it saying that GetUnitTypeId(GetTriggerUnit()) isn't valid as a unit type?

The GUI "Unit Type" is actually an integer in JASS. so it should be:
  • Custom script: local integer utype = GetUnitTypeId(GetTriggerUnit())
Oh, you posted another trigger, the variable ii should be of type integer. See this (it contains the parameters/arguments that the action CreateNUnitsAtLoc needs)
JASS:
CreateNUnitsAtLoc( integer numberofunits, integer UnitID, player OwningPlayer, location Position, real facing angle)

btw, if you'll just create 1 unit just use CreateUnitAtLoc
 
Level 8
Joined
Mar 3, 2009
Messages
327
Alright one more error and i should be good. this time it's "Invalid argument type(integer)"

  • Event:
  • Unit - A unit dies
  • Conditions:
  • Unit type of triggering unit is a hero equal to false.
  • Custom value of triggering unit is greater than 0
  • Actions:
  • Custom script: local integer i = GetUnitUserData(GetTriggerUnit())
  • Custom script: local integer ii = GetUnitTypeId(GetTriggerUnit())
  • Wait 10.00 seconds
  • Custom script: call CreateUnitAtLoc(GetUnitTypeId(ii), Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())]), 270)
thanks guys, ill rep you after this ^^

EDIT: my jass is like converted GUI with local variables ;P
 
ii is already an integer and GetUnitTypeID is also an integer... you don't need the GetUnitTypeId already... just use ii directly... as I said above the GUI unittype is an integer in JASS....

  • Custom script: call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())]), 270)
anyway if you'll look closely at you code you will see that ii is set into GetUnitTypeId() and then you use this GetUnitTypeId(ii) so it will be like getting the UnitTypeId of a UnitTypeId.. duh... ^^

I would also recommend using full JASS since your function is full of custom scripts anyway...
 
thanks. one more thing... call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())]), 270) expected end of line :/

you have punctuation errors..... there was an extra ) in the location part...

use this....

call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())], 270)
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
2 Solutions to this problem.

Not 100% sure if Adiktuz's suggestion would work. I don't think so though. You see the first part of CreateUnitAtLoc requires a unittype, not an integer.

What you need to do is change the following:

call CreateUnitAtLoc(GetUnitTypeId(ii), etc.

to:

call CreateUnitAtLoc(ConvertUnitType(ii), etc.

That should do it perfectly. Anyways, if you're using custom script, you might as well start reading JASS tutorials and make the conversion. It can make a big difference, since GUI uses bjs, most of which will leak.

Also don't forget to remove leaks from your map.

If you do make the switch, grab JNGP before you do and use it's awesome Function List to help you figure out what natives to use and what functions you need to complete your triggers. I can explain a few small things that make a big difference too when you make that switch.
 
2 Solutions to this problem.

Not 100% sure if Adiktuz's suggestion would work. I don't think so though. You see the first part of CreateUnitAtLoc requires a unittype, not an integer.

What you need to do is change the following:

call CreateUnitAtLoc(GetUnitTypeId(ii), etc.

to:

call CreateUnitAtLoc(ConvertUnitType(ii), etc.

That should do it perfectly. Anyways, if you're using custom script, you might as well start reading JASS tutorials and make the conversion. It can make a big difference, since GUI uses bjs, most of which will leak.

Also don't forget to remove leaks from your map.

If you do make the switch, grab JNGP before you do and use it's awesome Function List to help you figure out what natives to use and what functions you need to complete your triggers.


You use JASS so you should know that its an integer... and if you don't I already said above that the "GUI Unit Type" is an integer in JASS..... and if you have JNGP you would see in the function list CreateUnitAtLoc is like this
JASS:
CreateUnitAtLoc takes integer, player, location, real returns nothing
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
You use JASS as well, and you should be aware that while the value it requires says integer, it is actually some sort of special integer called a unittype.

I never understood myself why 'A002' is both an integer and a unittype, but somehow they're not interchangable, but that just seems to be the rules of JASS. Just because it takes an integer in that spot does not mean you can put a 1 there and you'll get a unit. At least, I don't think.
 
You use JASS as well, and you should be aware that while the value it requires says integer, it is actually some sort of special integer called a unittype.

I never understood myself why 'A002' is both an integer and a unittype, but somehow they're not interchangable, but that just seems to be the rules of JASS. Just because it takes an integer in that spot does not mean you can put a 1 there and you'll get a unit. At least, I don't think.


and GetUnitTypeId returns an integer like that for example 'h001'. I guess you never actually tried that function. of course you cannot put 1 in there... if you want to know why 'A002' is an integer you can try searching for number systems, i.e. the hexadecimal system which uses 0-9 + A-F

BTW if you still doubt it you can download my missile system below and look at the creep revival trigger.
 
Level 8
Joined
Mar 3, 2009
Messages
327
call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())], 270) Invalid Argument(player) :C

While i'd love to get JNGP working and do jass, i've tried everything and it won't work. What did you guys have to change to make it work for you?
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Oops, my bad. Switch the spots of ii and Player(11)

Anyways, for JNGP I simply downloaded it, placed it in whatever folder, and updated to the newest patch for WC3 TFT (Just enter BNet for that).

From there I went back to the JNGP mainpage and looked for Vexorian's post on the first page. In his sig is a link for his JASSHelper, which I downloaded and replaced all the stuff in executables into the JASSHelper folder. You can replace the manuals too if you wish.

Then I hopped onto google and looked for "wc3 TESH" or "JASS TESH" and found the first relevant link with a post by bombersomethingorother, forgot name. Anyways he has an updated TESH download that I used to replace the TESH folder. Viola, it is now working perfectly.

EDIT: This is the TESH thing.
http://www.wc3c.net/showthread.php?t=107075
 
Status
Not open for further replies.
Top