- Joined
- Mar 3, 2009
- Messages
- 327
-
Custom script: local unittype utype = GetUnitTypeId(GetTriggerUnit())
is it saying that GetUnitTypeId(GetTriggerUnit()) isn't valid as a unit type?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Custom script: local unittype utype = GetUnitTypeId(GetTriggerUnit())
Custom script: call CreateNUnitsAtLoc( 1, ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())], 270

I gets a compile error saying "type mismatch in assignment"
Custom script: local unittype utype = GetUnitTypeId(GetTriggerUnit())
is it saying that GetUnitTypeId(GetTriggerUnit()) isn't valid as a unit type?
Custom script: local integer utype = GetUnitTypeId(GetTriggerUnit())
CreateNUnitsAtLoc( integer numberofunits, integer UnitID, player OwningPlayer, location Position, real facing angle)
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)
Custom script: call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())]), 270)
thanks. one more thing... call CreateUnitAtLoc( ii, Player(11), udg_Creep_Point[GetUnitUserData(GetTriggerUnit())]), 270) expected end of line :/
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.
CreateUnitAtLoc takes integer, player, location, real returns nothing
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.
My bad, you're correct. Sorry.
As adikutz stated, simply use (ii, etc.
whose adikutz? ^^
