• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Change the owner of dummy caster

Level 17
Joined
Jul 19, 2007
Messages
973
I have an imported spell in my map named "Fiery Vortex" and it uses the "Dummy Caster" system. The problem is that if an unit is killed by the "Fiery Vortex" spell, the kill credit will not go to the Hero casting the "Fiery Vortex" spell, it will go to neutral instead because it's set to that in the "Dummy Caster" system... How can I change the owner of the dummy caster to the player owner of the hero casting the "Fiery Vortex" spell?
JASS:
        // This shouldn't be changed, but in some maps perhaps it is necessary.
        constant player DUMMY_OWNER=Player(PLAYER_NEUTRAL_AGGRESSIVE)
 
Should be: GetOwningPlayer(GetTriggerUnit())

You can find the jass script of certain gui actions by converting triggers to custom text (under edit).
 
Should be: GetOwningPlayer(GetTriggerUnit())

You can find the jass script of certain gui actions by converting triggers to custom text (under edit).
Hmm. I did that now but I get this error...
unit.webp
 
You are supposed to keep the brackets empty, as they are filled with the triggering unit.

Depending on your event (i expect it's 'unit starts the effect of an ability'), it should just be:

DUMMY_OWNER=GetOwningPlayer(GetTriggerUnit())
 
You are supposed to keep the brackets empty, as they are filled with the triggering unit.

Depending on your event (i expect it's 'unit starts the effect of an ability'), it should just be:

DUMMY_OWNER=GetOwningPlayer(GetTriggerUnit())
I'm sorry but I sent you the wrong "Dummy Caster" System. This is the one that needs to be changed...
JASS:
library DummyCaster initializer OnInit
    //---------------------------------------------------
    // Make sure that CASTER_TYPE correctly points to the DummyCaster's Id
    // press ctrl + d to show the id in the object editor
    //---------------------------------------------------
    globals
        private integer CASTER_TYPE = 'h03R'

        // do not touch
        private unit dummyCaster
    endglobals
    private function LoadCaster takes nothing returns nothing
        set dummyCaster = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), CASTER_TYPE, 0, 0, 0)
    endfunction
    function OrderCaster takes unit u, integer level, integer a, integer o returns nothing
        call SetUnitX(dummyCaster, GetUnitX(u))
        call SetUnitY(dummyCaster, GetUnitY(u))
        call UnitAddAbility(dummyCaster, a)
        call SetUnitAbilityLevel(dummyCaster, a, level)
        call IssueTargetOrderById(dummyCaster,o,u)
        call UnitRemoveAbility(dummyCaster, a)
    endfunction
    function OrderCasterFromPlayer takes unit u, integer level, integer a, integer o, player p returns nothing
        call SetUnitOwner(dummyCaster, p, false )
        call SetUnitX(dummyCaster, GetUnitX(u))
        call SetUnitY(dummyCaster, GetUnitY(u))
        call UnitAddAbility(dummyCaster, a)
        call SetUnitAbilityLevel(dummyCaster, a, level)
        call IssueTargetOrderById(dummyCaster,o,u)
        call UnitRemoveAbility(dummyCaster, a)
        call SetUnitOwner(dummyCaster, Player(PLAYER_NEUTRAL_PASSIVE), false )
    endfunction
    private function OnInit takes nothing returns nothing
        call LoadCaster()
    endfunction
endlibrary

It also uses a "Preload" System
JASS:
library Preload 
    //---------------------------------------------------
    // Make sure that PRELOAD_TYPE correctly points to the DummyCaster's Id
    // press ctrl + d to show the id in the object editor
    //
    // Also change the (x, y) to point at the unused point in your map (usually the corner)
    // You can find it by using the terrain editor and hovering over the point that you want
    // the point is listed on the lower left portion of the editor labeled as point followed
    // by the x and y values
    //---------------------------------------------------
    globals
        private integer PRELOAD_TYPE = 'h03R'
        private real x = -1231.7
        private real y = 988.4
        private real cleanUpDelay = 0
    endglobals

    private module Init
        private static unit preloadDummy
        private static method onInit takes nothing returns nothing
            set preloadDummy = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), PRELOAD_TYPE, x, y, 0)
        endmethod
        static method preloadEffect takes string s returns nothing
            call DestroyEffect(AddSpecialEffectTarget(s, thistype.preloadDummy, "origin"))
        endmethod
        static method preloadAbility takes integer i returns nothing
            call UnitAddAbility(thistype.preloadDummy, i)
            call UnitRemoveAbility(thistype.preloadDummy, i)
        endmethod
        static method cleanPreload takes nothing returns nothing
            call RemoveUnit(thistype.preloadDummy)
            set preloadDummy = null
        endmethod
    endmodule

    struct Initialize
        implement Init
        private static method clean takes nothing returns nothing
            call cleanPreload()
        endmethod

        static method onInit takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerRegisterTimerEventSingle(t, cleanUpDelay)
            call TriggerAddAction(t, function thistype.clean)
            set t = null
        endmethod
    endstruct
endlibrary
 
Can you direct me to the full system, also why does it set the owner twice.
Looks like it already creates the dummy for player p (which should be the owner of the casting unit u).
1782032160629.webp

But then it resets to neutral passive:
1782032147351.webp

try to simply remove this line ^ or add a condition that checks if ability a is your Fiery Vortex

Also you don't have to post the preload section, it's just there to prevent initial lag.
 
Can you direct me to the full system, also why does it set the owner twice.
Looks like it already creates the dummy for player p (which should be the owner of the casting unit u).
View attachment 596070
But then it resets to neutral passive:
View attachment 596068
try to simply remove this line ^ or add a condition that checks if ability a is your Fiery Vortex

Also you don't have to post the preload section, it's just there to prevent initial lag.
Seems to be working now when I removed the line.
 
Back
Top