• 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.

Capacity of added events in Warcraft 3

Status
Not open for further replies.
Level 4
Joined
May 14, 2013
Messages
48
im using a trigger that adds an event to another trigger however there is no way i know of to remove the event afterwards, this causes a massive build up of added events.

i did a test to see how much Warcraft 3 could handle.

i ran it about 20 times a second for an hour adding up to 72000 events this number is beyond what i need.

there was no lag from this nor was the trigger's function damaged at all.

only 1 problem was it took my macbook pro about 3 minutes to exit the map. i imagine this is my computer clearing the massive catch.

my question is "is it possible to clear this catch?" so the map can quit easily. also "is there any other problems with this build up of events i have not foreseen?"
 
Level 4
Joined
May 14, 2013
Messages
48
perhaps i should post the trigger but im new to posting in the hive where can i find a tutorial on how to post triggers?
 
Level 20
Joined
Apr 14, 2012
Messages
2,901
You could also add some If-Then-Else and a few booleans and conditions to keep the required actions in one trigger. To paraphrase Hell_Master's suggestion you could do that and what I said so that the main trigger will run the first If-Then-Else, then the next If-Then-Else then the next.

You could just do Skip Remaining Actions or turn the trigger off if you want to stop.

You can post triggers by going to your trigger, right click the title of the trigger above the Events, click Copy as Text, then go back to hive. In your post, put the words [TRIGGER][/TRIGGER] in your post then between the
  • tags just paste your trigger you copied earlier.
 
Level 4
Joined
May 14, 2013
Messages
48
thank you all very much for the info i need to rework the trigger a bit it may be possible to avoid the build up of events il post it later should i post here or under the trigger and scripts section?
 
Just to clarify: a destroyed trigger could never be brought back right? Or used again?

That's correct. One would have to create a new trigger. This is called dynamic triggering.

I only have one non-DD related dynamic trigger to show as an example, and it's quite old.

Perhaps it could be helpful anyway.

JASS:
scope submerge initializer i
    private struct submergeDat
        unit caster
        integer steps
    endstruct
    
    globals
        private constant integer SPELCODE='A05H'    //Spellcode of submerge
        private constant integer BIRDCODE='Amrf'    //Abilitycode of Crow form
        private constant integer STARTVEC=25        //Starting vector amount for steps. Higher makes the ship shoot higher out of the water, and takes longer before becoming invisible
        private constant integer DUMMCODE='h00S'    //Unitcode of Sunken Heavy
        private constant real FIDELITY=1./30.
        private submergeDat array submergeDB
        private integer dbIndex=-1
        private timer time=CreateTimer()
    endglobals

    private function movesC takes nothing returns boolean
        local unit dummy=GetTriggerUnit()
        local unit caster=Units_playerBoat[GetPlayerId(GetOwningPlayer(dummy))+1]
        call SetUnitFlyHeight(caster,0.,0.)
        call SetUnitInvulnerable(caster,false)
        call PauseUnit(caster,false)
        if GetLocalPlayer()==GetOwningPlayer(caster) then
            call ClearSelection() //Instead of call SelectUnit(dummy,false)
            call SelectUnit(caster,true)
        endif
        call SetUnitVertexColor(caster,255,255,255,255)
        call RemoveUnit(dummy)
        call DestroyTrigger(GetTriggeringTrigger())
        return false
    endfunction

    private function after takes unit caster returns nothing
        local trigger moves=CreateTrigger()
        local unit sunkenDummy=CreateUnit(GetOwningPlayer(caster),DUMMCODE,0.,0.,GetUnitFacing(caster))
        call SetUnitX(sunkenDummy,GetUnitX(caster))
        call SetUnitY(sunkenDummy,GetUnitY(caster))
        call PauseUnit(caster,true)
        call SetUnitInvulnerable(caster,true)
        call SetUnitFlyHeight(caster,3000.,0)
        if GetLocalPlayer()==GetOwningPlayer(caster) then
            call ClearSelection() //Using this instead of SelectUnit(caster,false)
            call SelectUnit(sunkenDummy,true)
        endif
        call SetUnitVertexColor(caster,0,0,0,0)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_POINT_ORDER)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_TARGET_ORDER)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(moves,Condition(function movesC)) //Need a way to move caster through triggers..
        set sunkenDummy=null
        set moves=null
    endfunction

    private function p takes nothing returns nothing
        local integer iLoop=0
        local submergeDat tempDat
        loop
            exitwhen iLoop>dbIndex
            set tempDat=submergeDB[iLoop]
            call SetUnitFlyHeight(tempDat.caster,GetUnitFlyHeight(tempDat.caster)+tempDat.steps,0.)
            set tempDat.steps=tempDat.steps-1
            if tempDat.steps<-1*STARTVEC then
                call after(tempDat.caster)
                call tempDat.destroy()
                set submergeDB[iLoop]=submergeDB[dbIndex]
                set dbIndex=dbIndex-1
                set iLoop=iLoop-1
                if dbIndex==-1 then
                    call PauseTimer(time)
                endif
            endif
            set iLoop=iLoop+1
        endloop
    endfunction
    
    private function c takes nothing returns boolean
        local submergeDat tempDat
        local unit tU
        if GetSpellAbilityId()==SPELCODE then
            set tU=GetTriggerUnit()
            if IsTerrainPathable(GetUnitX(tU),GetUnitY(tU),PATHING_TYPE_FLOATABILITY)==false then
                set tempDat=submergeDat.create()
                set tempDat.caster=tU
                set tempDat.steps=STARTVEC-GetHeroLevel(tempDat.caster)/4
                call UnitAddAbility(tempDat.caster,BIRDCODE)
                call UnitRemoveAbility(tempDat.caster,BIRDCODE)
                if dbIndex==-1 then
                    call TimerStart(time,FIDELITY,true,function p)
                endif
                set dbIndex=dbIndex+1
                set submergeDB[dbIndex]=tempDat
            else
                call DisplayTextToPlayer(GetOwningPlayer(tU),0,0,"The water is not deep enough here!")
                call UnitRemoveAbility(tU,SPELCODE)
                call UnitAddAbility(tU,SPELCODE)
            endif
            set tU=null
        endif
        return false
    endfunction

    private function i takes nothing returns nothing
        local trigger t=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function c))
        set t=null
    endfunction
endscope
 
Level 20
Joined
Apr 14, 2012
Messages
2,901
That's correct. One would have to create a new trigger. This is called dynamic triggering.

I only have one non-DD related dynamic trigger to show as an example, and it's quite old.

Perhaps it could be helpful anyway.

JASS:
scope submerge initializer i
    private struct submergeDat
        unit caster
        integer steps
    endstruct
    
    globals
        private constant integer SPELCODE='A05H'    //Spellcode of submerge
        private constant integer BIRDCODE='Amrf'    //Abilitycode of Crow form
        private constant integer STARTVEC=25        //Starting vector amount for steps. Higher makes the ship shoot higher out of the water, and takes longer before becoming invisible
        private constant integer DUMMCODE='h00S'    //Unitcode of Sunken Heavy
        private constant real FIDELITY=1./30.
        private submergeDat array submergeDB
        private integer dbIndex=-1
        private timer time=CreateTimer()
    endglobals

    private function movesC takes nothing returns boolean
        local unit dummy=GetTriggerUnit()
        local unit caster=Units_playerBoat[GetPlayerId(GetOwningPlayer(dummy))+1]
        call SetUnitFlyHeight(caster,0.,0.)
        call SetUnitInvulnerable(caster,false)
        call PauseUnit(caster,false)
        if GetLocalPlayer()==GetOwningPlayer(caster) then
            call ClearSelection() //Instead of call SelectUnit(dummy,false)
            call SelectUnit(caster,true)
        endif
        call SetUnitVertexColor(caster,255,255,255,255)
        call RemoveUnit(dummy)
        call DestroyTrigger(GetTriggeringTrigger())
        return false
    endfunction

    private function after takes unit caster returns nothing
        local trigger moves=CreateTrigger()
        local unit sunkenDummy=CreateUnit(GetOwningPlayer(caster),DUMMCODE,0.,0.,GetUnitFacing(caster))
        call SetUnitX(sunkenDummy,GetUnitX(caster))
        call SetUnitY(sunkenDummy,GetUnitY(caster))
        call PauseUnit(caster,true)
        call SetUnitInvulnerable(caster,true)
        call SetUnitFlyHeight(caster,3000.,0)
        if GetLocalPlayer()==GetOwningPlayer(caster) then
            call ClearSelection() //Using this instead of SelectUnit(caster,false)
            call SelectUnit(sunkenDummy,true)
        endif
        call SetUnitVertexColor(caster,0,0,0,0)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_POINT_ORDER)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_TARGET_ORDER)
        call TriggerRegisterUnitEvent(moves,sunkenDummy,EVENT_UNIT_ISSUED_ORDER)
        call TriggerAddCondition(moves,Condition(function movesC)) //Need a way to move caster through triggers..
        set sunkenDummy=null
        set moves=null
    endfunction

    private function p takes nothing returns nothing
        local integer iLoop=0
        local submergeDat tempDat
        loop
            exitwhen iLoop>dbIndex
            set tempDat=submergeDB[iLoop]
            call SetUnitFlyHeight(tempDat.caster,GetUnitFlyHeight(tempDat.caster)+tempDat.steps,0.)
            set tempDat.steps=tempDat.steps-1
            if tempDat.steps<-1*STARTVEC then
                call after(tempDat.caster)
                call tempDat.destroy()
                set submergeDB[iLoop]=submergeDB[dbIndex]
                set dbIndex=dbIndex-1
                set iLoop=iLoop-1
                if dbIndex==-1 then
                    call PauseTimer(time)
                endif
            endif
            set iLoop=iLoop+1
        endloop
    endfunction
    
    private function c takes nothing returns boolean
        local submergeDat tempDat
        local unit tU
        if GetSpellAbilityId()==SPELCODE then
            set tU=GetTriggerUnit()
            if IsTerrainPathable(GetUnitX(tU),GetUnitY(tU),PATHING_TYPE_FLOATABILITY)==false then
                set tempDat=submergeDat.create()
                set tempDat.caster=tU
                set tempDat.steps=STARTVEC-GetHeroLevel(tempDat.caster)/4
                call UnitAddAbility(tempDat.caster,BIRDCODE)
                call UnitRemoveAbility(tempDat.caster,BIRDCODE)
                if dbIndex==-1 then
                    call TimerStart(time,FIDELITY,true,function p)
                endif
                set dbIndex=dbIndex+1
                set submergeDB[dbIndex]=tempDat
            else
                call DisplayTextToPlayer(GetOwningPlayer(tU),0,0,"The water is not deep enough here!")
                call UnitRemoveAbility(tU,SPELCODE)
                call UnitAddAbility(tU,SPELCODE)
            endif
            set tU=null
        endif
        return false
    endfunction

    private function i takes nothing returns nothing
        local trigger t=CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t,Condition(function c))
        set t=null
    endfunction
endscope

Hmm... dynamic triggering; I like it. I'm going to try and learn how to do it.

Thanks!
 
Hmm... dynamic triggering; I like it. I'm going to try and learn how to do it.

Thanks!
I'd say don't bother with it.
The uses are limited to only very few cases.

And the only frequently used case is damage detection - and everyone should be encouraged to use one of the damage detection systems that have already been created, as they are proven to work and bug free and far more efficient than any unexperienced coder could make them on his own.
 
Level 4
Joined
May 14, 2013
Messages
48
ok so ive reworked this trigger system 45 times i can use some work arounds. i could list all these triggers but it would just be too confusing so i will briefly explain them.

#1 i could use indexing and hash tables in a similar way most map makers do things. but if i did that it would require about 4000-10000 variables to do what i want on the scale im thinking so that wont work. also using variables and indexing ends up requiring an abundance of "every .03 seconds" triggers that are turning on and off and when i tested it with a full load it lagged so this is not ideal. plus its was too tedious.

#2 my very first attempt was very simple . it used dummy units and multiple copies of triggers referring to the list of dummy units. problem with this it requires about 10 dummies and 10 copies of each trigger. amounting to around 1000 triggers and dummies. this created no lag but takes up a ton of space. this is also very tedious but the plus side is i have alot of simple control over effects requiring almost no indexing.

#3 my last system used a very small amount of variables and indexing only 1 trigger per effect and very efficient in terms of lag and space. the problem with this system is it creates loads and loads of added events these need to be cleared before u can quit the map or else it takes about 5 minutes to close the map. i would very much so like to see this custom script to remove a trigger so i could create a quit protocol that would delete all the triggers.

please help i really just wanted to see how to destroy a trigger in Gui i was already aware of the work arounds and have thoroughly exhausted all other options.

i want to keep this 100% Gui i understand a small bit of Jass and originally this was going to be done in Jass and was seeming simpler. however Jass maps often crash or at the least have many bugs on Mac Os i found this to be unacceptable. this is a huge problem with creating maps to be played publicly.'

i own several computers one is a mac and i have done a load of tests in multi-player and i can say jass simply is not well supported by a mac. also note that when made in Gui properly i saw absolutely no problems with the mac and pc multi-player.
 
Level 4
Joined
May 14, 2013
Messages
48
im sure your correct on this and from the little ive done in JASS i also see this point to be very valid. but what i concluded from experimenting with my own maps and others maps is JASS simply does not like mac OS. id love to be wrong about this but from my very thorough investigation on this proves it to be a problem. i have no idea why this happens but if you don't agree with me try it yourself. simple jass often is not a problem but with more advanced jass it starts with the problems
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
im sure your correct on this and from the little ive done in JASS i also see this point to be very valid. but what i concluded from experimenting with my own maps and others maps is JASS simply does not like mac OS. id love to be wrong about this but from my very thorough investigation on this proves it to be a problem. i have no idea why this happens but if you don't agree with me try it yourself. simple jass often is not a problem but with more advanced jass it starts with the problems

I've heard that it's about the lua scripts, but I'm not entirely sure.
Things I avoid using in vJASS myself:
Structs(cos I can just use arrays)
textmacros(lua)
 
vJASS requires jasshelper, which is an executable file that cannot be natively executed on Mac OS X. You can, however, run it with WINE:
http://www.hiveworkshop.com/forums/miscellaneous-tutorials-456/how-run-vjass-mac-computer-168834/

Although, it may be a bit inconvenient. If I were you, I would just stick to regular JASS, unless you need to compile someone else's script.

I've heard that it's about the lua scripts, but I'm not entirely sure.
Things I avoid using in vJASS myself:
Structs(cos I can just use arrays)
textmacros(lua)

It's just because JNGP's files (jasshelper, etc.) are .exe when OS X uses .app. Also, textmacros aren't lua. ;) They use the same notation //! but textmacros follow regular vJASS syntax, aside from having $x$ for macro variables.

Sorry for going off topic.
 
Level 4
Joined
May 14, 2013
Messages
48
thanks for the all info on the mac OS issue. i can always use my PC and most of my work is done on my PC. that's not the problem but i would like people with Macs and PCs to be able to play it without wine or any other kind of Modding. that's cool to see wine works with Vjass i bet it crashes a lot though.

no problem on the topic thing i already posted my problem in the triggers and script section got it solved in 5 minutes. but this was an interesting topic.

thank you everyone for your input. look to see an amazing map by the end of this year i have been working on it for 3 years now.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
All vJASS is compiled into regular JASS, which can be executed by warcraft just as well in any pretty much any computer.
So the only limitation would be that modifying maps that contain vJASS will be considerably harder. Playing them will be unaffected.
 
Level 4
Joined
May 14, 2013
Messages
48
So its only lua scripts? i am unfamiliar with those.

basically what happened was a few years ago when i started working on my map i was using imported scripts and newgen we world editor and some other stuff i was starting to learn JASS. but it didn't work on my friends MAC. so i tried it on my mac it also didn't work? so we tried some other maps made by others same issue. i did a lot of testing importing scripts and testing maps made by others. but i never really figured out what part was messing it up and i wanted my map to work on any computer so i started making all the triggers by myself in GUI.
so all ive been working with is GUI and a couple of JASS scripts i imported that didnt crash when i tested it on a mac. I didn't really learn much of JASS because i thought it caused crashing on mac OS. should i have been learning more JASS?

what is Lua is that the only thing that crashes or bugs on mac or are there other things? is there a thread i can find out more about mac capability just for playing not for editing i just want a mac to run the map i don't need it to open it or edit it.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
So its only lua scripts? i am unfamiliar with those.

basically what happened was a few years ago when i started working on my map i was using imported scripts and newgen we world editor and some other stuff i was starting to learn JASS. but it didn't work on my friends MAC. so i tried it on my mac it also didn't work? so we tried some other maps made by others same issue. i did a lot of testing importing scripts and testing maps made by others. but i never really figured out what part was messing it up and i wanted my map to work on any computer so i started making all the triggers by myself in GUI.
so all ive been working with is GUI and a couple of JASS scripts i imported that didnt crash when i tested it on a mac. I didn't really learn much of JASS because i thought it caused crashing on mac OS. should i have been learning more JASS?

what is Lua is that the only thing that crashes or bugs on mac or are there other things? is there a thread i can find out more about mac capability just for playing not for editing i just want a mac to run the map i don't need it to open it or edit it.

It seems from what purgeandfire said that it's all about JASShelper. So basically vJASS is out of the question in the form that it's implemented in JNGPE.
 
@death: Sadly no. It would have to be coded in objective C or in java to directly support macs. JassHelper may work, but JNGP won't unless it is recoded to support the mac editor. It is not really worth it though. Only macs running the powerPC processors can even open the world editor (mine cannot). The introduction of OS X 10.7 (Lion) removed the software Rosetta, which allowed macs to run PowerPC files even if you had an intel-based processor.

Blizzard never changed the files since, however. The Warcraft III program (not the editor) is now an .app file, but the editor and the installer are still PowerPC files. It is funny, you can only install it if you have the appropriate processor or are running OS X 10.6 or lower. That's why it is a bit rare to see people running Warcraft 3 on a mac.

It still works fine for playing, but there are some mac-specific issues such as the BLP mipmap bug. As far as modding on a mac goes, it isn't really worth it at times due to all the bugs. Blizzard does not support the Mac editor (it was made by a different company), and do not plan on updating it. [Source (Sarj14, post #6)]

is there a thread i can find out more about mac capability just for playing not for editing i just want a mac to run the map i don't need it to open it or edit it.

There are a couple of threads here and there that note problems with macs. There isn't one big list, though. If you are looking for issues with macs related to the gameplay, the best place to look is on the battle.net forums. You can also shoot questions at me, since I play LAN occasionally on my Mac. For modding, Weep is the main person who experimented with modding on a Mac. Tooltiperror did as well, but he doesn't have it installed anymore, afaik.
 
Status
Not open for further replies.
Top