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...
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
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
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
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
Upgrade to StarCraft II. Unless specified via a requirement you can research upgrades indefinatly and in parallel there.