Some questions about vJass

Status
Not open for further replies.
Level 18
Joined
Mar 21, 2011
Messages
1,622
Hi :)

Question No.1:

I think it is ok to use the following functions, but i dont know if there is a better way:
UnitInventoryCount
UnitAddItemByIdSwapped


Question No.2:

can you read the length of an array?


Question No.3:

How can i get an offset point in vJass?
i did it like this, but i'm not sure if this is the best solution
JASS:
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x2 = GetLocationX(Location(x, y)) + 600.00 * Cos(f * bj_DEGTORAD)
    local real y2 = GetLocationY(Location(x, y)) + 600.00 * Sin(f * bj_DEGTORAD)



thats it, thank you!
 
I think it is ok to use the following functions, but i dont know if there is a better way:
UnitInventoryCount
UnitAddItemByIdSwapped
Both are non-native functions (BJs), which means you can replace them by their implementation.
List of BJs: https://warcraft.ingame.de/maps/mappedia/Blizzard.j

The implementation of BJs are compositions of jass language elements and native functions.
List of natives: http://warcraft.ingame.de/maps/mappedia/Common.j

Just do a fulltext search for your functions.


can you read the length of an array?
No, arrays always have length 8192.
You can search the array for the last entry by looping through it...

How can i get an offset point in vJass?
i did it like this, but i'm not sure if this is the best solution
JASS:
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real x2 = GetLocationX(Location(x, y)) + 600.00 * Cos(f * bj_DEGTORAD)
    local real y2 = GetLocationY(Location(x, y)) + 600.00 * Sin(f * bj_DEGTORAD)

Replace GetLocationX(Location(x, y)) with x. Same with y..
Apart from that its fine.
 
Status
Not open for further replies.
Back
Top