How to make this MUI? (Unit Movement and positioning related)

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
Okay so here is what I'm trying to do. I wish to have an ability which when cast on any unit will make that one unit walk back and forth between two points for 3 seconds, as if confused, dazed or the likes..

So obviously I will set the two points depending on the units' current position
------------------------------
| *pos a
| | |
| Unit pos
| | |
| *pos b
------------------------------

These (a and b) will be variables, and the unit will as far as the idea goes also have to be stored in a variable, in order to make it move back and forth continually.

So now the big question.. How would I go around making this MUI?..

I need it so that it will be usable not only just by every player, but also by several units of the same player at the same time.
I thought about using GetLocalPlayer()? in some way... but this may cause the game to desync and then cause a server-split?..

I'm not very versed at JASS, only in the GUI form, so please.. any help would be appreciated
 

Samael88

Evil always finds a way
Reaction score
181
why don't you just make it work in GUI then convert it to JASS and change the variables needed into locals? That would make it MUI:thup:
 

Squishy

You can change this now in User CP.
Reaction score
127
First make some triggers to make sure every unit's custom value is different. Then make two point arrays. Now, in your trigger, when you need to set the points, make the array number the custom value of the target unit. Then when you want to move the unit, use it's custom as the array again to find the point.
 

Artificial

Without Intelligence
Reaction score
326
Here's a free-handed sketch about something that could work:
Code:
Events
    Something appropriate.
Conditions
    Something kewl, like "1 is equal to 1".
Actions
    Set TempPoint = (Position of (Triggering unit))
    Unit - Move (Triggering unit) instantly to PointA
    Unit - Order (Triggering unit) to Patrol PointB
    Custom Script:   call SetUnitX(GetTriggerUnit(), GetLocationX(udg_TempPoint))
    Custom Script:   call SetUnitY(GetTriggerUnit(), GetLocationY(udg_TempPoint))
    Wait 3.00 seconds
    Unit - Order (Triggering unit) to Stop
IIRC, SetUnitX and SetUnitY don't reset the unit's current order, so it'll patrol between the points. :)
 

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
First make some triggers to make sure every unit's custom value is different. Then make two point arrays. Now, in your trigger, when you need to set the points, make the array number the custom value of the target unit. Then when you want to move the unit, use it's custom as the array again to find the point.

I would, but I am already using custom values for something different


>>IIRC, SetUnitX and SetUnitY don't reset the unit's current order, so it'll patrol between the points.
- Well this would cause the unit to attack anything hostile within the patrolling point which is not the intended effect, but otherwise a good idea.

>>why don't you just make it work in GUI then convert it to JASS and change the variables needed into locals? That would make it MUI
This will not cause a server split?..
 

Squishy

You can change this now in User CP.
Reaction score
127
If your up for the work, just make an integer variable, and use custom values for the arrays, and then replace everywhere you are using custom value with the array.
 

Samael88

Evil always finds a way
Reaction score
181
>>why don't you just make it work in GUI then convert it to JASS and change the variables needed into locals? That would make it MUI
This will not cause a server split?..

Why would it?
I do this everytime I can make an ability or something in GUI and want it to be MUI. It won't change anything more than to make it MUI:)
Don't know how to make the trigger tho, I don't really understand what you want to achieve. but if you get it to work and want it to be MUI, then locals are the easiest way to go:thup:
 

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
>>why don't you just make it work in GUI then convert it to JASS and change the variables needed into locals? That would make it MUI
This will not cause a server split?..

Why would it?
I do this everytime I can make an ability or something in GUI and want it to be MUI. It won't change anything more than to make it MUI:)
Don't know how to make the trigger tho, I don't really understand what you want to achieve. but if you get it to work and want it to be MUI, then locals are the easiest way to go:thup:

Sounds good, I will try this, thank you... And then i hope it won't cause a server split..

Just to clarify.. A local is just a normal variable, but it is unique to the single occurrence of the script.. e.g. It will be unique for every time the script runs through?...
 

cowmenace

New Member
Reaction score
22
sorry for chiming in late. one thing I use in a lot of triggers is instead of using wait, I create a dummy for whatever player owns the unit you want to modify and set the custom value to a random number. After, I add an expiration timer equal to the time you want to wait. Then create a trigger with the event a unit dies and condition dying unit's custom value is X. you can then do things to the unit by storing it in a variable (done earlier) and referring to it as Unit_Var[Player number of (owner of dying unit))]

hope you understood cause it is a very easy way to add MUI to most triggers.
 

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
sorry for chiming in late. one thing I use in a lot of triggers is instead of using wait, I create a dummy for whatever player owns the unit you want to modify and set the custom value to a random number. After, I add an expiration timer equal to the time you want to wait. Then create a trigger with the event a unit dies and condition dying unit's custom value is X. you can then do things to the unit by storing it in a variable (done earlier) and referring to it as Unit_Var[Player number of (owner of dying unit))]

hope you understood cause it is a very easy way to add MUI to most triggers.

that's rather smart.. could use that for something I think. Although not this thing in particular :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top