DotA allstars system?

waaaks!

Zinctified
Reaction score
256
hey guys, please take a look, a system that removes units that are affected with the town portal, wierd?
JASS:
//--------------------------------------------------------------------
// Function: PickPortalUnit - Picks all of the portal units on the map
//           owned by the portal owner so they can be removed.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function PickPortalUnit takes nothing returns boolean
    if (GetUnitTypeId(GetFilterUnit()) == udg_portalUnit) then
        return true
    endif
    return false
endfunction

//--------------------------------------------------------------------
// Function: RemovePortalUnit - Removes the portal unit.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function RemovePortalUnit takes nothing returns nothing
    call RemoveUnit(GetEnumUnit())
endfunction

//--------------------------------------------------------------------
// Function: DestroyPortals - Destroys a portal owned by a player.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function DestroyPortals takes integer i returns nothing
    local group g1 = GetUnitsInRectMatching(udg_playerTownRegions[i-1], Condition(function PickPortalUnit))
    local group g2 = GetUnitsInRectMatching(udg_playerSourceRegions[i-1], Condition(function PickPortalUnit))

    call DestroyTrigger(udg_portalTriggers[i*2-2])
    call DestroyTrigger(udg_portalTriggers[i*2-1])
    call DestroyEffectBJ(udg_specialEffects[i*2-2])
    call DestroyEffectBJ(udg_specialEffects[i*2-1])
    if (udg_portalCloseSound != null) then
        call SetSoundPositionLocBJ(udg_portalCloseSound, GetRectCenter(udg_playerTownRegions[i-1]), 0 )
        call PlaySoundBJ(udg_portalCloseSound)
    endif
    call ForGroup(g1, function RemovePortalUnit)
    call ForGroup(g2, function RemovePortalUnit)
endfunction

//--------------------------------------------------------------------
// Function: PortalSource - Handling for source portal (created at hero)
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function PortalSource takes nothing returns nothing
    local integer i = GetPlayerId(GetOwningPlayer(GetEnteringUnit()))

    call SetUnitPositionLoc(GetEnteringUnit(), OffsetLocation(GetRectCenter(udg_playerTownRegions<i>), 0, -200.00))
    call TriggerSleepAction(0.01)
    call IssueImmediateOrderBJ(GetTriggerUnit(), &quot;stop&quot;)
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()), GetUnitLoc(GetEnteringUnit()), 0)
endfunction

//--------------------------------------------------------------------
// Function: PortalSourceConditions - Makes sure the unit entering a
//           portal is a hero and is an ally of the creating player.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function PortalSourceConditions takes nothing returns boolean
    local integer i = 1

    loop
        exitwhen i &gt; 12
        if (GetTriggeringTrigger() == udg_portalTriggers[i*2-2]) then
            exitwhen true
        endif
        set i = i + 1
    endloop
    if (IsUnitType(GetEnteringUnit(), UNIT_TYPE_HERO)) then
        if (IsPlayerAlly(GetOwningPlayer(GetEnteringUnit()), Player(i-1))) then
            return true
        endif
    endif
    return false
endfunction

//--------------------------------------------------------------------
// Function: PortalTown - Handling for portal in town.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function PortalTown takes nothing returns nothing
    local integer i = 1

    loop
        exitwhen i &gt; 12
        if (GetTriggeringTrigger() == udg_portalTriggers[i*2-1]) then
            exitwhen true
        endif
        set i = i + 1
    endloop
    call SetUnitPositionLoc(GetEnteringUnit(), OffsetLocation(GetRectCenter(udg_playerSourceRegions[i-1]), 0, -200.00) )
    call TriggerSleepAction(0.01)
    call IssueImmediateOrderBJ(GetTriggerUnit(), &quot;stop&quot;)
    call PanCameraToTimedLocForPlayer(GetOwningPlayer(GetEnteringUnit()), GetUnitLoc(GetEnteringUnit()), 0)
    if (GetOwningPlayer(GetEnteringUnit()) == Player(i-1)) then
        call DestroyPortals(i)
    endif
endfunction

//--------------------------------------------------------------------
// Function: PortalTownConditions - Makes sure the unit entering a
//           portal is a hero and is an ally of the creating player.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function PortalTownConditions takes nothing returns boolean
    local integer i = 1

    loop
        exitwhen i &gt; 12
        if (GetTriggeringTrigger() == udg_portalTriggers[i*2-1]) then
            exitwhen true
        endif
        set i = i + 1
    endloop
    if (IsUnitType(GetEnteringUnit(), UNIT_TYPE_HERO)) then
        if (IsPlayerAlly(GetOwningPlayer(GetEnteringUnit()), Player(i-1))) then
            return true
        endif
    endif
    return true
endfunction

//--------------------------------------------------------------------
// Function: GetTeleportOk - Returns false if hero is in a &quot;no TP&quot; region.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function GetTeleportOk takes unit u, integer i returns boolean
    local integer index = 0
    local boolean result = true
    loop
        exitwhen index &gt; i - 1
        if (RectContainsUnit(udg_invalidTPRegions[index], u)) then
            set result = false
            exitwhen true
        endif
        set index = index + 1
    endloop
    return result
endfunction

//--------------------------------------------------------------------
// Function: TPConditions - Verifies the used item is a scroll of town
//           portal.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function TPConditions takes nothing returns boolean
    if (GetItemTypeId(GetManipulatedItem()) == udg_tpItem) then
        return true
    endif
    return false
endfunction

//--------------------------------------------------------------------
// Function: TPActions - Portal Handling code.
//   Author: rwxr-xr-x
//--------------------------------------------------------------------
function TPActions takes nothing returns nothing
    local integer numRI = 0
    local unit u = GetManipulatingUnit()
    local integer x = GetConvertedPlayerId(GetTriggerPlayer())
    local integer y = x * 2 - 2
    local real posX = 0.0
    local real posY = 0.0

    set x = x - 1
    // Before continuing, check to see if player has left
    if (GetPlayerSlotState(Player(x)) == PLAYER_SLOT_STATE_LEFT) then
        if (IsTriggerEnabled(udg_portalTriggers[y])) then
            call DestroyPortals(x+1)
            return
        endif
        return
    endif

    set posX = GetUnitX(GetManipulatingUnit())
    set posY = GetUnitY(GetManipulatingUnit())

    // Check for number of invalid regions
    loop
        if (udg_invalidTPRegions[numRI] == null) then
            exitwhen true
        endif
        set numRI = numRI + 1
    endloop

    // Verify a town portal is placeable
    if (GetTeleportOk(u,numRI) != true) then
        call DisplayTimedTextToPlayer(GetOwningPlayer(u), 0, 0, 3.00, &quot;|cFFFF0000Unable to use Town Portal from here.|r&quot;)
        call TriggerSleepAction(0.01)
        call UnitAddItemByIdSwapped(udg_tpItem, u)
        return // Hero not able to TP, so exit early
    endif

    // If player has a town portal open already, close it
    if (IsTriggerEnabled(udg_portalTriggers[y])) then
        call DestroyPortals(x+1)
    endif

    // Effects
    set udg_playerSourceRegions[x] = RectFromLoc(Location(posX-100,posY+25), Location(posX+100,posY+225))
    set u = CreateUnitAtLoc(Player(x), udg_portalUnit, GetRectCenter(udg_playerSourceRegions[x]), bj_UNIT_FACING)
    call PauseUnitBJ(true,u)
    set u = CreateUnitAtLoc(Player(x), udg_portalUnit, GetRectCenter(udg_playerTownRegions[x]), bj_UNIT_FACING)
    call PauseUnitBJ(true,u)
    call AddSpecialEffectLocBJ(GetRectCenter(udg_playerTownRegions[x]), udg_portalSpecialEffectString)
    set udg_specialEffects[y] = GetLastCreatedEffectBJ()
    call AddSpecialEffectLocBJ(GetRectCenter(udg_playerSourceRegions[x]), udg_portalSpecialEffectString)
    set udg_specialEffects[(y+1)] = GetLastCreatedEffectBJ()

    // If udg_portalOpenSound is set, attatch and play the sound
    if (udg_portalOpenSound != null) then
        call SetSoundPositionLocBJ(udg_portalOpenSound, GetRectCenter(udg_playerSourceRegions[x]), 0)
        call PlaySoundBJ(udg_portalOpenSound)
    endif
    set udg_portalTriggers[y] = CreateTrigger()
    set udg_portalTriggers[y+1] = CreateTrigger()

    // Activate the players portal triggers
    call TriggerRegisterEnterRectSimple(udg_portalTriggers[y], udg_playerSourceRegions[x])
    call TriggerAddAction(udg_portalTriggers[y], function PortalSource)
    call TriggerAddCondition(udg_portalTriggers[y], Condition(function PortalSourceConditions))
    call TriggerRegisterEnterRectSimple(udg_portalTriggers[y+1], udg_playerTownRegions[x])
    call TriggerAddAction(udg_portalTriggers[y+1], function PortalTown)
    call TriggerAddCondition(udg_portalTriggers[y+1], Condition(function PortalTownConditions))
endfunction

//===========================================================================
function InitTrig_Town_Portal takes nothing returns nothing
    local integer i = 0

    set gg_trg_Town_Portal = CreateTrigger()
    loop
        exitwhen i &gt; 11
        call TriggerRegisterPlayerUnitEventSimple(gg_trg_Town_Portal, Player(i), EVENT_PLAYER_UNIT_USE_ITEM)
        call TriggerRegisterPlayerEvent(gg_trg_Town_Portal, Player(i), EVENT_PLAYER_LEAVE)
        set i = i + 1
    endloop
    call TriggerAddAction(gg_trg_Town_Portal, function TPActions)
    call TriggerAddCondition(gg_trg_Town_Portal, Condition(function TPConditions))
endfunction</i>
 

emjlr3

Change can be a good thing
Reaction score
395
GC is not slow as hell, its only slow compared to better alternatives, GC is plenty fast for just about anything anyone needs to do, however since there are faster alternatives, why not use them

would you consider a corvette slow? however compared to a F1 car......
 

Vexorian

Why no custom sig?
Reaction score
187
Handle Vars and derivatives are the equivalent to Elephants (not corvettes), you can't really expect an elephant to beat a normal car, but in theory you can tam him and he will take you to the destination, but it is not going to be fast and it is not going to be easy, it is also simply not logical to use an elephant for transportation considering that cars were designed for transportations and elephants weren't. Also riding an elephant is kind of dangerous if the elephant rushes.

Tables are just a faster elephant, but it is still an elephant.

CSData is like a group of cars that can only take one person at a time, if the distance is too long for one car's fuel, it uses another car in the middle of the way, but the number of cars is limited and thus if the path is too long, it will begin to use a single horse since horses don't need fuel.

Grim's "method" is like a car factory that would let any person get its own group of cars, but each person can only use 3 cars to the most and if the path is too long, there are simply no horses so you will simply not advance anymore.

The bad thing about CSData and Grim's method is that most of the times, you don't know how long the path is going to be, specially if you are coding something that is going to be used in multiple maps, Grim mostly designed it with his own maps in mind since he can ensure good control of max handle ids.

--
And either way structs are just global arrays, in order for us to find a more effective, faster and safer method than that we would require blizzard to update the whole Jass syntax themselves. So there won't be a better "system" than vJass, mostly because vJass is not a system.

And it is clear to me DOTA used a modiffied version of tables, no NewTable () just I2S(H2I()) because of this DOTA just uses handle vars with less overhead. You shouldn't care since what gives DOTA its success is not the technical implementation but the gameplay design, which somehow is loved by most bnet players.

--
Edit: Even while Anibal succeeded plenty of times with tamed elephants he also lost his last battle because of the confusion the Roman army caused to the elephants, the elephants ended up smashing Anibal's own troops, and that's Handle vars for you.
 

waaaks!

Zinctified
Reaction score
256
wow pretty good explanation vex...

im just curious about dota because im addicted to dota, i even play leagues for dota...

but i found AoD from emjlr3 pretty good spells, i would like to study the functions used by emjlr3 if i had an open version of the map, too bad its protected...:(

anyways thanks for the discussion guys...
 

waaaks!

Zinctified
Reaction score
256
can u imagine a map with all the systems made?
even the crappy systems are in...
 

waaaks!

Zinctified
Reaction score
256
hey there is no map, click it again and see for ur self

my error message
xp.png.php
 

emjlr3

Change can be a good thing
Reaction score
395
Vex i dont think u can really look at it that way, unless your saying that an elephant moves fast enough for anything you need, its more like

a corvette being fast enough for anyone who wants to get there

and then something new that is 100 times faster then a vette, yea it gets u there faster, but for 99% of ppl, its really not a big deal, for someone making some mega ownage system that takes mega resources and functions to run, maybe, but other then you and a few others, no one does that or needs it

im not saying structs are not good, and that i dont use them them over tables, im just saying that, where there is a big difference, its, to me, and most mappers, like comparing molecules to atoms, yea they are many fold larger, but you cant see either w/o a microscope, so no one really cares all that much

and that whole handle vars getting confused bit...confused me

@waaaaks, the functions in AoD are just like any other functions, its relaly nothing special, if you know JASS, you know what I got in there
 

waaaks!

Zinctified
Reaction score
256
>emjlr3
no i didnt mean that i need the functions, you use, i just want to know or get some ideas from your spells, dont worry becaus i wont steal spells, i only want ideas and some combinations in JASSing, i would like to download demo spell maps, that was created from caster system, but wc3campaigns is offline now...
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • 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!
  • 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

      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