ChrisDTian
New Member
- Reaction score
- 0
Ive been experiencing bugs
BUG NO.1
Ive set a respawn system that is based on player gold when the player Hero dies and its gold is equal to 500
it will automatically respawn the hero else the player will wait to get 500 gold
but sometimes when it reaches 500 it wont respawn the hero
BUG NO. 2
ive setted the attack of a unit to dodgeable missile codes
im using XE library
when i attack an enemy and the unit takes damage it will TRIGGER the function
but when i press "STOP" the function will stack and will make multiple attack missiles to the target
BUG NO. 3
I cant Display a multiboard xDDD pls help me
BUG NO.4
Maybe not a bug how can i change a units max life? and mana?
ALL OF THOSE ARE THE BUGS IN MY MAP SO IF YOU FIND MORE BUGS PLS TELL ME
to the best coders here pls help me fix this bugs
BUG NO.1
Ive set a respawn system that is based on player gold when the player Hero dies and its gold is equal to 500
it will automatically respawn the hero else the player will wait to get 500 gold
but sometimes when it reaches 500 it wont respawn the hero
BUG NO. 2
ive setted the attack of a unit to dodgeable missile codes
im using XE library
when i attack an enemy and the unit takes damage it will TRIGGER the function
but when i press "STOP" the function will stack and will make multiple attack missiles to the target
BUG NO. 3
I cant Display a multiboard xDDD pls help me
BUG NO.4
Maybe not a bug how can i change a units max life? and mana?
ALL OF THOSE ARE THE BUGS IN MY MAP SO IF YOU FIND MORE BUGS PLS TELL ME
to the best coders here pls help me fix this bugs
Code:
scope LightningOrbAttack initializer Init_LightningOrbAttack
globals
real DamageSize
endglobals
private struct LightningOrb extends xecollider
//
// For example, I am storing the owner of the green missile here.
// owner would be the hero that used the item.
//
unit owner
//
// So, the onUnitHit will fire whenever there is a collision
// between the collider and some unit, notice you can use the
// struct's members in this method, this is actualyl a xecollider
// as well, so you can use all xecollider's members and methods in it.
//
method onUnitHit takes unit target returns nothing
local effect e
local real r
local texttag tt
local string text
local integer i
// Don't explode if the owner is "hit", often when creating the missile
// it would think it hit the unit that created it...
if (this.owner != target and IsUnitEnemy(target,GetOwningPlayer(this.owner)) == true) then
set e = AddSpecialEffectTarget("war3mapImported\\Blue Lightning.mdx",target,"origin")
call DestroyEffect(e)
set tt = CreateTextTag()
set text = I2S(R2I(DamageSize)) + "!"
call SetTextTagText(tt, text, 0.024)
call SetTextTagPos(tt, GetUnitX(target), GetUnitY(target), 0.0)
call SetTextTagColor(tt, 0, 0, 255, 255)
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagVisibility(tt, true)
call SetTextTagFadepoint(tt, 2.0)
call SetTextTagLifespan(tt, 5.0)
call SetTextTagPermanent(tt, false)
set text = null
set tt = null
call UnitDamageTarget(this.owner,target,DamageSize,false,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_DIVINE,WEAPON_TYPE_CLAW_HEAVY_SLICE)
set r = DamageSize
set tt = CreateTextTag()
set text = "+" + I2S(R2I(r)) + "MP"
call SetTextTagText(tt, text, 0.048)
call SetTextTagPos(tt, GetUnitX(this.owner)+50, GetUnitY(this.owner)+100, 0.0)
call SetTextTagColor(tt, 0, 0, 255, 255)
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagVisibility(tt, true)
call SetTextTagFadepoint(tt, 2.0)
call SetTextTagLifespan(tt, 5.0)
call SetTextTagPermanent(tt, false)
call SetUnitState(this.owner,UNIT_STATE_MANA,GetUnitState(this.owner,UNIT_STATE_MANA) + r)
set text = null
set tt = null
call UnitAddItemById(this.owner,'I000')
call UnitAddItemById(this.owner,'I001')
call SetUnitState(target,UNIT_STATE_MANA,GetUnitState(target,UNIT_STATE_MANA) - DamageSize)
if GetUnitState(target,UNIT_STATE_LIFE) <= 0 then
set tt = CreateTextTag()
set r = GetUnitState(target,UNIT_STATE_MAX_LIFE)*0.10
set text = "+" + I2S(R2I(r))
set i = GetRandomInt(0,2)
call SetTextTagText(tt, text, 0.048)
call SetTextTagPos(tt, GetUnitX(this.owner), GetUnitY(this.owner), 0.0)
if i == 0 then
call SetTextTagColor(tt, 255, 128, 128, 255)
elseif i == 1 then
call SetTextTagColor(tt, 128, 255, 128, 255)
elseif i == 2 then
call SetTextTagColor(tt, 128, 128, 255, 255)
endif
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagVisibility(tt, true)
call SetTextTagFadepoint(tt, 2.0)
call SetTextTagLifespan(tt, 5.0)
call SetTextTagPermanent(tt, false)
set text = null
set tt = null
call ModifyHeroStat(i,this.owner, 0, R2I(r))
set r = GetRandomReal(0,GetRandomReal(0,DamageSize) + (GetHeroStr(this.owner,false)*0.10))
set tt = CreateTextTag()
set text = "+" + I2S(R2I(r)) + "HP"
call SetTextTagText(tt, text, 0.048)
call SetTextTagPos(tt, GetUnitX(this.owner)+50, GetUnitY(this.owner), 0.0)
call SetTextTagColor(tt, 255, 0, 0, 255)
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagVisibility(tt, true)
call SetTextTagFadepoint(tt, 2.0)
call SetTextTagLifespan(tt, 5.0)
call SetTextTagPermanent(tt, false)
call SetUnitState(this.owner,UNIT_STATE_LIFE,GetUnitState(this.owner,UNIT_STATE_LIFE) + r)
set text = null
set tt = null
endif
// No, do not call .destroy(), terminate is better
call this.terminate()
endif
endmethod
endstruct
function CreateLightningOrb takes unit damager, unit target returns nothing
local location l = GetUnitLoc(target)
local real size = GetRandomReal(0.50,1.50)
local unit u = damager
local real r = size*100
local real targetpoint = Atan2( GetLocationY(l) - GetUnitY(u)+GetRandomReal(-r,r), GetLocationX(l) - GetUnitX(u)+GetRandomReal(-r,r))
local LightningOrb m
if damager != null and target != null then
set m = LightningOrb.create(GetUnitX(u), GetUnitY(u) ,targetpoint)
set DamageSize = r+(GetHeroInt(u,false)*0.10)
set m.scale = size
set m.collisionSize = (size * (size/2)) * 100
set m.fxpath = "war3mapImported\\Blue Ball.mdx"
set m.speed = 1000+(GetHeroAgi(u,false)*0.10) // and a speed cap of 500.0,
set m.expirationTime = (GetUnitAcquireRange(u)/m.speed)*(GetHeroLevel(u)*0.10) + 1 // So, try visualizing those thing
set m.z = 75.0 // some height, since missiles often fly...
set m.owner = u // important stuff, see how our collider is using the greenMissile struct
// so we can assign the owner, as you saw above the owner determines
// what can hit the missile and who to credit the damage for
call RemoveLocation(l) //We need to clean the point.
set target=null
set u=null
set l=null
endif
endfunction
function LightningOrbCondition takes nothing returns boolean
local trigger t = GetTriggeringTrigger()
local real r = GetEventDamage()
local unit u = GetTriggerUnit()
local unit d = GetEventDamageSource()
if r >= 1 and GetUnitTypeId(d) == 'X000' and u != null then
call DestroyTrigger(t)
call CreateLightningOrb(d,u)
set t = null
set u = null
set d = null
set r = 0
endif
return false
endfunction
function LightningOrbTrigger takes nothing returns boolean
local trigger t = CreateTrigger()
local unit u = GetTriggerUnit()
if GetUnitTypeId(GetAttacker()) == 'X000' and u != null and GetUnitStateSwap(UNIT_STATE_MANA,GetAttacker()) >= 100 then
call SetUnitState(GetAttacker(),UNIT_STATE_MANA,GetUnitState(GetAttacker(),UNIT_STATE_MANA) - 100)
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(t,Condition(function LightningOrbCondition))
set u = null
set t = null
endif
return false
endfunction
function Init_LightningOrbAttack takes nothing returns nothing
local trigger ts = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(ts, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(ts,Condition(function LightningOrbTrigger))
set ts = null
endfunction
endscope
Code:
scope SniperBulletAttack initializer Init_SniperBulletAttack
private struct SniperBullet extends xecollider
//
// For example, I am storing the owner of the green missile here.
// owner would be the hero that used the item.
//
unit owner
//
// So, the onUnitHit will fire whenever there is a collision
// between the collider and some unit, notice you can use the
// struct's members in this method, this is actualyl a xecollider
// as well, so you can use all xecollider's members and methods in it.
//
method onUnitHit takes unit target returns nothing
local real r
local texttag tt
local string text
local unit u
// Don't explode if the owner is "hit", often when creating the missile
// it would think it hit the unit that created it...
if (this.owner != target and IsUnitEnemy(target,GetOwningPlayer(this.owner)) == true) then
set r = GetRandomReal(1,5)*10
set tt = CreateTextTag()
set text = I2S(R2I(r)) + "!"
call SetTextTagText(tt, text, 0.024)
call SetTextTagPos(tt, GetUnitX(target), GetUnitY(target), 0.0)
call SetTextTagColor(tt, 128, 255, 128, 255)
call SetTextTagVelocity(tt, 0.0, 0.04)
call SetTextTagVisibility(tt, true)
call SetTextTagFadepoint(tt, 2.0)
call SetTextTagLifespan(tt, 5.0)
call SetTextTagPermanent(tt, false)
set text = null
set tt = null
set u = CreateUnit(GetOwningPlayer(this.owner),'e000',0,0,0)
call UnitDamageTarget(this.owner,target,DamageSize,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_CLAW_HEAVY_SLICE)
call RemoveUnit(u)
set u = null
// No, do not call .destroy(), terminate is better
call this.terminate()
endif
endmethod
endstruct
function CreateSniperBullet takes unit damager, unit target returns nothing
local location l = GetUnitLoc(target)
local real size = 1
local unit u = damager
local real r = size*100
local real targetpoint = Atan2( GetLocationY(l) - GetUnitY(u)+GetRandomReal(-r,r), GetLocationX(l) - GetUnitX(u)+GetRandomReal(-r,r))
local SniperBullet m
if damager != null and target != null then
set m = SniperBullet.create(GetUnitX(u), GetUnitY(u) ,targetpoint)
set m.scale = size
set m.collisionSize = (size * (size/2)) * 100
set m.fxpath = "Abilities\\Weapons\\WardenMissile\\WardenMissile.mdl"
set m.speed = 1000 // and a speed cap of 500.0,
set m.expirationTime = (GetUnitAcquireRange(u)/m.speed)*2 // So, try visualizing those thing
set m.z = 75.0 // some height, since missiles often fly...
set m.owner = u // important stuff, see how our collider is using the greenMissile struct
// so we can assign the owner, as you saw above the owner determines
// what can hit the missile and who to credit the damage for
call RemoveLocation(l) //We need to clean the point.
set target=null
set u=null
set l=null
endif
endfunction
function SniperBulletCondition takes nothing returns boolean
local trigger t = GetTriggeringTrigger()
local real r = GetEventDamage()
local unit u = GetTriggerUnit()
local unit d = GetEventDamageSource()
if r >= 1 and GetUnitTypeId(d) == 'hrif' and u != null then
call DestroyTrigger(t)
call CreateSniperBullet(d,u)
set t = null
set u = null
set d = null
set r = 0
endif
return false
endfunction
function SniperBulletTrigger takes nothing returns boolean
local trigger t = CreateTrigger()
local unit u = GetTriggerUnit()
if GetUnitTypeId(GetAttacker()) == 'hrif' and u != null then
call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DAMAGED)
call TriggerAddCondition(t,Condition(function SniperBulletCondition))
set u = null
set t = null
endif
return false
endfunction
function Init_SniperBulletAttack takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(t,Condition(function SniperBulletTrigger))
set t = null
endfunction
endscope
Code:
globals
rect array RR
rect array RRR
integer SpawnCost = 500
integer UnitNo = 3
unit array Heroes
trigger array HeroesTrigger
hashtable HTR
endglobals
function SpawnFootMan takes nothing returns nothing
local integer i = 0
local integer UnitSpawnNo = 0
local unit array u
loop
exitwhen i > 3
loop
exitwhen UnitSpawnNo > UnitNo
set u[UnitSpawnNo] = CreateUnitAtLoc(Player(i),'hfoo',GetRandomLocInRect(RR[i]),0)
call AddSpecialEffectTarget("war3mapImported\\Devil Blade.mdx",u[UnitSpawnNo],"hand left")
set UnitSpawnNo = UnitSpawnNo + 1
endloop
set i = i + 1
if UnitSpawnNo > UnitNo then
set UnitSpawnNo = 0
endif
endloop
endfunction
function SpawnRifleMan takes nothing returns nothing
local integer i = 0
local integer UnitSpawnNo = 0
local unit array u
loop
exitwhen i > 3
loop
exitwhen UnitSpawnNo > UnitNo
set u[UnitSpawnNo] = CreateUnitAtLoc(Player(i),'hrif',GetRandomLocInRect(RR[i]),0)
set UnitSpawnNo = UnitSpawnNo + 1
endloop
set i = i + 1
if UnitSpawnNo > UnitNo then
set UnitSpawnNo = 0
endif
endloop
endfunction
function SpawnKnight takes nothing returns nothing
local integer i = 0
local integer UnitSpawnNo = 0
local unit array u
loop
exitwhen i > 3
loop
exitwhen UnitSpawnNo > UnitNo
set u[UnitSpawnNo] = CreateUnitAtLoc(Player(i),'hkni',GetRandomLocInRect(RR[i]),0)
call AddSpecialEffectTarget("war3mapImported\\Roots Scyther.mdx",u[UnitSpawnNo],"hand left")
set UnitSpawnNo = UnitSpawnNo + 1
endloop
set i = i + 1
if UnitSpawnNo > UnitNo then
set UnitSpawnNo = 0
endif
endloop
endfunction
function SpawnAttackLocation takes nothing returns nothing
local integer i = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
local integer is = GetRandomInt(1,3)
if GetUnitTypeId(GetTriggerUnit()) != 'e000' then
call IssuePointOrderLoc(GetTriggerUnit(),"attack",GetRandomLocInRect(RRR[i+is]))
endif
endfunction
function ReviveHeroes takes nothing returns nothing
local integer i = 0
local unit u
loop
exitwhen i > 3
set u = LoadUnitHandle(HTR,i,i)
if IsUnitAliveBJ(u) != true and GetUnitTypeId(u) == 'X000' and u != null and GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD) >= SpawnCost then
call ReviveHeroLoc(u,GetRandomLocInRect(RR[GetPlayerId(GetOwningPlayer(u))]),true)
call SetPlayerStateBJ(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD, ( GetPlayerState(GetOwningPlayer(u), PLAYER_STATE_RESOURCE_GOLD) - SpawnCost))
endif
set i = i + 1
set u = null
endloop
endfunction
function Unselect takes nothing returns nothing
if GetUnitTypeId(GetTriggerUnit()) != 'X000' and GetUnitTypeId(GetTriggerUnit()) != 'h000' then
call ClearSelection()
endif
endfunction
function ShowGoldAllPlayers takes nothing returns nothing
local integer i = 1
local string s = null
loop
exitwhen i == 4
set s = I2S(GetPlayerState(Player(i),PLAYER_STATE_RESOURCE_GOLD)) + " " + "GOLD" + " " + "Player" + " " + I2S(i)
call DisplayTimedTextToPlayer(Player(0),0,0,1,s)
set i = i + 1
endloop
endfunction
//===========================================================================
function InitTrig_Spawn takes nothing returns nothing
local trigger FootManTrig = CreateTrigger()
local trigger RifleManTrig = CreateTrigger()
local trigger KnightTrig = CreateTrigger()
local trigger CheckDeathT = CreateTrigger()
local trigger t = CreateTrigger()
local trigger ts = CreateTrigger()
local integer i = 0
local trigger CT = CreateTrigger()
call TriggerRegisterPlayerChatEvent(CT,Player(0),"gold",true)
call TriggerAddAction(CT,function ShowGoldAllPlayers)
set RR[0] = gg_rct_SpawnRed
set RR[1] = gg_rct_SpawnBlue
set RR[2] = gg_rct_SpawnTeal
set RR[3] = gg_rct_SpawnViolet
set RRR[0] = gg_rct_SpawnRedAttack
set RRR[1] = gg_rct_SpawnBlueAttack
set RRR[2] = gg_rct_SpawnTealAttack
set RRR[3] = gg_rct_SpawnVioletAttack
set RRR[4] = gg_rct_SpawnRedAttack
set RRR[5] = gg_rct_SpawnBlueAttack
set RRR[6] = gg_rct_SpawnTealAttack
call TriggerRegisterPlayerSelectionEventBJ(ts,Player(0),true)
call TriggerAddAction(ts,function Unselect)
call TriggerRegisterTimerEventPeriodic( FootManTrig, 3.00 )
call TriggerAddAction( FootManTrig, function SpawnFootMan )
call TriggerRegisterTimerEventPeriodic( RifleManTrig, 7.00 )
call TriggerAddAction( RifleManTrig, function SpawnRifleMan )
call TriggerRegisterTimerEventPeriodic( KnightTrig, 10.00 )
call TriggerAddAction( KnightTrig, function SpawnKnight )
loop
exitwhen i == 4
call TriggerRegisterEnterRectSimple(t, RRR[i])
call TriggerAddAction(t,function SpawnAttackLocation)
set Heroes[i] = CreateUnitAtLoc(Player(i),'X000',GetRandomLocInRect(RR[i]),0)
set HeroesTrigger[i] = CreateTrigger()
call TriggerRegisterTimerEvent(HeroesTrigger[i],1,true)
call TriggerAddAction(HeroesTrigger[i],function ReviveHeroes)
call AddSpecialEffectTarget("war3mapImported\\ArchBlackWing.mdx",Heroes[i],"chest")
call AddSpecialEffectTarget("war3mapImported\\Boomerang.mdx",Heroes[i],"hand left")
call AddSpecialEffectTarget("war3mapImported\\Blue Ball2.mdx",Heroes[i],"hand right")
call SetPlayerFlagBJ( PLAYER_STATE_GIVES_BOUNTY, true, Player(i) )
set i = i + 1
endloop
set HTR = InitHashtable()
call SaveUnitHandle(HTR,0,0,Heroes[0])
call SaveUnitHandle(HTR,1,1,Heroes[1])
call SaveUnitHandle(HTR,2,2,Heroes[2])
call SaveUnitHandle(HTR,3,3,Heroes[3])
endfunction
Attachments
Last edited: