HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

MoveMent

02-12-2008, 01:52 AM#1
weedcraft
Collapse JASS:
function Electricity takes nothing returns nothing
    local integer a = 0
    local real x = 0.
    local real y = 0.
    local unit u = gg_unit_e000_0029
    local unittype id = "e000"
    x = GetUnitX(u) - 100
    y = GetUnitY(u)
        loop
    call CreateUnit(PLAYER_NEUTRAL_PASSIVE, id, x, y, 90.)
    x = x - 100
    set a = a + 1
    exitwhen a>5
endloop
    'set' x = x - 100
    call CreateUnit(PLAYER_NEUTRAL_PASSIVE, GetUnitTypeId(u), x, y, 90.)
endfunction

ok so basicly im trying to make a unit move up and down randomly and on the opposite side of the unit i want another unit to move in sync with it. Ok now i want the unit to stop and create a line of units between the two outer units and then remove them and repeat. Example. *-----* The stars are the two outer units and the - r the units created between them can some one review this and help me go in the right direction with this.
02-12-2008, 05:59 AM#2
Pyrogasm
And...? You've told us what you want to do, but are there problems? What does that code mean?
02-12-2008, 07:06 AM#3
Silvenon
Collapse JASS:
local unittype id = "e000"
// ...
call CreateUnit(PLAYER_NEUTRAL_PASSIVE, id, x, y, 90.)

Err.... unittype id was not what you wanted.

First of all, those aren't strings, they are integers. Second, some unittype examples: UNIT_TYPE_HERO, UNIT_TYPE_DEAD, UNIT_TYPE_MECHANICAL.....

Why don't you use integer instead of unittype? And then you would also have to replace " with '. In the second CreateUnit line you're using an integer anyways. GetUnitTypeId returns an integer, not unittype:

constant native GetUnitTypeId takes unit whichUnit returns integer

I got this from common.j, if you don't believe me:

Collapse JASS:
constant unittype UNIT_TYPE_HERO                        = ConvertUnitType(0)
constant unittype UNIT_TYPE_DEAD                        = ConvertUnitType(1)
constant unittype UNIT_TYPE_STRUCTURE                   = ConvertUnitType(2)

constant unittype UNIT_TYPE_FLYING                      = ConvertUnitType(3)
constant unittype UNIT_TYPE_GROUND                      = ConvertUnitType(4)
// .....
02-12-2008, 02:00 PM#4
chobibo
call CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), id, x, y, 90.)
02-12-2008, 07:01 PM#5
Silvenon
Yeah, and that too.

Obviously this code hasn't been through the syntax checker yet... :P
02-12-2008, 09:12 PM#6
weedcraft
Ok some one just gave me this code and said this is what you want to do... lol so ok what would my event be? and would this make my outer units move?