 |   |  |  |
Submissions Submit JASS resources! If approved, they will be moved to their proper section. Please read me first. |
 |
|
12-24-2007, 08:17 PM
|
#1 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Unit Enable/Disable Movement
Enable/Disable Movement
function MovementDisable_Conditions takes nothing returns boolean local integer i = GetIssuedOrderId () return (i == 851971 or i == 851986 or i == 851983 or i == 851990 ) and not GetHandleBoolean (GetTriggerUnit (), "b")endfunctionfunction MovementDisable_Execute takes nothing returns nothing call DestroyTimer (GetExpiredTimer ()) call IssueImmediateOrder (udg_MoveUnit, "stop")endfunctionfunction MovementDisable_Actions takes nothing returns nothing set udg_MoveUnit = GetTriggerUnit () call TimerStart (CreateTimer (), 0.00, false, function MovementDisable_Execute )endfunctionfunction UnitEnableMovement takes unit u returns nothing call SetHandleBoolean (u, "b", true)endfunctionfunction UnitDisableMovement takes unit u returns nothing call SetHandleBoolean (u, "b", false)endfunctionfunction Init_MovementToggle takes nothing returns nothing call TriggerAddCondition (udg_Trig, Condition (function MovementDisable_Conditions )) call TriggerAddAction (udg_Trig, function MovementDisable_Actions )endfunctionfunction Init_UnitMovement takes unit u returns nothing call SetHandleBoolean (u, "b", true) call TriggerRegisterUnitEvent (udg_Trig, u, EVENT_UNIT_ISSUED_POINT_ORDER )endfunction
A simple system which allows you to disable/enable user movement orders (right-click) given to a certain unit.
If someone is curious about the MovementDisable_Conditions function, these are the ID translations (thanks to PurplePoot): - 851971 - smart
- 851986 - move
- 851983 - attack
- 851990 - patrol
Instructions: - put this code in your map header
- create a global trigger variable named Trig and a global unit variable named MoveUnit
- initialize the system like this: call Init_MovementToggle()
- initialize the system for a unit like this: call Init_UnitMovement(udg_MyUnitVar)
- after calling Init_UnitMovement, enable/disable the movement with UnitEnableMovement(udg_MyUnitVar) and UnitDisableMovement(udg_MyUnitVar), example:
 Events   Map initialization  Conditions  Actions   Custom script: call Init_MovementToggle()
 Events   Unit - A unit starts the effect of an ability  Conditions   (Ability being cast) Equal to Tornado  Actions
Requires: KaTTaNa's Local Handle Vars
The reason why I made this lame simple system is because I discovered that it doesn't work if ordering a unit to stop directly, but a timer is needed (some lame bug).
If this doesn't work right, please report it!
Last edited by Silvenon; 02-08-2008 at 05:20 PM..
|
|
|
01-15-2008, 05:45 PM
|
#2 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
~Revive~
It would be better if you just make it one global trigger, then use an if-statement to check if that unit's movement should be enabled/disabled.
|
|
|
01-15-2008, 09:01 PM
|
#3 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
This doesn't stop movement commands ("move"), attack move commands ("attack"), or move to unit commands.
EDIT: And what is the variable F?
__________________
 | Quote: [20-00-13] MasterHaosis: Because I am retarded douchebag [20-15-23] MasterHaosis: I am faggot, retard and such.. [20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me ~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out. | |
|
|
|
01-15-2008, 09:18 PM
|
#4 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
*Edited*
I just realized the previous version wouldn't work at all.
There is a Jump function and a whole spellpack waiting for you also :)
Welcome to the living, btw.
EDIT:
Quote:
|
This doesn't stop movement commands ("move"), attack move commands ("attack"), or move to unit commands.
|
I thought that "smart" means any kind of right-click. Edited.
What is the orderstring of move to unit? "moveto"?
|
|
|
01-16-2008, 08:01 PM
|
#5 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
"smart" on a unit is not a point command.
"move" is when move is actually used, and "attack" when attack is moved (both either point or widget commands).
__________________
 | Quote: [20-00-13] MasterHaosis: Because I am retarded douchebag [20-15-23] MasterHaosis: I am faggot, retard and such.. [20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me ~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out. | |
|
|
|
01-16-2008, 08:38 PM
|
#6 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Yeah, I know that, I just thought "smart" meant any kind of right-click. Thanks.
|
|
|
01-18-2008, 08:58 PM
|
#7 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
It does, but "Move" and "Attack" involve a left-click after having selected the right icon (through hotkeys or otherwise) from the command card.
|
|
|
02-06-2008, 11:12 PM
|
#8 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
"moveto" does not exist.
Otherwise... You still need to disable patrol.
Here are the order IDs for you:
851986: move
851990: patrol
851971: smart
851983: attack
Also, why not put the GetHandleBoolean in the condition?
|
|
|
02-08-2008, 05:22 PM
|
#9 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Fixed it, thanks.
I also used a global instead of attaching the unit to the timer (since timeout 0.00 means that it happens instantly, I hope). ISN'T THAT COOL???
EDIT: Maybe I should've put this in the small code snippets section?
|
|
|
02-09-2008, 01:43 AM
|
#10 (permalink)
|
Model Moderator
User
Join Date: Nov 2004
Posts: 760
|
can't you just make the unit play stand animation and then pause it?
|
|
|
02-09-2008, 03:07 AM
|
#11 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
He wishes to allow AI movement, as well as attacks/etc.
Quote:
|
EDIT: Maybe I should've put this in the small code snippets section?
|
If you want, go ahead, and I'll graveyard this.
|
|
|
02-09-2008, 02:55 PM
|
#12 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Quote:
|
He wishes to allow AI movement, as well as attacks/etc.
|
Actually, I don't know what I wish. I disabled it like this because I needed it that way for my map, and I figured out the bug, and posted here if anyone finds it useful.
Btw, pausing can lead to unwanted effects. Spell disabling, for example. And I wanted the unit to not move when it's ordered to, when with pause you can't even order it. Also, pausing the unit pauses the buffs, I think..............and so on.
If I wanted to make it with pausing, I wouldn't post anything since it's so damn simple that it's not worth posting.
|
|
|
02-12-2008, 02:54 PM
|
#13 (permalink)
|
******
Join Date: Nov 2005
Posts: 747
|
You could just use a dummy unit with an ensnare based ability...would be easier and more effective (note that ensnare cannot be dispelled).
__________________
 | Quote: [20-00-13] MasterHaosis: Because I am retarded douchebag [20-15-23] MasterHaosis: I am faggot, retard and such.. [20-21-22] MasterHaosis: because I am chat moderator. And you dont have right to speak against me ~Void~: Knock it off, for fuck's sake. Get that bullshit out of your signature and stop being so immature. Let it die out. | |
|
|
|
02-12-2008, 08:26 PM
|
#14 (permalink)
|
BBoy Silv
Join Date: Nov 2006
Posts: 866
|
Quote:
|
(note that ensnare cannot be dispelled)
|
Easier? How is that easier if it cannot be dispelled? The efficiency difference would probably be unnoticeable. Note that this is also a bug warn.
|
|
|
02-12-2008, 08:51 PM
|
#15 (permalink)
|
iRawr
Join Date: Dec 2005
Posts: 8,349
|
It would change what he wants to accomplish, which is sort of unclear... Right now autoacquire works fine.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|  |  |  |  |   |  |
|