• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] how to double click to screen focus

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
I want to be able to trigger the screen moving for a player to the hero on double clicking

When you double click the hero icon in the top left corner or press F1 twice fast it not only selects the hero but takes your screen to the hero. How can i do this for the player without human interaction?
 
Last edited:
Level 5
Joined
Jul 18, 2010
Messages
159
Move Cammera to position of unit for player

Or Lock Cammera for player to Unit
then Unlck Cammera for player?
 
  • T
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to u[(Player number of (Triggering player))]
        • Then - Actions
          • Set p = (Position of (Triggering unit))
          • Camera - Pan camera for (Owner of (Triggering unit)) to p over 0.00 seconds
          • Custom script: call RemoveLocation(udg_p)
        • Else - Actions
          • Set u[(Player number of (Triggering player))] = (Triggering unit)
or

JASS:
struct Test extends array

    private static unit array U

    private static method run takes nothing returns nothing
        local unit u   = GetTriggerUnit()
        local player p = GetTriggerPlayer()
        if u == U[GetPlayerId(p)] then
            if GetLocalPlayer() == p then
                call PanCameraToTimed(GetUnitX(u), GetUnitY(u), 0.00)
            endif
        else
            set U[GetPlayerId(p)] = u
        endif
        set u = null
        set p = null
    endmethod

    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            exitwhen i > 11
            call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SELECTED, null)
            set i = i+1
        endloop
        call TriggerAddAction( t, function thistype.run )
    endmethod
endstruct
 
Level 5
Joined
Jul 18, 2010
Messages
159
I think i didn't understood you but, if u hold mouse button clicked on portrait, it will lock cammera onto the unit
 
Level 13
Joined
Mar 24, 2010
Messages
950
I think i didn't understood you but, if u hold mouse button clicked on portrait, it will lock cammera onto the unit

yea i know this, and this is the affect i wanted, holding the mouse on it isnt even what i need though just 1 click to go to the area of the unit.

But i think this is not possible to be done in this manner that i need it. I already thought of the ways you and kobas gave me for ideas but it isnt the same affect i needed :/

Edit:
i kinda figured out what i need to do
 
Last edited:
Level 5
Joined
Jul 18, 2010
Messages
159
Base Divine shield on other (fake divine shield) spell with will do nothing but will activate trigger that will force triggering unit to cast true shield from hidden spellbook, fake shield should be spell like war stomp(i think) or some summon[some spells are casted by all picked units and some only by one, like Druid of the Talon, Cyclone is casted only by one and Bird Form is casted by all]

Hmm... But i think that only one hero can be selected in group, to cast 2 shields/holy lights/resurrects you need to cast then tab and cast on one another =)


Maybe tell us why do you need all of this or post map... don't know... maybe it will make help you easier
 
Status
Not open for further replies.
Top