Unctrollable Unit but stil owned

DiFm

New Member
Reaction score
35
I want a unit that stays the same ownership but the owner cant move or give him any order at all i also need the unit to not be stunned/holded. Anyone got any ideas how to do this?

Thanks in advance
 

Lyle.

New Member
Reaction score
32
Why exactly do you want it to remain under the ownership of the owner?

Otherwise you could set up a system which adds the units into a unit group, gives control away and keeps the team color of the owner. Then you could check if the unit is in the unit group whenever you need to see who owns the unit.
 

simonake

New Member
Reaction score
72
2 method, first one might be what you would prefer.
1. Add the unit the 'Locust' ability.
or
2. Give the unit ward classification.
 

DiFm

New Member
Reaction score
35
first one will still go around auto attacking ppl. It will still go around autoattacking people. how do the second method work? can the unit still walk and the unit gets attacked by units?
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
You need to make it a ward so the only possible order is Smart
Then make a trigger that will make the unit stop (or attack-move, like in castle fight if that what you want) when ordered "smart"
 

DiFm

New Member
Reaction score
35
Well the problem is i want the unit to follow another units orders. whatever he is ordered the other unit does. so if he is in the middle of walk to a spot and he uses smart he stops and ends the current order he had.
 

komapatient

New Member
Reaction score
10
2 method, first one might be what you would prefer.
1. Add the unit the 'Locust' ability.
or
2. Give the unit ward classification.

I just tried this via "Add Ability" but I couldn't select Locust... How would I do that?!

This is an interesting question - I was asking this myself because I once wanted to add an ability to units to auto run home ignoring all targets and being unaware to orders until it reaches 'home'. So I guess I will give ward classification a try when I have some time!

Offtopic:
Simonake..... your Icon sucks.. Team Rocket is so much more win then Ash ;D
 

DiFm

New Member
Reaction score
35
WHy doesnt it work to do like this?

Make PLayer Blue treat player neutral hostile as an ally with shared vision?
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Then just use my method and make both units stop when the uncontrollable one is order "smart"
 

simonake

New Member
Reaction score
72
I just tried this via "Add Ability" but I couldn't select Locust... How would I do that?!

This ability cannot be added by GUI triggers, it's not in the list. You have to use the object editor or jass as this function:
JASS:
call UnitAddAbility( wichunit, 'Aloc')
 

DiFm

New Member
Reaction score
35
a unit is ordered an order.




pause unit
unpause unit


are you saying he will resume the order he was doing be4 the order that triggered the event?
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
Try a system that issues an order and stores it whenever you call a custom "issue order" function. Then, create a trigger that detects when a smart order is issued, and re-issue the attached order.

Here's a system I made for you:

JASS:
library OrderLock initializer Init uses PUI

private struct Data
    //! runtextmacro PUI()

    static group g = CreateGroup()
    static trigger t = CreateTrigger()
    
    unit whichUnit
    
    string order
    
    widget wTar
    location lTar
    real xTar
    real yTar
    
    static method clear takes unit which returns nothing
        local Data d = Data[which]
        if d != 0 then
            set d.order = null
            set d.wTar = null
            if d.lTar != null then
                call RemoveLocation(d.lTar)
            endif
            set d.lTar = null
            set d.xTar = 0
            set d.yTar = 0
        endif
    endmethod
    
    static method create takes unit which returns Data
        local Data d = Data[which]
        if d == 0 then
            set d = Data.allocate()
            set Data[which] = d
            set d.xTar = 0
            set d.yTar = 0
        endif
        call GroupAddUnit(Data.g,which)
        return d
    endmethod
endstruct

public function AddUnit takes unit whichUnit returns nothing
    //Unit will not take any orders
    call GroupAddUnit(Data.g,whichUnit)
endfunction

public function ClearUnit takes unit whichUnit returns nothing
    //Unit will allow control again
    call Data.clear(whichUnit)
    call GroupRemoveUnit(Data.g,whichUnit)
endfunction

public function IssuePtOrderLoc takes unit whichUnit, string order, location where returns nothing
    local Data d
    call Data.clear(whichUnit)
    set d = Data.create(whichUnit)
    set d.order = order
    set d.lTar = where
    call IssuePointOrderLoc(whichUnit,order,where)
endfunction

public function IssueImOrder takes unit whichUnit, string order returns nothing
    local Data d
    call Data.clear(whichUnit)
    set d = Data.create(whichUnit)
    set d.order = order
    call IssueImmediateOrder(whichUnit,order)
endfunction    

public function IssuePtOrder takes unit whichUnit, string order, real x, real y returns nothing
    local Data d
    call Data.clear(whichUnit)
    set d = Data.create(whichUnit)
    set d.order = order
    set d.xTar = x
    set d.yTar = y
    call IssuePointOrder(whichUnit,order,x,y)
endfunction

public function IssueTarOrder takes unit whichUnit, string order, widget targetWidget returns nothing
    local Data d
    call Data.clear(whichUnit)
    set d = Data.create(whichUnit)
    set d.order = order
    set d.wTar = targetWidget
    call IssueTargetOrder(whichUnit,order,targetWidget)
endfunction

public function ReIssueOrder takes unit whichUnit returns nothing
    local Data d
    if IsUnitInGroup(whichUnit,Data.g) == false then
        return
    endif
    set d = Data.create(whichUnit)
    call DisableTrigger(Data.t)
    if d.wTar != null then
        call IssueTargetOrder(whichUnit,d.order,d.wTar)
    elseif d.lTar != null then
        call IssuePointOrderLoc(whichUnit,d.order,d.lTar)
    elseif d.xTar != 0 and d.yTar != 0 then
        call IssuePointOrder(whichUnit,d.order,d.xTar,d.yTar)
    elseif d.order != null then
        call IssueImmediateOrder(whichUnit,d.order)
    else
        call IssueImmediateOrder(whichUnit,"stop")
    endif
    call EnableTrigger(Data.t)
endfunction
    
private function Conditions takes nothing returns boolean
    return IsUnitInGroup(GetTriggerUnit(),Data.g) //and OrderId2String(GetIssuedOrderId()) == "smart"
endfunction

private function Actions takes nothing returns nothing
    call ReIssueOrder(GetTriggerUnit())
endfunction

private function Init takes nothing returns nothing
    call TriggerRegisterAnyUnitEventBJ(Data.t,EVENT_PLAYER_UNIT_ISSUED_ORDER)
    call TriggerAddCondition(Data.t,Condition(function Conditions))
    call TriggerAddAction(Data.t,function Actions)
endfunction

endlibrary


Edit: To use the system, simply replace your normal orders with the system's custom functions. For example, if you want a unit to continue attacking a unit, ignoring any other orders, just use the IssueTarOrder function:

JASS:
call OrderLock_IssueTarOrder(whichUnit,"attack",Target_Unit)


Also, if you only want to ignore "smart" orders (lets say you added ward classification to the unit), just uncomment the line in the private Conditions function.
 

simonake

New Member
Reaction score
72
Why couldn't you add it locust ability and set movement speed to 0?

Offtopic:
Simonake..... your Icon sucks.. Team Rocket is so much more win then Ash ;D

Sorry i dont use to watch pokemon sorry. I don't know what you mean.
 

DiFm

New Member
Reaction score
35
Why couldn't you add it locust ability and set movement speed to 0?

Coz i need to set it back to normal after that.


Nice actually for now I would think it was best if it was ward classification and it checked if a unit has buff and is ordered the smart command.

How would that line look and where should it be put?

+rep :)
 

Genkora

Frog blast the vent core!
Reaction score
92
a unit is ordered an order.




pause unit
unpause unit


are you saying he will resume the order he was doing be4 the order that triggered the event?

the unit will carry on with whatever order it had before being paused.
 

simonake

New Member
Reaction score
72
You can change a unit speed with triggers? Add locust and set movement speed to 0 with a trigger like this one.

Trigger:
  • Actions
    • Unit - Set (wichunit) movement speed to 0.00
    • Custom Script: call UnitAddAbility( wichunit, 'aloc')


You must admit that it's simple.
 

komapatient

New Member
Reaction score
10
Why couldn't you add it locust ability and set movement speed to 0?



Sorry i dont use to watch pokemon sorry. I don't know what you mean.

Sorry, It wasn't meant personal... Team Rocket are the super evil counterparts to Ash, the main protagonist to the series.

If you should ever watch the programme (I don't specially recommend it) you will soon know what I mean ;)
 
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