HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Help] What Do These Things Look Like?

04-22-2008, 01:21 PM#1
Tide-Arc Ephemera
I honestly have looked through some things but didn't find my answer...
___

1. What do "string unitnames" look like?
Collapse JASS:
native GroupEnumUnitsOfType                 takes group whichGroup, string unitname, boolexpr filter returns nothin

2. What do "unit IDs" look like?
Collapse JASS:
native          CreateUnit              takes player id, integer unitid, real x, real y, real face returns unit

// Unit IDs look like 'e000' with ' instead of ", correct?

3. What do "Player IDs" look like?
Collapse JASS:
native          CreateUnit              takes player id, integer unitid, real x, real y, real face returns unit
04-22-2008, 01:35 PM#2
TheDamien
AFAIK:

1. String unitnames are like this: "footman", "ghoul", etc.

2. Unit IDs are like 'this'. They are actually integers, the characters inside the '' are considered as their ASCII values.

3. An actual player ID is an integer (0, 1, 3, etc for Players 1, 2, 3, etc.) A player handle can be given by using the Player() function on a player ID like this:

Collapse JASS:
Player(0) // Player 1
Player(1) // Player 2
Player(2) // Player 3
04-22-2008, 01:38 PM#3
Tide-Arc Ephemera
Hm, in the case of problem #1, how would I refer to a custom unit?

EDIT!
This marks my post... 1337th post.
04-22-2008, 01:41 PM#4
TheDamien
Quote:
Originally Posted by Tide-Arc Ephemera
Hm, in the case of problem #1, how would I refer to a custom unit?
I wish I knew. I don't think you can.
Quote:
Originally Posted by Tide-Arc Ephemera
EDIT!
This marks my post... 1337th post.
Congratulations.
04-22-2008, 01:46 PM#5
Tide-Arc Ephemera
Well there goes a post (two including these ones).

Though thanks for the help given so far, I'll see if I can poke someone about matter #1 though.

+Rep
04-22-2008, 01:52 PM#6
Spec
Hmm, unit name is stored in field "Name" (unam) of unit in OE, just bring it on to your code.
If you're not assured ^^ or you really don't know, you can check name with this function:
Code:
constant native GetUnitName takes unit whichUnit returns string
04-22-2008, 02:18 PM#7
Tide-Arc Ephemera
I'll try that in a moment, but another problem is starting to haunt me... I ran into a similar problem.
Collapse JASS:
native GroupEnumUnitsOfType                 takes group whichGroup, string unitname, boolexpr filter returns nothing

Now this may be extremely obvious, but what's with the boolexpr thing? Yeah um, this is how the problem has taken shape.

Collapse JASS:
function Trig_Orbit_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local real x = 0.
    local real y = 0.
    local real ang = 0.
    local real dist = 0.
    local integer i = 0
    set g = GroupEnumUnitsOfType(g, "footman", ... )
endfunction
What do I put in that third field?

@ Spec
I'll check that out... in a moment.

EDIT!
Spec, I think I'll find that one useful some time or another. Apparently custom units DO have string names.
+Rep
04-22-2008, 02:33 PM#8
chobibo
You add the filter there. for example if you would like to group footmen that has 50% hp, you make a boolexpr function to only get them. If you use null every footman within the range will be grouped.

Collapse BoolExpr for use with a group enumerator:
function BE takes nothing returns boolean
    return GetWidgetLife( GetFilterUnit() ) < GetUnitState( GetFilterUnit(), UNIT_STATE_MAX_LIFE) * .50 // filters unit that has less than 50 percent hitpoints
endfunction

function Trig_Orbit_Actions takes nothing returns nothing
    local group g = CreateGroup()
    local unit u
    local real x = 0.
    local real y = 0.
    local real ang = 0.
    local real dist = 0.
    local integer i = 0
    call GroupEnumUnitsOfType(g, "footman", Filter( function BE) )
endfunction 

EDIT: Changed the error within the code
04-22-2008, 02:40 PM#9
Tide-Arc Ephemera
I'm probably doing something very wrong, but set g = GroupEnumUnitsOfType(g, "orb", null) spits out the error of "Type mismatch in assignment" in UMSWE, but "Cannot assign expression 'nothing' to 'group'" in JassDemo.

Any light on this?
04-22-2008, 02:43 PM#10
Spec
Boolexpr is some type of "boolean function". Mostly used to specify stats for picked widget (i.e. units or destructables).

Yeah, the error is obvious, function GroupEnumUnitsOfType returns nothing ^^

EDIT:
You should write approximately that:
Code:
call GroupEnumUnitsOfType(g, "orb", null)
04-22-2008, 02:50 PM#11
chobibo
Spec's code will work tide, the function itself sets the units to the group no need to set the group call GroupEnumUnitsOfType( g, "footman", null) my previous post was apparently incorrect.
04-22-2008, 02:50 PM#12
Tide-Arc Ephemera
How in holy hell does that work... it worked, yes... but I don't understand. Though I'm happy now! Time to get the rest of my trigger working.
04-22-2008, 02:53 PM#13
chobibo
The function itself requires the group, the function takes the group "g" then groups all units of type "footman" and adds it to the group g
04-22-2008, 03:06 PM#14
Pyrogasm
Notice how in the function it doesn't say "returns group" (native GroupEnumUnitsOfType takes group whichGroup, string unitname, boolexpr filter returns nothing), and without a return value you can't set anything equal to it!
04-22-2008, 05:15 PM#15
Vexorian
UnitId2String('hfoo') returns "footman"