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

Pokemon RPG

Status
Not open for further replies.
Level 16
Joined
Oct 12, 2008
Messages
1,570
The thing is, i made a very easy trigger to encounter pokemons,, it gets more accurate and random later, also walking on road will help later on ;)
Just now i was too lazy to make it better, since it worked xD
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
I told you,,
But i am already rewriting the system,, only it gives me a hard time,, it runs rounds (every pokemon),, but i cant assign triggers (attacks) to a pokemon =S,, really strange, not even the Creeps attack =S,, but i am working on it!
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Ok, go find the bug! >:]

JASS:
scope RBB initializer Init
// =============================================================================\\
    private function EnableMovement takes player p, boolean e returns nothing
        call SetPlayerAbilityAvailable(p, 'Amov', e)
    endfunction
// =============================================================================\\
    globals
        real TTT = 15
        private integer array CreepType
        private integer array CreepNr
        private integer array UnitStatInt
        private integer array UnitStatAgi
        private integer NumberOfBattleAreas = 0
        private integer CHOOSETRIES = 0
        integer MaxCNr = 0
        private integer RoundCount = 0
        private integer AreaNr = 0
        integer MaxLvl = 0
        integer MinLvl=0
        integer MaxCreeps=0
        integer MaxUnits=0
        private integer CTries=0
        private integer PKKilled=0
        private integer NOU=0
        private integer NOC=0
        private location array OldLocations
        private unit array Creeps
        private unit array Units
        private unit array NextUnits
        private unit CamDum=null
        private unit EnemyTrainer=null
        private unit DiedUnit=null
        private trigger AttackSetT = CreateTrigger()
        private group UnitGroup = CreateGroup()
        private group CreepGroup = CreateGroup()
        private group TrainerGroup = CreateGroup()
        private group PokemonGroup = CreateGroup()
        private effect Arrow=null
        private timer AITimer = CreateTimer()
        private timer ChooseTim = CreateTimer()
        private player OwnPlayer=null
        private boolean Battle=false
        private rect array Areas
        private rect array CreepA
        private rect array UnitsA
        private rect array Creep1Position
        private rect array Creep2Position
        private rect array Creep3Position
        private rect array Creep4Position
        private rect array Creep5Position
        private rect array Creep6Position
        private rect array Unit1Position
        private rect array Unit2Position
        private rect array Unit3Position
        private rect array Unit4Position
        private rect array Unit5Position
        private rect array Unit6Position
        private rect BattleArea=null
        private camerasetup array BattleCam
        private boolean Cam=false
        private force BattleForce = CreateForce()
        private fogmodifier array Weather
    endglobals
// =============================================================================\\
    globals
    // Creep AI/Attack Globals
        private trigger array CreepAttack1
        private trigger array CreepAttack2
        private trigger array CreepAttack3
        private trigger array CreepAttack4
        private integer array MaxAttacks
        private integer CreepData
        private trigger array AITrigger
        private trigger array AttackTrigger
        private unit array AttackTarget
    endglobals
// =============================================================================\\
globals
    // Trainer Pokemon-Data globals
        private integer array TPokemon
        private integer array TLevel
        private boolean array TDead
        private integer array TrainerPokemon1
        private integer array TrainerLevel1
        private boolean array TrainerDead1
        private integer array TrainerPokemon2
        private integer array TrainerLevel2
        private boolean array TrainerDead2
        private integer array TrainerPokemon3
        private integer array TrainerLevel3
        private boolean array TrainerDead3
        private integer array TrainerPokemon4
        private integer array TrainerLevel4
        private boolean array TrainerDead4
        private integer array TrainerPokemon5
        private integer array TrainerLevel5
        private boolean array TrainerDead5
        private integer array TrainerPokemon6
        private integer array TrainerLevel6
        private boolean array TrainerDead6
        private integer TrainerPKAmount
    endglobals
// ==============================================================================\\
    private function AddCreep takes unit u returns integer
        local integer i = 1
        set CreepData = CreepData + 1
        set CreepAttack1[CreepData] = null
        set CreepAttack2[CreepData] = null
        set CreepAttack3[CreepData] = null
        set CreepAttack4[CreepData] = null
        loop
            exitwhen i > 30
            if GetUnitAbilityLevel(u,udg_ZZ_Abillity[GetUnitPointValue(u) * 30 + i]) > 0 then
                set MaxAttacks[CreepData] = MaxAttacks[CreepData] + 1
                if CreepAttack1[CreepData] == null then
                    set CreepAttack1[CreepData] = udg_ZZ_AttackTrigger[GetUnitPointValue(u) * 30 + i]
                elseif CreepAttack2[CreepData] == null then
                    set CreepAttack2[CreepData] = udg_ZZ_AttackTrigger[GetUnitPointValue(u) * 30 + i]
                elseif CreepAttack3[CreepData] == null then
                    set CreepAttack3[CreepData] = udg_ZZ_AttackTrigger[GetUnitPointValue(u) * 30 + i]
                elseif CreepAttack4[CreepData] == null then
                    set CreepAttack4[CreepData] = udg_ZZ_AttackTrigger[GetUnitPointValue(u) * 30 + i]
                endif
                
            endif
            set i = i + 1
        endloop
        return CreepData
    endfunction
// =============================================================================\\
    private function UnitReplacement takes nothing returns nothing
        local integer i = 1
        local real x
        local real y
        loop
            exitwhen i > 6
            if Units[i] != null then
                set x = GetRectCenterX(UnitsA[i+2])
                set y = GetRectCenterY(UnitsA[i+2])
                call SetUnitPosition(Units[i],x,y)
                call SetUnitFacing(Units[i], Atan2(GetRectCenterY(CreepA[i+2])-y,GetRectCenterX(CreepA[i+2])-x)*bj_RADTODEG)
                call SetUnitAnimation(Units[i],"stand")
            endif
            if Creeps[i] != null then
                set x = GetRectCenterX(CreepA[i+2])
                set y = GetRectCenterY(CreepA[i+2])
                call SetUnitPosition(Creeps[i],x,y)
                call SetUnitFacing(Creeps[i], Atan2(GetRectCenterY(UnitsA[i+2])-y,GetRectCenterX(UnitsA[i+2])-x)*bj_RADTODEG)
                call SetUnitAnimation(Creeps[i],"stand")
            endif
            set i = i + 1
        endloop
    endfunction
// =============================================================================\\
    private function UnitPlacement takes integer i returns integer
        local real x
        local real y
        local integer j = 1
        loop
            exitwhen j > 6
            if GetUnitState(Units[i + 1],UNIT_STATE_LIFE) > 0 then
                set i = i + 1
                set OldLocations[i] = GetUnitLoc(Units[i])
                set x = GetRectCenterX(UnitsA[i+2])
                set y = GetRectCenterY(UnitsA[i+2])
                call SetUnitPosition(Units[i],x,y)
                call SetUnitFacing(Units[i], Atan2(GetRectCenterY(CreepA[i])-y,GetRectCenterX(CreepA[i])-x))
                call GroupAddUnit(UnitGroup,Units[i])
                set UnitStatInt[i] = GetHeroInt(Units[i],true)
                set UnitStatAgi[i] = GetHeroAgi(Units[i],true)
                return i
            endif
            set j = j + 1
        endloop
        return i
    endfunction
// =============================================================================\\
    private function CreepCreate takes integer i returns integer
        local real x
        local real y
        local integer j = 1
        local integer lvl
        loop
            exitwhen j > 6
            if udg_RBB_TrainerFight then
                if TPokemon[i + 1] != 0 then
                    set i = i + 1
                    set x = GetRectCenterX(CreepA[i+2])
                    set y = GetRectCenterY(CreepA[i+2])
                    set Creeps[i] = CreateUnit(Player(11),TPokemon[i],x,y,Atan2(GetRectCenterY(UnitsA[i])-y,GetRectCenterX(UnitsA[i])-x) * bj_RADTODEG)
                    loop
                        exitwhen GetHeroLevel(Creeps[i]) == TLevel[i]
                        call SetHeroLevel(Creeps[i],GetHeroLevel(Creeps[i]) + 1,false)
                    endloop
                    call SetUnitUserData(Creeps[i],AddCreep(Creeps[i]))
                    call GroupAddUnit(CreepGroup,Creeps[i])
                    return i
                endif
            else
                set CreepNr[i+1] = GetRandomInt(1,MaxCNr)
                if udg_RBB_CreepTypeCreate[CreepNr[i+1]] != 0 then
                    set i = i + 1
                    set x = GetRectCenterX(CreepA[i+2])
                    set y = GetRectCenterY(CreepA[i+2])
                    set Creeps[i] = CreateUnit(Player(11),udg_RBB_CreepTypeCreate[CreepNr[i]],x,y,Atan2(GetRectCenterY(UnitsA[i])-y,GetRectCenterX(UnitsA[i])-x) * bj_RADTODEG)
                    set lvl = GetRandomInt(MinLvl,MaxLvl)
                    loop
                        exitwhen GetHeroLevel(Creeps[i]) == lvl
                        call SetHeroLevel(Creeps[i],GetHeroLevel(Creeps[i]) + 1,false)
                    endloop
                    call AddCreep(Creeps[i])
                    call SetUnitUserData(Creeps[i],CreepData)
                    call GroupAddUnit(CreepGroup,Creeps[i])
                    return i
                endif
            endif
        endloop
        call DisplayTimedTextToPlayer(Player(0),0,0,5,"No Battle")
        return i
    endfunction
// =============================================================================\\
// =============================================================================\\
    private function Remove takes nothing returns nothing
        call RemoveUnit(GetEnumUnit())
    endfunction
    private function ExpFilt takes nothing returns boolean
        return (GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(DiedUnit)) and IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)
    endfunction
    private function StopFight takes nothing returns nothing
        local integer i = 0
        local group g = CreateGroup()
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.25, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
        call TriggerSleepAction(0.3)
        call EnableUserControl(false)
        call ResetToGameCamera(0)
        call SetCameraTargetController(udg_TrainerUnit,0,0,false)
        call RemoveUnit(CamDum)
        loop
            exitwhen i > 12
            call DestroyFogModifier(Weather[i])
            call EnableMovement(Player(i),true)
            set i = i + 1
        endloop
        set i = 1
        loop
            exitwhen i > 6
            call SetUnitPositionLoc(Units[i],OldLocations[i])
            call SetUnitOwner(Units[i], Player(15), false)
            set i = i + 1
        endloop
        call SetUnitPositionLoc(udg_TrainerUnit,OldLocations[7])
        set RoundCount = 0
        set Battle = false
        set udg_TrainerReadyBattle = true
        call GroupEnumUnitsInRect(g,BattleArea,null)
        call ForGroup(g,function Remove)
        if Cam then
            call EnableRPGCam()
        endif
        loop
            exitwhen i > 6
            call SetHeroAgi(Units[i],UnitStatAgi[i],true)
            call SetHeroInt(Units[i],UnitStatInt[i],true)
            set i = i + 1
        endloop
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.25, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
        call TriggerSleepAction(0.3)
        call EnableUserControl(true)
        call DestroyEffect(Arrow)
    endfunction
// =============================================================================\\
    private function UnitDies takes nothing returns nothing
        local integer i
        local group g = CreateGroup()
        local unit u
        local integer Exp
        set DiedUnit = GetTriggerUnit()
        set Exp = ExpCALC(DiedUnit,udg_RBB_TrainerFight)
        call GroupEnumUnitsInRect(g,BattleArea,Filter(function ExpFilt))
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            call SetHeroXP(u,GetHeroXP(u) + Exp,false)
            call GroupRemoveUnit(g,u)
        endloop
        if IsUnitInGroup(GetTriggerUnit(),UnitGroup) then
            set NOU = NOU - 1
            call GroupRemoveUnit(UnitGroup, GetTriggerUnit())
            loop
                exitwhen i > 6
                if Units[i] == GetTriggerUnit() then
                    call GroupRemoveUnit(PokemonGroup,Units[i])
                    set Units[i] = null
                endif
            endloop
            set bj_wantDestroyGroup = true
            if CountUnitsInGroup(PokemonGroup) <= 0 then
                call StopFight()
            else
                set NOU = UnitPlacement(NOU)
            endif
        elseif IsUnitInGroup(GetTriggerUnit(),CreepGroup) then
            set NOC = NOC - 1
            call GroupRemoveUnit(CreepGroup,GetTriggerUnit())
            if udg_RBB_TrainerFight then
                set PKKilled = PKKilled + 1
                call GroupRemoveUnit(TrainerGroup,GetTriggerUnit())
                loop
                    exitwhen i > 6
                    if Creeps[i] == GetTriggerUnit() then
                        set TPokemon[i] = 0
                    endif
                endloop
                if PKKilled >= TrainerPKAmount then
                    call StopFight()
                else
                    set NOC = CreepCreate(NOC)
                endif
            else
                call StopFight()
            endif
        endif
    endfunction
//===========================================================================\\
    private function NextUnit takes nothing returns nothing
        local integer i = 1
        call BJDebugMsg("Attack")
        loop
            exitwhen i > 6
            if NextUnits[i] != null and AttackTrigger[i] != null then
                set udg_AT_Caster = NextUnits[i]
                set udg_AT_Target = AttackTarget[i]
                call TriggerExecute(AttackTrigger[i])
                call BJDebugMsg(GetHeroProperName(NextUnits[i]))
            endif
            set i = i + 1
        endloop
    endfunction
    private function CreepAI takes nothing returns nothing
        local integer i
        set udg_AT_Caster = Creeps[RoundCount - 6]
        set bj_wantDestroyGroup = true
        set AttackTarget[RoundCount] = GroupPickRandomUnit(UnitGroup)
        set AITrigger[1] = CreepAttack1[GetUnitUserData(udg_AT_Caster)]
        set AITrigger[2] = CreepAttack2[GetUnitUserData(udg_AT_Caster)]
        set AITrigger[3] = CreepAttack3[GetUnitUserData(udg_AT_Caster)]
        set AITrigger[4] = CreepAttack4[GetUnitUserData(udg_AT_Caster)]
        set i = GetRandomInt(1, MaxAttacks[GetUnitUserData(udg_AT_Caster)])
        set AttackTrigger[RoundCount] = AITrigger[i]
        call BJDebugMsg("CreepAI")
        call TriggerExecute(AttackSetT)
    endfunction
    private function Chosen takes nothing returns nothing
        if AttackTrigger[RoundCount] == null then
            set CHOOSETRIES = CHOOSETRIES + 1
            call BJDebugMsg("no attack chosen yet. Seconds to go: " + I2S(10-CHOOSETRIES))
            
            if CHOOSETRIES > 10 then
                call PauseTimer(ChooseTim)
                call TriggerExecute(AttackSetT)
            endif
        endif
    endfunction
    private function AttackSet takes nothing returns nothing
        local integer i = 1
        local integer tries = 0
        set RoundCount = RoundCount + 1
        loop
            exitwhen i >= 2
            exitwhen tries >= 13
            set tries = tries + 1
            if Units[RoundCount] != null then
                call BJDebugMsg("Unit Attack")
                set OwnPlayer = GetOwningPlayer(Units[RoundCount])
                if GetLocalPlayer() == OwnPlayer then
                    call EnableUserControl(true)
                endif
                set CHOOSETRIES = 0
                call TimerStart(ChooseTim,1,true,function Chosen)
                return
            endif
            if Creeps[RoundCount-6] != null then
                call BJDebugMsg("Creep Attack")
                call CreepAI()
                return
            endif
        endloop
        call BJDebugMsg("EndFunction")
        if RoundCount >= 13 then
            set i = 1
            call BJDebugMsg("Order")
            loop
                exitwhen i > 6
                set NextUnits[i] = Units[i]
                set NextUnits[i+6] = Creeps[i]
                set i = i + 1
            endloop
            call NextUnit()
            return
        endif
        call AttackSet()
    endfunction
// =============================================================================\\
    private function NewAreaAdd takes nothing returns nothing
        set UnitsA[1] = gg_rct_BattlePokemon1
        set UnitsA[2] = gg_rct_BattlePokemon2
        set UnitsA[3] = gg_rct_BattlePokemon3
        set UnitsA[4] = gg_rct_BattlePokemon4
        set UnitsA[5] = gg_rct_BattlePokemon5
        set UnitsA[6] = gg_rct_BattlePokemon6
        set UnitsA[7] = gg_rct_TrainerSpot
        set CreepA[1] = gg_rct_BattleCreep1
        set CreepA[2] = gg_rct_BattleCreep2
        set CreepA[3] = gg_rct_BattleCreep3
        set CreepA[4] = gg_rct_BattleCreep4
        set CreepA[5] = gg_rct_BattleCreep5
        set CreepA[6] = gg_rct_BattleCreep6
        set CreepA[7] = gg_rct_TrainerSpot2    
        loop
            exitwhen NumberOfBattleAreas > 6
            set Areas[NumberOfBattleAreas] = udg_RBB_Area[NumberOfBattleAreas]
            set BattleCam[NumberOfBattleAreas] = udg_RBB_Cam[NumberOfBattleAreas]
            set NumberOfBattleAreas = NumberOfBattleAreas + 1
        endloop
    endfunction
// =============================================================================\\
    private function RegionSet takes rect r returns nothing
        local integer i = 1
        local location array l
        set l[8] = Location(GetRectCenterX(r),GetRectCenterY(r))
        set l[3] = Location(GetLocationX(l[8]) + 400 * Cos(315* bj_DEGTORAD),GetLocationY(l[8]) + 400 * Sin(315* bj_DEGTORAD))
        set l[7] = Location(GetLocationX(l[3]) + 100 * Cos(315* bj_DEGTORAD),GetLocationY(l[8]) + 100 * Sin(315* bj_DEGTORAD))
        set l[1] = Location(GetLocationX(l[3]) + 300 * Cos(225* bj_DEGTORAD),GetLocationY(l[8]) + 300 * Sin(225* bj_DEGTORAD))
        set l[2] = Location(GetLocationX(l[3]) + 150 * Cos(225* bj_DEGTORAD),GetLocationY(l[8]) + 150 * Sin(225* bj_DEGTORAD))
        set l[4] = Location(GetLocationX(l[3]) + 150 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 150 * Sin(45* bj_DEGTORAD))
        set l[5] = Location(GetLocationX(l[3]) + 300 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 300 * Sin(45* bj_DEGTORAD))
        set l[6] = Location(GetLocationX(l[3]) + 450 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 450 * Sin(45* bj_DEGTORAD))
        loop
            exitwhen i > 7
            call MoveRectToLoc( UnitsA[i], l[i] )
            call RemoveLocation(l[i])
            set i = i + 1
        endloop
        set l[3] = Location(GetLocationX(l[8]) + 400 * Cos(135* bj_DEGTORAD),GetLocationY(l[8]) + 400 * Sin(135* bj_DEGTORAD))
        set l[7] = Location(GetLocationX(l[3]) + 100 * Cos(135* bj_DEGTORAD),GetLocationY(l[8]) + 100 * Sin(135* bj_DEGTORAD))
        set l[1] = Location(GetLocationX(l[3]) + 300 * Cos(225* bj_DEGTORAD),GetLocationY(l[8]) + 300 * Sin(225* bj_DEGTORAD))
        set l[2] = Location(GetLocationX(l[3]) + 150 * Cos(225* bj_DEGTORAD),GetLocationY(l[8]) + 150 * Sin(225* bj_DEGTORAD))
        set l[4] = Location(GetLocationX(l[3]) + 150 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 150 * Sin(45* bj_DEGTORAD))
        set l[5] = Location(GetLocationX(l[3]) + 300 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 300 * Sin(45* bj_DEGTORAD))
        set l[6] = Location(GetLocationX(l[3]) + 450 * Cos(45* bj_DEGTORAD),GetLocationY(l[8]) + 450 * Sin(45* bj_DEGTORAD))
        call RemoveLocation(l[8])
        set i = 1
        loop
            exitwhen i > 7
            call MoveRectToLoc( CreepA[i], l[i] )
            call RemoveLocation(l[i])
            set l[i] = null
            set i = i + 1
        endloop
        set l[8] = null
    endfunction
// =============================================================================\\
    function StartBattle takes nothing returns nothing
        local integer i = 1
        local integer j = 0
        set NOU = 0
        set NOC = 0
        call EnableUserControl(false)
        set OldLocations[7] = GetUnitLoc(udg_TrainerUnit)
        call SetUnitPosition(udg_TrainerUnit,GetUnitX(udg_TrainerUnit),GetUnitY(udg_TrainerUnit))
        set Cam = udg_Cam_On
        if Cam then
            call EnableRPGCam()
        endif
        set Battle = true
        loop
            exitwhen i > 6
            set MaxAttacks[i] = 0
            set Units[i] = udg_TrainerCarriedPokemon[i]
            call SetUnitOwner(Units[i],Player(0),false)
            set OldLocations[i] = GetUnitLoc(Units[i])
            call GroupAddUnit(PokemonGroup,Units[i])
            set i = i + 1
        endloop
        if udg_TrainerBattleDirt then
            set AreaNr = 1
        elseif udg_TrainerBattleGrass then
            set AreaNr = 2
        elseif udg_TrainerBattleFall then
            set AreaNr = 3
        elseif udg_TrainerBattleWinter then
            set AreaNr = 4
        elseif udg_TrainerBattleDungeon then
            set AreaNr = 5
        elseif udg_TrainerBattleCity then
            set AreaNr = 6
        else
            set AreaNr = 2
        endif
        call NewAreaAdd()
        set BattleArea = Areas[AreaNr]
        call RegionSet(BattleArea)
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.25, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
        call TriggerSleepAction(0.30)
        set CreepData = 0
        set RoundCount = 0
        set i = 1
        if udg_RBB_TrainerFight then
            set j = GetUnitUserData(EnemyTrainer)
            if TrainerPokemon1[j] != null then
                set TPokemon[1] = TrainerPokemon1[j]
                set TLevel[1] = TrainerLevel1[j]
                set TDead[1] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
            if TrainerPokemon2[j] != null then
                set TPokemon[2] = TrainerPokemon2[j]
                set TLevel[2] = TrainerLevel2[j]
                set TDead[2] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
            if TrainerPokemon3[j] != null then
                set TPokemon[3] = TrainerPokemon3[j]
                set TLevel[3] = TrainerLevel3[j]
                set TDead[3] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
            if TrainerPokemon4[j] != null then
                set TPokemon[4] = TrainerPokemon4[j]
                set TLevel[4] = TrainerLevel4[j]
                set TDead[4] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
            if TrainerPokemon5[j] != null then
                set TPokemon[5] = TrainerPokemon5[j]
                set TLevel[5] = TrainerLevel5[j]
                set TDead[5] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
            if TrainerPokemon6[j] != null then
                set TPokemon[6] = TrainerPokemon6[j]
                set TLevel[6] = TrainerLevel6[j]
                set TDead[6] = false
                set TrainerPKAmount = TrainerPKAmount + 1
            endif
        endif
        set NOC = CreepCreate(NOC)
        if NOC <= 0 then
            call DisplayTimedTextToPlayer(Player(1),0,0,TTT,"No Battle")
            return
        endif
        call SetUnitPosition(udg_TrainerUnit,GetRectCenterX(UnitsA[7]),GetRectCenterY(UnitsA[7]))
        call SetUnitFacing(udg_TrainerUnit, 45)
        set NOU = UnitPlacement(NOU)
        if NOU <= 0 then
            call DisplayTimedTextToPlayer(Player(1),0,0,TTT,"No Battle")
            return
        endif
        set CamDum = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE) ,'h04H', GetRectCenterX(BattleArea),GetRectCenterY(BattleArea),bj_UNIT_FACING )
        set i = 0
        call CameraSetupApplyForceDuration(BattleCam[AreaNr],true,0)
        call SetCameraTargetController(CamDum, 0, 0, false )
        call SetPlayerAbilityAvailable(Player(11), 'Amov', false)
        call SetUnitAbilityLevel(udg_TrainerUnit,'A006',2)
        loop
            exitwhen i >= 6
            if GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING and GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_LEFT and GetPlayerSlotState(Player(i)) != PLAYER_SLOT_STATE_EMPTY then
                call ForceAddPlayer(BattleForce,Player(i))
                call DisplayTimedTextToPlayer(Player(i),0,0,TTT,"Battle Begins")
                set Weather[i] = CreateFogModifierRect(Player(i),FOG_OF_WAR_VISIBLE,BattleArea,true,false)
                call FogModifierStart(Weather[i])
                call SetPlayerAbilityAvailable(Player(i), 'Amov', false)
            endif
            set i = i + 1
        endloop
        call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 0.25, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
        call TriggerSleepAction(0.3)
        call EnableUserControl(true)
        call AttackSet()
    endfunction
// =============================================================================\\
    private function TrainerAbils takes nothing returns nothing
        local integer i = 1
        local integer j = 1
        if GetTriggerUnit() == udg_TrainerUnit then
            if GetSpellAbilityId() == 'A00L' then
                loop
                    exitwhen i > 6
                    if Units[i] != null then
                        call ClearSelection()
                        call SelectUnit(Units[i],true)
                    endif
                    set i = i + 1
                endloop
            endif
            if GetSpellAbilityId() == 'A001' then
                set i = GetRandomInt(1, 5)
                if i < 4 then
                    call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,TTT, "You managed to flee" )
                    call StopFight()
                else
                    call SetUnitAbilityLevel(GetTriggerUnit(), 'A006', 1 )
                    call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,TTT, "You didn't manage to flee" )
                endif
            endif
            if GetSpellAbilityId() == 'A002' then
                call DisplayTimedTextToPlayer(GetOwningPlayer(GetTriggerUnit()),0,0,TTT, "Can't use that yet" )
            endif
        endif
    endfunction
    function PokemonAbils takes nothing returns nothing
        local integer i = 1
        local boolean isBattle = false
        call BJDebugMsg("Ability")
        loop
            exitwhen i > 6
            if GetTriggerUnit() == Units[i] then
                call BJDebugMsg("Caster= Units[" + I2S(i) + "]")
                set isBattle = true
            endif
            set i = i + 1
        endloop
        if not isBattle then
            call AttackSet()
            return
        endif
                    call PauseTimer(ChooseTim)
                    set udg_AT_Caster = GetTriggerUnit()
                    set AttackTarget[RoundCount] = GetSpellTargetUnit()
                    if GetSpellAbilityId() == 'A00M' then
                        set AttackTrigger[RoundCount] = ( gg_trg_Tackle )
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00O' then
                        set AttackTrigger[RoundCount] = (gg_trg_Absorb)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00R' then
                        set AttackTrigger[RoundCount] = (gg_trg_Bubble)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00T' then
                        set AttackTrigger[RoundCount] = (gg_trg_Confusion)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00Q' then
                        set AttackTrigger[RoundCount] = (gg_trg_Ember)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00W' then
                        set AttackTrigger[RoundCount] = (gg_trg_Fury_Attack)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00X' then
                        set AttackTrigger[RoundCount] = (gg_trg_Gust)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A010' then
                        set AttackTrigger[RoundCount] = (gg_trg_Horn_Attack)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00Z' then
                        set AttackTrigger[RoundCount] = (gg_trg_Hyper_Fang)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A011' then
                        set AttackTrigger[RoundCount] = (gg_trg_Leech_Seed)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A012' then
                        set AttackTrigger[RoundCount] = (gg_trg_Poison_Powder)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00V' then
                        set AttackTrigger[RoundCount] = (gg_trg_Poison_Sting)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00Y' then
                        set AttackTrigger[RoundCount] = (gg_trg_Quick_Attack)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00P' then
                        set AttackTrigger[RoundCount] = (gg_trg_Scratch)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00U' then
                        set AttackTrigger[RoundCount] = (gg_trg_Vine_Whip)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00S' then
                        set AttackTrigger[RoundCount] = (gg_trg_Water_Gun)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A015' then
                        set AttackTrigger[RoundCount] = (gg_trg_Defense_Curl)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A013' then
                        set AttackTrigger[RoundCount] = (gg_trg_Growl)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A014' then
                        set AttackTrigger[RoundCount] = (gg_trg_Harden)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A019' then
                        set AttackTrigger[RoundCount] = (gg_trg_Leer)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A016' then
                        set AttackTrigger[RoundCount] = (gg_trg_Sand_Attack)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A017' then
                        set AttackTrigger[RoundCount] = (gg_trg_String_Shot)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A018' then
                        set AttackTrigger[RoundCount] = (gg_trg_Tail_Whip)
                        call AttackSet()
                    elseif GetSpellAbilityId() == 'A00N' then
                        set AttackTrigger[RoundCount] = (gg_trg_Withdraw)
                        call AttackSet()
                    endif
    endfunction
    function PokeAbilsCon takes nothing returns boolean
        return GetTriggerUnit() == Units[1] or GetTriggerUnit() == Units[2] or GetTriggerUnit() == Units[3] or GetTriggerUnit() == Units[4] or GetTriggerUnit() == Units[5] or GetTriggerUnit() == Units[6]
    endfunction 
// ==============================================================================\\
    private function RunBattleCon takes nothing returns boolean
        return udg_TrainerReadyBattle and (udg_TrainerBattleCity or udg_TrainerBattleFall or udg_TrainerBattleDungeon or udg_TrainerBattleDirt or udg_TrainerBattleGrass or udg_TrainerBattleWinter) and (GetUnitCurrentOrder(udg_TrainerUnit) == OrderId("move") or GetUnitCurrentOrder(udg_TrainerUnit) == OrderId("smart"))
    endfunction
// ==============================================================================\\
    private function RunBattle takes nothing returns nothing
        local integer i = GetRandomInt(1, 10)
        if i <= 1 then
            set udg_TrainerReadyBattle = false
            set udg_RBB_TrainerFight = false
            call StartBattle()
        endif
    endfunction
    private function END takes nothing returns nothing
        call StopFight()
        call DisableTrigger(GetTriggeringTrigger())
    endfunction
// ==============================================================================\\
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local trigger u = CreateTrigger()
        local trigger v = CreateTrigger()
        local trigger w = CreateTrigger()
        local trigger y = CreateTrigger()
        local trigger z = CreateTrigger()
        local integer i = 1
        loop
            exitwhen i >= bj_MAX_PLAYER_SLOTS
            call TriggerRegisterPlayerUnitEvent(u,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
            call TriggerRegisterPlayerUnitEvent(v,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
            call TriggerRegisterPlayerUnitEvent(w,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
            set i = i + 1
        endloop
        call TriggerRegisterPlayerEvent(y,Player(0),EVENT_PLAYER_END_CINEMATIC)
        call TriggerRegisterTimerExpireEvent(t,udg_RBB_timer)
        call TriggerRegisterTimerEvent(z, 0.7, true)
        call TriggerAddAction(u, function UnitDies)
        call TriggerAddAction(v, function TrainerAbils)
        call TriggerAddAction(w, function PokemonAbils)
        call TriggerAddAction(y,function END)
        call TriggerAddAction(z, function RunBattle)
        call TriggerAddAction(AttackSetT, function AttackSet)
        call TriggerAddCondition(z,Condition(function RunBattleCon))
        call TriggerAddCondition(w, Condition(function PokeAbilsCon))
    endfunction
endscope
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
It is kinda smooth, only i just cant figure out why it does not work! ><

Oh, and this allows units to be ordered in a certain order, according to speed, or attack (just need a big function then ><)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
AAAH! DONT TELL-,, uuh, TYPE ME GUI IS FOR THE WIN! MY EAR-,, uh,, MY EYES!!! AAAAH I AM DYING!!!

No but this Jass already does its job wel since it would sometimes lagg with the GUI script (we had a GUI before),, and now not (yeah my computr but that is really slow ><)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
That code is the new battle system, it still does not work,, but i am working on it
(Earlier was in GUI)

But why no UTM? It owns and saves alot of time! Also we can always remove all those imported files on MP map, since we only need a SMAAAALL map (small in in-game size) there,, only thing that has to be really nice terrained is battle areas,, and there is a pokemon center or so,, at least a central area,,
And maybe minigames but i have to consider that first ;)

So: Is it already too late to use UTM? Or is it still possible? (Only if you guys agree, but it seems easier to me)
 
Level 38
Joined
Jan 10, 2009
Messages
854
Bahh, its illegal if you dont own a real copy of the game. And its illegal to share copys of game to start with.

And i dont understand what your trying to say? What does emulators have to do with this map? :S

If you don't own a copy of the game? Who does that apply to, honestly XD.

Yeah it's illegal, but it's not like they have any form of tracking you...and even if you do get 'caught' and the popos come to your house it's not exactly difficult to get rid of the files.

I think he's saying there's no point in playing this map if you can just play the actual games..

Something like that. At least multiplayer would be a lot funner, and considering that is the main appeal of blizzard games, at least the ones that made them famous, I'd definatly shoot for making the map multiplayer. Most of the stratagy involved in Pokemon is most exciting and interesting in multiplayer anyways. The NPC opponenets in the series are designed to fallow the "anyone can win!" policy. You can essentially beat the game with using nothing but your starter and potions in single player. Against other players, especially those who know what theyr doing, you need all six of your pokemon to be win. And wiping the smirk off of your freinds faces is worth much more than defeating some computer opponenet.

its UMSWE, aka Newjen package 1.5

there is a setting in there that lets you expand the map to 480 x 480, and use unlimited doodad, and more tilesets.

Unlimited doodads would be pretty sweet :)

What about making tall grass rectangles for pokemon appearance?
I know it isn't very appealing, but it is very pokemon-ish.

Well, if your going for square grass patches check this out. Pkmn map I did, based on Red/Blue/Yellow screenshots. Pathing is done, though only a few of the ledge-triggers are implemented. Has everything from Red/Blue/Yellow except half of Silph. Co. - ran out of doodad space thier. Showed this to HFR and Yixx already, figured everyone else working on this moght want to take a look to :D
You can use anything in this map you want, as long as you give credit to me for it.

Also found out that you can make charged items permanent by taking away their "perishable" stat. Made items for each attack and set thier charges to whatever their PP attribute was. Might be useful for giving the pokemon moves, probably wouldn't be to hard to reset the charges at a pokemon center either. As an item you can use the same spell for every one and still have them work to, rather than havin to use a different spell for every move in the game. Items would make TMs and HMs a little easier for moves to, I think. Set them to "can drop" equal to false as well, so triggers will be needed to add/remove them from the pokemon's inventory. Just an idea that might be worth looking into.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
The item idea might be THE solution! It does not interupt with other Ability Casts (events) and finaly has PP =D,, That way i might get the Battle to work with your pokemon attacks finally =D,, though LoS's level system would have to be remade for items, instead of abilty's,,
 
Level 2
Joined
May 21, 2009
Messages
12
Hello.

I wonder how you'll do with the stats. Since in the game boy games EV points are a big part of the training =P

You don't have to answer if this is classified information just want to be sure you're aware of it.

Good luck once again! =D
I'm looking forward for this map but my patience will probably break before then =P But this map got an offical tab on my web browser.
 
Level 38
Joined
Jan 10, 2009
Messages
854
If the charges run to zero the item's won't cast abilities any more, which is pretty cool. Not sure if it works with passive abilities, I'm gonna test that out to see if I could implement a sort of durability system for armor and weapons in my map - doesn't matter for Pokemon though. Also shows you how many charges you have left - which is really handy. You'll probably need to make (3?) of each ability if your gonna have PP up in your map, though that shouldn't cause to much problems.
 
Status
Not open for further replies.
Top