- Custom script: call SetUnitX(udg_TempUnit), GetUnitX(udg_TempUnit) + udg_AmountOffset * Cos(bj_DEGTORAD * udg_Angle))
- Custom script: call SetUnitY(udg_TempUnit), GetUnitY(udg_TempUnit) + udg_AmountOffset * Sin(bj_DEGTORAD * udg_Angle))
Angle's a real.
AmountOffset is an int.
The custom scripts look like this:
SetUnitX moves Your_Unit to x_Coordinate
- Custom script: call SetUnitX(udg_Your_Unit, udg_x_Coordinate)
- Custom script: call SetUnitY(udg_Your_Unit, udg_y_Coordinate)
SetUnitY does basically the same - it moves Your_Unit, but to y_Coordinate
all variables have to have the udg_ prefix - e.g. Your_Unit variable has to look like this in custom script: udg_Your_Unit.
X and Y coordinates are real numbers, but you don't necessarily have to set them before hand.
You can get X and Y coordinates via function from point or from unit's position.
GetLocationX(udg_Your_Point) gets X coordinate from Your_Point variable.
GetUnitX(udg_Your_Unit) gets X coordinate from Your_Unit variable.
Both can be used to get Y coordinate as well.
So instead of real variable you can use one of the function above - e.g.
If you want to change the location, where the unit will be moved a bit, you can also add another number/variable there - just like pOke did - e.g.
- Custom script: call SetUnitX(udg_Your_Unit, [COLOR="red"]GetLocationX(udg_Your_Point)[/COLOR])
- - or -
- Custom script: call SetUnitX(udg_Your_Unit, [COLOR="red"]GetUnitX(udg_Your_Unit)[/COLOR])
This will move Your_Unit to the location where Your_Unit stands + 70 more on the X axis. You don't have to use numbers only, you can use another variable, or function and you're not limited to only 1 additional number - you can see in pOke's post that he in fact got the Unit's X coordinate, and add another calculations by using 2 more functions (Cos and DEGTORAD) and 2 more variables (Angle and AmountOffset) => udg_AmountOffset * Cos(bj_DEGTORAD * udg_Angle).
- Custom script: call SetUnitX(udg_Your_Unit, GetUnitX(udg_Your_Unit)[COLOR="red"] + 70[/COLOR])
Also note, that SetUnitX and SetUnitY functions ignore map pathing - so a ground unit may be moved into deep water this way, if precaution is not taken.
You can also learn more here: http://www.hiveworkshop.com/forums/miscellaneous-tutorials-456/about-movement-172309/
Try saving that unit into variable before hand and then get its X and Y coordinates using that unit variable.
i can't read it @,@
Here`s a "move part" of this code.Same :/
You should try to convert this to english since i don't understand xD
Depends what you want to do with it.is better than SetUnitX or no?
- Custom script: call SetUnitPosition(GetEnumUnit(), udg_ENG_xn, udg_ENG_yn)
Depends what you want to do with it.
SetUnitPosition breaks unit's current order, while SetUnitX/Y does not.
Also, what are you trying to achieve with this trigger?
since we can't read the whole triggers, the best way is asking
i can't read all of them!! nooootriggers are pretty large
I'm at a loss as well, dunno why one works while the other doesn't
me too..
OMG, can you set the variable with GUI function? not using scripts?
maybe i can help with that.. *maybe
posting the map with only those triggers may be betterIf I convert triggers to English text and post it in private massege, could you help? Or better give you a test map?
By any chance is the unit trying to be moved movement speed's 0?
Don't triple post use the edit button instead.
Oh yeah internet's awesome ^^
Post your triggers as asked above.
This is the trigger of the Black Hole spell (Trigger Looping) it moves the units at the center and damaging them.
- Black Hole Loop Pull
- Events
- Time - Every 0.05 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in BH_Group and do (Actions)
- Loop - Actions
- Set BH_PickedUnits = (Picked unit)
- Custom script: set udg_BH_Key = GetHandleId(udg_BH_PickedUnits)
- Custom script: set udg_BH_X = GetUnitX(udg_BH_PickedUnits)
- Custom script: set udg_BH_Y = GetUnitY(udg_BH_PickedUnits)
- Set BH_Caster = (Load (Key caster) of BH_Key in Enigma_Hashtable)
- Set BH_Reals[1] = (Load 1 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[2] = (Load 2 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[3] = (Load 3 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[4] = (Load 4 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[10] = (Load 5 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[11] = (Load 6 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[12] = (Load 7 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[13] = (Load 8 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[14] = (Load 9 of BH_Key from Enigma_Hashtable)
- Set BH_Reals[15] = (Load 10 of BH_Key from Enigma_Hashtable)
- Set BH_Counter = (Load (Key counter) of BH_Key from Enigma_Hashtable)
- Hashtable - Save (BH_Counter + 0.05) as (Key counter) of BH_Key in Enigma_Hashtable
- Set BH_SmallRadiusDistance = (Distance between (Point(BH_X, BH_Y)) and (Point(BH_PullUnitsX, BH_PullUnitsY)))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- BH_SmallRadiusDistance Less than or equal to BH_Reals[11]
- Then - Actions
- Set BH_SmallRadGroup = (Units within BH_Reals[11] of (Point(BH_X, BH_Y)) matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of BH_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and
- Custom script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in BH_SmallRadGroup and do (Actions)
- Loop - Actions
- Set BH_SmallRadiusUnits = (Picked unit)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Random real number between 0.00 and 100.00) Less than or equal to BH_Reals[12]
- Then - Actions
- -------- The bonus damage to the small radius. --------
- Unit - Cause BH_Caster to damage BH_SmallRadiusUnits, dealing BH_Reals[10] damage of attack type BH_AttackType and damage type BH_DamageType
- Custom script: call DestroyEffect (AddSpecialEffectTarget(udg_BH_SmallRadiusDamageEffect,udg_BH_SmallRadiusUnits,udg_BH_SmallRadiusAttachment))
- Else - Actions
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Random real number between 0.00 and 100.00) Less than or equal to BH_Reals[15]
- Then - Actions
- Custom script: call DestroyEffect( AddSpecialEffect(udg_BH_CenterSFX,udg_BH_X,udg_BH_Y))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- BH_CenterIgnoreUnitTypes Equal to True
- Then - Actions
- Set BH_CenterIgnoreGroup = (Units within BH_Reals[13] of (Point(BH_X, BH_Y)) matching (((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True))
- Custom script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in BH_CenterIgnoreGroup and do (Actions)
- Loop - Actions
- Set BH_CenterUnits = (Picked unit)
- Unit - Cause BH_Caster to damage BH_CenterUnits, dealing BH_Reals[14] damage of attack type BH_CenterAttackType and damage type BH_CenterDamageType
- Else - Actions
- Set BH_CenterGroup = (Units within BH_Reals[13] of (Point(BH_X, BH_Y)) matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of BH_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and
- Custom script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in BH_CenterGroup and do (Actions)
- Loop - Actions
- Set BH_CenterUnits = (Picked unit)
- Unit - Cause BH_Caster to damage BH_CenterUnits, dealing BH_Reals[14] damage of attack type BH_CenterAttackType and damage type BH_CenterDamageType
- Else - Actions
- Set BH_PullGroup = (Units within BH_Reals[3] of (Point(BH_X, BH_Y)) matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of BH_Caster)) Equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and (
- Custom script: set bj_wantDestroyGroup = true
- Unit Group - Pick every unit in BH_PullGroup and do (Actions)
- Loop - Actions
- Set BH_PickedPullUnits = (Picked unit)
- Hashtable - Save Handle OfBH_PickedPullUnits as 12 of BH_Key in Enigma_Hashtable
- Custom script: set udg_BH_PullUnitsX = GetUnitX(udg_BH_PickedPullUnits)
- Custom script: set udg_BH_PullUnitsY = GetUnitY(udg_BH_PickedPullUnits)
- Set BH_Reals[10] = (Angle from (Point(BH_PullUnitsX, BH_PullUnitsY)) to (Point(BH_X, BH_Y)))
- Custom script: set udg_BH_MX = udg_BH_PullUnitsX + udg_BH_Reals[4] * Cos( udg_BH_Reals[10] * bj_DEGTORAD)
- Custom script: set udg_BH_MY = udg_BH_PullUnitsY + udg_BH_Reals[4] * Sin( udg_BH_Reals[10] * bj_DEGTORAD)
- Custom script: call SetUnitX(udg_BH_PickedPullUnits,udg_BH_MX)
- Custom script: call SetUnitY(udg_BH_PickedPullUnits,udg_BH_MY)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Random real number between 0.00 and 100.00) Less than or equal to BH_Reals[12]
- Then - Actions
- Unit - Cause BH_Caster to damage BH_PickedPullUnits, dealing BH_Reals[1] damage of attack type BH_AttackType and damage type BH_DamageType
- Custom script: call DestroyEffect (AddSpecialEffect(udg_BH_DamageSfx,udg_BH_PullUnitsX,udg_BH_PullUnitsY))
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- BH_Counter Greater than or equal to BH_Reals[2]
- Then - Actions
- Unit - Kill BH_PickedUnits
- Unit Group - Remove BH_PickedUnits from BH_Group
- Hashtable - Clear all child hashtables of child BH_Key in Enigma_Hashtable
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (BH_Group is empty) Equal to True
- Then - Actions
- Trigger - Turn off (This trigger)
- Else - Actions
- Else - Actions
I know that, but unly now I reach absolutly workable bounce system. I dont know why.Dude with the first script you move tempunit and with the second you move picked unit ...
So what is you problem since you script move many units.
so why don't you replace the picked unit with TempUnit?
Yes replace it will make your code more readable.