• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Unlimited upgrades

Status
Not open for further replies.
Level 3
Joined
Feb 21, 2012
Messages
38
Can u guys give me trigger how to remove limit from an upgrade means how to reseach a upgrade indinite times?
 
Level 3
Joined
Feb 21, 2012
Messages
38
I want to put a trigger on upgrade or really-
Either - U reaseach a upgrade the effects are there and the same upgrade can be reaseached again

or- u buy and item and whenever u buy that particular item it gives +3 damage a particular kind of unit(units that are present and units that will be trained in future)
 
Level 30
Joined
Jul 31, 2010
Messages
5,246
in a simple way, go to "Object Editor" there you can just increase the "Level" of your chosen upgrade [e.g Levels 99999999999], then remove all "Level Techtree Requirements".

it is quite unusual and not good for giving an unlimited upgrade
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
or- u buy and item and whenever u buy that particular item it gives +3 damage a particular kind of unit(units that are present and units that will be trained in future)

its possible with a damage detection system...the idea behind it is count the number of
items (or charges used), add it all like 3+3+3+3+3 and so on...the total of it is your total
damage ofc...

you need to use hashtable and 1 dummy unit per player, the dummy unit loads the damage...
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
its possible with a damage detection system...the idea behind it is count the number of
items (or charges used), add it all like 3+3+3+3+3 and so on...the total of it is your total
damage ofc...

you need to use hashtable and 1 dummy unit per player, the dummy unit loads the damage...

You don't need any of that nonsense. I do exactly what he's talking about in my wmw map... each upgrade only has 1 level and I get unlimited upgrades >.>. Just start a timer that ends .01 seconds before the upgrade ends. When the timer ends, issue the cancel order to the researching unit and do what you want to do. If you want bonus damage, enumerate over all units of a type and add bonus damage to them. Also, be sure to do an index event so that you can add bonus damage to the unit if it is of that type.

Good game. All of this is set up in my wmw map w/o any dummy units or other weird nonsense.


Also, if you want % damage increase, my suggestion is to use a damage detection system and then amplify the damage by the target %, which is something else I have in my map :\.


So yea, all the stuff you want to do is possible. Don't let people tell you otherwise ; ).


For nonbelievers, this video demonstrates my infinite upgrades with only 1 level per tech (just skip ahead to where I build advanced tech center and start upgrading for plans). If you want to see sample code, open the map and go to the Plans trigger. Also be sure to look at the triggers named after the ancient towers ^)^.
http://www.hiveworkshop.com/forums/2104109-post18.html


This all ofc requires vjass knowledge
 
Level 3
Joined
Feb 21, 2012
Messages
38
You don't need any of that nonsense. I do exactly what he's talking about in my wmw map... each upgrade only has 1 level and I get unlimited upgrades >.>. Just start a timer that ends .01 seconds before the upgrade ends. When the timer ends, issue the cancel order to the researching unit and do what you want to do. If you want bonus damage, enumerate over all units of a type and add bonus damage to them. Also, be sure to do an index event so that you can add bonus damage to the unit if it is of that type.

Good game. All of this is set up in my wmw map w/o any dummy units or other weird nonsense.


Also, if you want % damage increase, my suggestion is to use a damage detection system and then amplify the damage by the target %, which is something else I have in my map :\.


So yea, all the stuff you want to do is possible. Don't let people tell you otherwise ; ).


For nonbelievers, this video demonstrates my infinite upgrades with only 1 level per tech (just skip ahead to where I build advanced tech center and start upgrading for plans). If you want to see sample code, open the map and go to the Plans trigger. Also be sure to look at the triggers named after the ancient towers ^)^.
http://www.hiveworkshop.com/forums/2104109-post18.html


This all ofc requires vjass knowledge

Wow thanks but can u pls give a trigger i am extremely new to world editor
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Unit begins to research
Start a timer that expires .01 seconds before research is complete
hash[timer] = unit index

timer expires
unit = hash[expired]
research_global = hash2[expired]
set player gold/lumber to 1 mil
enable cancellation trigger
cancel all researches
in cancellation trigger, if canceled research is != research_global, issue order to unit to start it back up
disable cancellation trigger
set player gold/lumber back to what it was
run your custom code


Here is my implementation in my wmw map (a lot more than you need because I'm using items in a builder to show how many times an upgrade was researched)
JASS:
library Plans uses RegisterPlayerUnitEvent, UnitIndexer, Table, TowerBuilders, Race
    struct Plans extends array
        private static Table researchTime
        private static Table builderId
        private static Table itemId
        private static Table co
        private static Table coi
        private static Table table
        private static Table item2Tech
        private static hashtable plans
        private static timer array tm
        private static integer array researchId
        private static boolean enabled = false
        private static integer array rid
        private static integer rc = 0
        
        private static method onResearchFinish takes nothing returns nothing
            local integer h = GetHandleId(GetExpiredTimer())
            local integer techIndex = table[h]
            local unit tech = GetUnitById(techIndex)
            local integer g = GetPlayerState(GetOwningPlayer(tech), PLAYER_STATE_RESOURCE_GOLD)
            local integer l = GetPlayerState(GetOwningPlayer(tech), PLAYER_STATE_RESOURCE_LUMBER)
            local integer builderIndex
            local unit builder
            local integer c
            local integer itd
            local item pln
            
            call PauseTimer(GetExpiredTimer())
            call DestroyTimer(GetExpiredTimer())
            set tm[techIndex] = null
            call table.remove(h)
            
            set enabled = true
            call IssueImmediateOrderById(tech, 851976)
            call IssueImmediateOrderById(tech, 851976)
            call IssueImmediateOrderById(tech, 851976)
            call IssueImmediateOrderById(tech, 851976)
            call IssueImmediateOrderById(tech, 851976)
            call IssueImmediateOrderById(tech, 851976)
            set enabled = false
            
            call SetPlayerState(GetOwningPlayer(tech), PLAYER_STATE_RESOURCE_LUMBER, l)
            call SetPlayerState(GetOwningPlayer(tech), PLAYER_STATE_RESOURCE_GOLD, g)
            call SetPlayerState(GetOwningPlayer(tech), PLAYER_STATE_RESOURCE_LUMBER, l)
            
            loop
                exitwhen 0 == rc
                set rc = rc - 1
                call IssueImmediateOrderById(tech, rid[rc])
            endloop
            
            set builder = TowerBuilders[GetPlayerId(GetOwningPlayer(tech))].get(builderId[GetUnitTypeId(tech)])
            if (null != builder) then
                set builderIndex = GetUnitUserData(builder)
                set itd = itemId[researchId[techIndex]]
                set pln = LoadItemHandle(plans, builderIndex, itd)
                set c = GetItemCharges(pln)
                
                if (0 == c) then
                    call SaveItemHandle(plans, builderIndex, itd, UnitAddItemById(builder, itd))
                else
                    call SetItemCharges(pln, GetItemCharges(pln)+1)
                endif
            endif
            
            set tech = null
            set builder = null
            set tech = null
        endmethod
        private static method onResearchStart takes nothing returns boolean
            local thistype this
            local timer t
            if (researchTime.real.has(GetResearched())) then
                set this = GetUnitUserData(GetTriggerUnit())
                set researchId[this] = GetResearched()
                set t = CreateTimer()
                set tm[this] = t
                set table[GetHandleId(t)] = this
                call TimerStart(t, researchTime.real[GetResearched()]-.01, false, function thistype.onResearchFinish)
                set t = null
            endif
            return false
        endmethod
        private static method onResearchCancel takes nothing returns boolean
            local thistype this = GetUnitUserData(GetTriggerUnit())
            local timer t = tm[this]
            if (GetResearched() == researchId[this]) then
                if (null != t) then
                    call table.remove(GetHandleId(t))
                    call PauseTimer(t)
                    call DestroyTimer(t)
                    set tm[this] = null
                    set researchId[this] = 0
                    set t = null
                endif
            elseif (enabled) then
                set rid[rc] = GetResearched()
                set rc = rc + 1
            endif
            return false
        endmethod
        static method gen takes integer tid, integer bid returns nothing
            set builderId[tid] = bid
        endmethod
        static method add takes integer tid, integer upgrade, integer itd, real time returns nothing
            set researchTime.real[upgrade] = time
            set itemId[upgrade] = itd
            set item2Tech[itd] = tid
        endmethod
        static method setUnitReq takes integer towerId, integer itd, integer count returns nothing
            set co[towerId] = count
            set coi[towerId] = itd
        endmethod
        
        private static timer cp
        private static integer array cph
        private static integer cpc = 0
        private static method checkConstruct takes nothing returns nothing
            local unit tower
            local integer towerIndex
            local integer builderIndex
            local item pln
            local integer count
            local integer c
            local integer itd
            local unit builder
            local integer towerId
            
            loop
                exitwhen 0 == cpc
                set cpc = cpc - 1
                
                set towerIndex = cph[cpc]
                set tower = GetUnitById(towerIndex)
                set towerId = GetUnitTypeId(tower)
                
                if (0 != towerId) then
                    set itd = coi[towerId]
                    set count = co[towerId]
                    
                    set builder = TowerBuilders[GetPlayerId(GetOwningPlayer(tower))].get(builderId[item2Tech[itd]])
                    set builderIndex = GetUnitUserData(builder)
                    set pln = LoadItemHandle(plans, builderIndex, itd)
                    set c = GetItemCharges(pln)
                    
                    if (c >= count) then
                        set c = c - count
                        if (0 == c) then
                            call RemoveItem(pln)
                            call RemoveSavedHandle(plans, builderIndex, itd)
                        else
                            call SetItemCharges(pln, c)
                        endif
                    else
                        call WriteTextTag("Not Enough "+GetObjectName(itd)+" To Build "+GetUnitName(tower), 10, GetUnitX(tower), GetUnitY(tower), GetLocalPlayer() == GetOwningPlayer(tower))
                        call IssueImmediateOrderById(tower, 851976)
                        if (towerId == GetUnitTypeId(tower)) then
                            call KillUnit(tower)
                        endif
                    endif
                endif
                
                call UnitIndex(towerIndex).unlock()
            endloop
            
            set pln = null
            set builder = null
            set tower = null
        endmethod
        private static method constructStart takes nothing returns boolean
            local integer i = GetUnitUserData(GetTriggerUnit())
            
            if (0 < co[GetUnitTypeId(GetTriggerUnit())]) then
                if (IsUnitIndexed(GetTriggerUnit())) then
                    call UnitIndex(i).lock()
                    set cph[cpc] = i
                    set cpc = cpc + 1
                    call TimerStart(cp, 0, false, function thistype.checkConstruct)
                endif
            endif
            
            return false
        endmethod
        private static method init takes nothing returns boolean
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_RESEARCH_START,Condition(function thistype.onResearchStart))
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_RESEARCH_CANCEL,Condition(function thistype.onResearchCancel))
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_START, Condition(function thistype.constructStart))
            call RegisterPlayerUnitEvent(EVENT_PLAYER_UNIT_UPGRADE_START, Condition(function thistype.constructStart))
            return false
        endmethod
        private static method onInit takes nothing returns nothing
            set table = Table.create()
            set researchTime = Table.create()
            set itemId = Table.create()
            set plans = InitHashtable()
            set co = Table.create()
            set coi = Table.create()
            set item2Tech = Table.create()
            set builderId = Table.create()
            set cp = CreateTimer()
            
            call Game.onInitialize.register(Condition(function thistype.init))
            call Game.onInitializeSolo.register(Condition(function thistype.init))
        endmethod
    endstruct
endlibrary

And here are some techs using it
JASS:
struct BeamTech extends array
    private static constant integer TECH = 'e005'
    private static constant integer TECH_ADV = 'e009'
    private static constant integer BUILDER = 'e008'
    private static constant integer BUILDER_ADV = 'e006'
    
    private static constant integer PLANS_BASIC = 'R00C'
    private static constant integer ITEM_BASIC = 'I000'
    private static constant real TIME_BASIC = 2
    
    private static constant integer PLANS_CORRUPTION = 'R00D'
    private static constant integer ITEM_CORRUPTION = 'I001'
    private static constant real TIME_CORRUPTION = 4
    
    private static constant integer PLANS_CONDENSER = 'R00E'
    private static constant integer ITEM_CONDENSER = 'I002'
    private static constant real TIME_CONDENSER = 8
    
    private static constant integer PLANS_DEMOLISHER = 'R00F'
    private static constant integer ITEM_DEMOLISHER = 'I003'
    private static constant real TIME_DEMOLISHER = 15
    
    private static method init takes nothing returns boolean
        call Plans.gen(TECH_ADV, BUILDER_ADV)
        
        call Plans.add(TECH_ADV, PLANS_BASIC, ITEM_BASIC, TIME_BASIC)
        call Plans.add(TECH_ADV, PLANS_CORRUPTION, ITEM_CORRUPTION, TIME_CORRUPTION)
        call Plans.add(TECH_ADV, PLANS_CONDENSER, ITEM_CONDENSER, TIME_CONDENSER)
        call Plans.add(TECH_ADV, PLANS_DEMOLISHER, ITEM_DEMOLISHER, TIME_DEMOLISHER)
        
        return false
    endmethod
    private static method onInit takes nothing returns nothing
        call Game.onInitialize.register(Condition(function thistype.init))
        call Game.onInitializeSolo.register(Condition(function thistype.init))
    endmethod
endstruct
 
Level 3
Joined
Feb 21, 2012
Messages
38
Can u give a copy of wc3 trigger pic i cant understand if u can jst elaborate more..................................................
like-
Genric unit event-
A unit begins and upgrade
Condition -
_____________________
Tottally blank after tht pls give in simplified i cant understand wat and how sry
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Can u give a copy of wc3 trigger pic i cant understand if u can jst elaborate more..................................................
like-
Genric unit event-
A unit begins and upgrade
Condition -
_____________________
Tottally blank after tht pls give in simplified i cant understand wat and how sry

I only do vJASS.

No GUI, sry
 
well upgrades can go high, but i wouldnt recomend putting them past 100.... in editor, or you will get a little delay when the upgrade building is first selected...
really though quality over quantity.., does the user really need to click 100 times to get 100 dmg, or would 10 dmg per click, at 10x the cost suffice ;P, mostly saying this because you are a 'beginner' :p, unlimited at your skill level would be kinda hard.. but if 100's not enough...
 
Level 16
Joined
Aug 20, 2009
Messages
1,552
Press shift on the level, and input 10000 or more.

you can do infinite upgrade with damage with item ability. "Item permanent damage Gain",

just put it on Tome/Powerups, and give it to the unit/hero (Yes, you can give it to the unit). when you train another unit, just save how much you have upgraded, and give the item in loop. if you have upgraded 123x, just loop give item 123 times to every trained unit?
 
@ last suggest, that would only work for anything tome workable, i would suggest a different alternative (although not infinite), you add abilitys for every didget you want the upgrade to go to (not unlimited, but 4 upgrades with 10 levels each (9 if you wana work harder), gets you 9999 upgrades, which would maybe be clickable in a decent length game if that was the whole goal of the game..., but u can always throw another one in for good measure :p...
first upgrade could add 0-9 dmg, second 10,20,30,40,50,60,ect, 3rd 100,200,300, ect ect..., that should cover just about anything an upgrade can do (asuming there is an ability with the same effect)
 
Status
Not open for further replies.
Top