(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Resources > Submissions

Submissions Submit JASS resources! If approved, they will be moved to their proper section.
Please read me first.

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 12-24-2007, 08:17 PM   #1 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


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")
endfunction

function MovementDisable_Execute takes nothing returns nothing
    call DestroyTimer(GetExpiredTimer())
call IssueImmediateOrder(udg_MoveUnit, "stop")
endfunction

function MovementDisable_Actions takes nothing returns nothing
set udg_MoveUnit = GetTriggerUnit()
    call TimerStart(CreateTimer(), 0.00, false, function MovementDisable_Execute)
endfunction

function UnitEnableMovement takes unit u returns nothing
call SetHandleBoolean(u, "b", true)
endfunction

function UnitDisableMovement takes unit u returns nothing
    call SetHandleBoolean(u, "b", false)
endfunction

function Init_MovementToggle takes nothing returns nothing
    call TriggerAddCondition(udg_Trig, Condition(function MovementDisable_Conditions))
    call TriggerAddAction(udg_Trig, function MovementDisable_Actions)
endfunction

function 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
set Caster = (Triggering unit)
Custom script: call Init_Movement(udg_Caster)
Custom script: call UnitEnableMovement(udg_Caster)
Wait 5.00 seconds
Custom script: call UnitDisableMovement(udg_Caster)


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..
Silvenon is offline  
Old 01-15-2008, 05:45 PM   #2 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

~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.
PurplePoot is offline  
Old 01-15-2008, 09:01 PM   #3 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


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.
Captain Griffen is offline  
Old 01-15-2008, 09:18 PM   #4 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


*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"?
Silvenon is offline  
Old 01-16-2008, 08:01 PM   #5 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


"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.
Captain Griffen is offline  
Old 01-16-2008, 08:38 PM   #6 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


Yeah, I know that, I just thought "smart" meant any kind of right-click. Thanks.
Silvenon is offline  
Old 01-18-2008, 08:58 PM   #7 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

It does, but "Move" and "Attack" involve a left-click after having selected the right icon (through hotkeys or otherwise) from the command card.
PurplePoot is offline  
Old 02-06-2008, 11:12 PM   #8 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

"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?
PurplePoot is offline  
Old 02-08-2008, 05:22 PM   #9 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


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?
Silvenon is offline  
Old 02-09-2008, 01:43 AM   #10 (permalink)
Model Moderator
 
BlinkBoy's Avatar

User
 
Join Date: Nov 2004
Posts: 760

BlinkBoy is a jewel in the rough (199)BlinkBoy is a jewel in the rough (199)


can't you just make the unit play stand animation and then pause it?
BlinkBoy is offline  
Old 02-09-2008, 03:07 AM   #11 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

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.
PurplePoot is offline  
Old 02-09-2008, 02:55 PM   #12 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


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.
Silvenon is offline  
Old 02-12-2008, 02:54 PM   #13 (permalink)
 
Captain Griffen's Avatar

******
 
Join Date: Nov 2005
Posts: 747

Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)Captain Griffen is a jewel in the rough (241)


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.
Captain Griffen is offline  
Old 02-12-2008, 08:26 PM   #14 (permalink)
 
Silvenon's Avatar

BBoy Silv
 
Join Date: Nov 2006
Posts: 866

Silvenon is on a distinguished road (81)Silvenon is on a distinguished road (81)


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.
Silvenon is offline  
Old 02-12-2008, 08:51 PM   #15 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

It would change what he wants to accomplish, which is sort of unclear... Right now autoacquire works fine.
PurplePoot is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Unit/Hero Auto-Attack neogaidenx World Editor Help Zone 3 04-13-2008 07:28 AM
[JASS] Disable Movement Silvenon Triggers & Scripts 21 01-01-2008 04:32 PM
Attack index, enable 2, disable 1, attack bboy-tiger- Triggers & Scripts 6 12-18-2007 04:03 PM
Disable unit attack CommZ Map Development 6 09-13-2005 06:24 PM
Enable/disable triggers nojix Map Development 1 12-11-2004 08:24 PM

All times are GMT. The time now is 09:06 AM.






Your link here 
Advertising | Free Insurance Quote | Daily Horoscopes | Car Loan | Loans
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle