HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

unit taking a stroll?

03-20-2004, 12:32 AM#1
-={tWiStÄr}=-
I have a spell that transforms a unit. but it really doesnt.. it just moves the unit using the spell to a corner and replaces it with the new unit. This all goes perfect except for 1 thing. Just out of the blue, if there are any idle units in the area, they walk out so far, then come back. They come back for 2 reasons. they reach the end of thier walk, or i use the spell to move the hero back to where he was, and untransform. heres the trig for transforming:
Code:
Mount HorseON T1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Unit-type of (Casting unit)) Equal to |c00ff0000Knight Council Leader|r
        (Ability being cast) Equal to Mount Horse 
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Casting unit)) Equal to Player 1 (Red)
                (Owner of (Casting unit)) Equal to Player 3 (Teal)
                (Owner of (Casting unit)) Equal to Player 5 (Yellow)
                (Owner of (Casting unit)) Equal to Player 7 (Green)
                (Owner of (Casting unit)) Equal to Player 9 (Gray)
    Actions
        Custom script:   local real life
        Set skilllevel = (Level of Transformations  for (Casting unit))
        Set transformhero[1] = (Casting unit)
        Custom script:   set life = GetUnitLifePercent(udg_transformhero[1])
        Unit - Create 1 Transformunittype[skilllevel] for (Owner of (Casting unit)) at (Position of transformhero[1]) facing Default building facing degrees
        Set TransformGameUnit[1] = (Last created unit)
        Custom script:   call SetUnitLifePercentBJ(udg_TransformGameUnit[1], life) 
        Unit - Create 1 Exp. gainer for Player 11 (Dark Green) at (Position of TransformGameUnit[1]) facing Default building facing degrees
        Set transformunitfollow[1] = (Last created unit)
        Unit - Order transformunitfollow[1] to Follow TransformGameUnit[1]
        Unit - Change ownership of transformhero[1] to Neutral Extra and Change color
        Unit - Move transformhero[1] instantly to (Center of Heromove <gen>)
        Unit - Order TransformGameUnit[1] to Stop
        Selection - Add TransformGameUnit[1] to selection for (Owner of TransformGameUnit[1])
and untransforming:
Code:
Mount HorseOFF T1
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Revert 
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Casting unit)) Equal to |c00ff0000Knight (Mounted)|r [1]
                (Unit-type of (Casting unit)) Equal to |c00ff0000Knight (Mounted)|r [2]
                (Unit-type of (Casting unit)) Equal to Knight (Mounted) [3]
                (Unit-type of (Casting unit)) Equal to Knight (Mounted) [4]
                (Unit-type of (Casting unit)) Equal to Knight (Mounted) [5]
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Casting unit)) Equal to Player 1 (Red)
                (Owner of (Casting unit)) Equal to Player 3 (Teal)
                (Owner of (Casting unit)) Equal to Player 5 (Yellow)
                (Owner of (Casting unit)) Equal to Player 7 (Green)
                (Owner of (Casting unit)) Equal to Player 9 (Gray)
    Actions
        Custom script:   local real life
        Custom script:   set life = GetUnitLifePercent(udg_TransformGameUnit[1])
        Custom script:   call SetUnitLifePercentBJ(udg_transformhero[1], life)
        Unit - Move transformhero[1] instantly to (Position of (Casting unit))
        Unit - Remove (Casting unit) from the game
        Unit - Change ownership of transformhero[1] to (Owner of (Casting unit)) and Change color
        Hero - Set transformhero[1] experience to ((Hero experience of transformhero[1]) + (Hero experience of transformunitfollow[1])), Show level-up graphics
        Unit - Remove transformunitfollow[1] from the game
        Selection - Add transformhero[1] to selection for (Owner of transformhero[1])

so there ya go. its really wierd
P.S. how do u like my avatar? its my first .gif made by me ever ^_^
03-21-2004, 09:22 PM#2
-={tWiStÄr}=-
OK... this is the second time ive asked and no ones answered if those trigger are too much for you to read ( :< ) what they do is move the unit who cast this ability to a corner, then create this unit where the old one was. then i create a small unnoticable hero to follow the new unit to gain exp. thats really it the rest is to make it look smoother. i put in a function that seems to fix it. i dont have it on this comp but basicly
Code:
Unit group - pick every group unit in units in range of [the new unit] and do multiple actions
    IF
        Current order of picked unit = stop //because its only idle units right
    Then 
        Order picked unit to stop
    Else
        Do Nothing
it seems to work but i would really know why it didnt work in the first place.