System Creep Revival

TheDeadFight

New Member
Reaction score
1
I hope useful :D

in GUI :

Trigger:
  • Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Triggering unit)) Equal to Neutral Hostile) and (((Triggering unit) is Summoned) Not equal to True)
    • Actions
      • Custom script: local string udg_CreepType
      • Custom script: local location udg_CreepPoss
      • Custom script: set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetDyingUnit()))
      • Custom script: set udg_CreepPoss = GetUnitLoc(GetDyingUnit())
      • Set CreepPoss = (Position of (Dying unit))
      • Wait 10.00 game-time seconds
      • Unit - Create 1 (Unit-type(CreepType)) for Neutral Hostile at CreepPoss facing (Random angle) degrees
      • Set CreepType = <Empty String>
      • Custom script: call RemoveLocation(udg_CreepPoss)


in JASS :

create both of this variable :
Code:
Variable Name		Variable Type

CreepPoss			Point
CreepType			String
JASS:
function Trig_Revive_Func006001 takes nothing returns boolean
    return ( GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction

function Trig_Revive_Func006002 takes nothing returns boolean
    return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) != true )
endfunction

function Trig_Revive_Conditions takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Revive_Func006001(), Trig_Revive_Func006002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Revive_Actions takes nothing returns nothing
    local string udg_CreepType
    local location udg_CreepPoss
    set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetDyingUnit()))
    set udg_CreepPoss = GetUnitLoc(GetDyingUnit())
    set udg_CreepPoss = GetUnitLoc(GetDyingUnit())
    call PolledWait( 10.00 )
    call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_CreepType), Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_CreepPoss, GetRandomDirectionDeg() )
    set udg_CreepType = ""
    call RemoveLocation(udg_CreepPoss)
endfunction

//===========================================================================
function InitTrig_Revive takes nothing returns nothing
    set gg_trg_Revive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Revive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Revive, Condition( function Trig_Revive_Conditions ) )
    call TriggerAddAction( gg_trg_Revive, function Trig_Revive_Actions )
endfunction
 

Laiev

Hey Listen!!
Reaction score
188
You don't need to get GUI version and convert it to jass just to give a jass version :nuts:


1 - why you create globals variable to use in locals?

2 - [ljass]set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetDyingUnit()))[/ljass]
[ljass]set udg_CreepPoss = GetUnitLoc(GetTriggerUnit())[/ljass]
Set CreepPoss = (Position of (Dying unit))

to

[ljass]set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetTriggerUnit()))[/ljass]
[ljass]set udg_CreepPoss = GetUnitLoc(GetTriggerUnit())[/ljass]
Set CreepPoss = (Position of (Triggering Unit))


3 - If you make a jass version, use coordination instead location
 

Chaos_Knight

New Member
Reaction score
39
You don't need to get GUI version and convert it to jass just to give a jass version :nuts:


1 - why you create globals variable to use in locals?

2 - [ljass]set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetDyingUnit()))[/ljass]
[ljass]set udg_CreepPoss = GetUnitLoc(GetTriggerUnit())[/ljass]
Set CreepPoss = (Position of (Dying unit))

to

[ljass]set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetTriggerUnit()))[/ljass]
[ljass]set udg_CreepPoss = GetUnitLoc(GetTriggerUnit())[/ljass]
Set CreepPoss = (Position of (Triggering Unit))


3 - If you make a jass version, use coordination instead location


I think it's to many BJs. As Laiev said, no mean to convert to JASS. It doesnt because it becomes JASS. Not "good" JASS. Because of all the BJs. I didnt like this. :(
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
Your JASS version is just a converted GUI to JASS with no touching.

JASS:
function Trig_Revive_Func006001 takes nothing returns boolean
    return ( GetOwningPlayer(GetTriggerUnit()) == Player(PLAYER_NEUTRAL_AGGRESSIVE) )
endfunction

function Trig_Revive_Func006002 takes nothing returns boolean
    return ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) != true )
endfunction

function Trig_Revive_Conditions takes nothing returns boolean
    if ( not GetBooleanAnd( Trig_Revive_Func006001(), Trig_Revive_Func006002() ) ) then
        return false
    endif
    return true
endfunction

function Trig_Revive_Actions takes nothing returns nothing
    local string udg_CreepType
    local location udg_CreepPoss
    set udg_CreepType = UnitId2StringBJ(GetUnitTypeId(GetDyingUnit()))
    set udg_CreepPoss = GetUnitLoc(GetDyingUnit())
    set udg_CreepPoss = GetUnitLoc(GetDyingUnit())
    call PolledWait( 10.00 )
    call CreateNUnitsAtLoc( 1, String2UnitIdBJ(udg_CreepType), Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_CreepPoss, GetRandomDirectionDeg() )
    set udg_CreepType = ""
    call RemoveLocation(udg_CreepPoss)
endfunction

//===========================================================================
function InitTrig_Revive takes nothing returns nothing
    set gg_trg_Revive = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Revive, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_Revive, Condition( function Trig_Revive_Conditions ) )
    call TriggerAddAction( gg_trg_Revive, function Trig_Revive_Actions )
endfunction


This one will be better
No need for any requirement variables stuff.

JASS:
scope Revive initializer I
    globals
        private constant player OWNER = Player(PLAYER_NEUTRAL_AGGRESSIVE) //~Owner of dying unit

        private constant real   TIME  = 5.0 //~Time until the creep revives
    endglobals

    private function C takes nothing returns boolean
        return GetOwningPlayer(GetTriggerUnit()) == OWNER and IsUnitType(GetTriggerUnit(), UNIT_TYPE_SUMMONED) != true
    endfunction

    private function A takes nothing returns nothing
        local unit u = GetDyingUnit()
        local real x = GetUnitX(u)
        local real y = GetUnitY(u)
        local integer i = GetUnitTypeId(GetDyingUnit())

        call TriggerSleepAction(TIME)
        call CreateUnit(OWNER,i,x,y,GetRandomInt(0,360))

        set u = null
    endfunction

    //===========================================================================
    private function I takes nothing returns nothing
        local trigger g = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerUnitEvent(g,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
            set i = i+1
            exitwhen i == bj_MAX_PLAYER_SLOTS
        endloop
        call TriggerAddCondition(g,Condition(function C))
        call TriggerAddAction(g,function A)
        set g = null
    endfunction
endscope
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
I didn't notice [ljass]GetUnitTypeId(GetDyingUnit())[/ljass]^_^. Since I made that integer first before the unit. ^^

EDIT: and just replace getdyng with GetTriggerUnit()
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Here's an even better version, without a wait :D

JASS:
scope CreepRevive initializer Init

    globals
        private constant player REVIVE_OWNER = Player( 12 ) // This is &quot;Neutral Hostile&quot; <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite2" alt=";)" title="Wink    ;)" loading="lazy" data-shortname=";)" />
        private constant real REVIVE_TIME = 10.
        
        private hashtable ReviveHash
    endglobals
    
    private struct ReviveData
        unit u
        
        real x
        real y
        
        integer id
        
        static method create takes unit u returns thistype
            local thistype this = thistype.allocate()
            local timer t
            
            set this.u = u
            set this.x = GetUnitX( u )
            set this.y = GetUnitY( u )
            set this.id = GetUnitTypeId( u )
            
            static if LIBRARY_TimerUtils then
                set t = NewTimer()
                
                call SetTimerData( t, this )
            else
                set t = CreateTimer()
                
                call SaveInteger( ReviveHash, GetHandleId( t ), 0, this )
            endif
            
            call TimerStart( t, REVIVE_TIME, false, function thistype.Revive )
            
            return this
        endmethod
        
        private static method Revive takes nothing returns nothing
            local thistype this
            local timer t = GetExpiredTimer()
            
            static if LIBRARY_TimerUtils then
                set this = GetTimerData( t )
                
                call ReleaseTimer( t )
            else
                set this = LoadInteger( ReviveHash, GetHandleId( t ), 0 )
                
                call PauseTimer( t )
                call DestroyTimer( t )
            endif
            
            call CreateUnit( REVIVE_OWNER, this.id, this.x, this.y, GetRandomReal( 0., 360. ) )
            
            call this.destroy()
            
            set t = null
        endmethod
        
    endstruct

    private function Conditions takes nothing returns boolean
        return IsUnitType( GetTriggerUnit(), UNIT_TYPE_SUMMONED ) != true and IsUnitType( GetTriggerUnit(), UNIT_TYPE_STRUCTURE ) != true
    endfunction

    private function Actions takes nothing returns nothing
        local unit u = GetTriggerUnit()
        
        call ReviveData.create( u )
        
        set u = null
    endfunction

//===========================================================================
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        
        call TriggerRegisterPlayerUnitEvent( t, REVIVE_OWNER, EVENT_PLAYER_UNIT_DEATH, null )
    
        call TriggerAddCondition( t, Condition( function Conditions ) )
        call TriggerAddAction( t, function Actions )
        
        set ReviveHash = InitHashtable()
    endfunction
    
endscope


Though you really should try to instead save the creeps positions when they enter the map (Or if they are pre-placed, save it at map init :D) as if a creeps follows you around the map, and you kill it, it shouldn't appear there, but where he started running after you ;)

I'll try to work something up ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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