SamuraiOkame Posted November 19, 2012 Share Posted November 19, 2012 Can someone tell me how to remove the quest requirement from this script so that the arena stone works all of the time Scriptname aoah_ArenaStone extends ObjectReference {Summons enemies in the Areane of Ancient Heros. } Spell Property summonEffect AutoFormList Property enemyFormList AutoLeveledItem Property enemyPotion AutoObjectReference[] Property listOfSpawnPoints Autoint Property spawnAtPlayerRatio = 10 Autoint Property maxActiveEnemiesAtStart = 1 Autoint Property maxActiveEnemiesTotal = 8 Autoint Property enemiesPerArenaLevel = 8 Autobool Property levelNotificationOn = false AutoQuest Property aoah_ArenaQuest Autobool Property activeForArenaQuest = false Autoint Property arenaQuestCompleteLevel = 5 Auto int enemiesCreatedTotal = 0Actor[] listOfActiveEnemiesint lastWriteIndex = -1bool arenaIsActive = false ; InitializationsEvent onInit() if( maxActiveEnemiesTotal > 20 ) maxActiveEnemiesTotal = 20 endIf if( maxActiveEnemiesAtStart > maxActiveEnemiesTotal ) maxActiveEnemiesAtStart = maxActiveEnemiesTotal endIf listOfActiveEnemies = new Actor[ 20 ] EndEvent ; Aborts the arena fight.Function AbortArena() killEnemies() Utility.Wait(1) deleteEnemies() Utility.Wait(2) arenaIsActive = false EndFunction EVENT OnActivate( ObjectReference akActionRef ) ;if (( akActionRef == Game.GetPlayer() )||( !activeForArenaQuest )) if( !arenaIsActive ) arenaIsActive = true ProcessArenaActions() arenaIsActive = false endIf ;endIf EndEVENT ; Function that processes the arena actions, like spawning and manage enemies.Function ProcessArenaActions() enemiesCreatedTotal = 0 int maxActiveEnemies = maxActiveEnemiesAtStart int enemiesToCreateInThisLevel = enemiesPerArenaLevel int arenaLevel = 1 PrintArenaLevel( arenaLevel ) while( arenaIsActive ) int activeEnemies = GetNumberOfActiveEnemies() if( activeEnemies < maxActiveEnemies ) if( SpawnArenaEnemy( GetNextSpawnPoint(), GetActorBaseToSpawn(), GetEnemyLevelToSpawn( arenaLevel ))) enemiesToCreateInThisLevel -= 1 activeEnemies += 1 if( enemiesToCreateInThisLevel <= 0 ) enemiesToCreateInThisLevel = enemiesPerArenaLevel + ( arenaLevel * 2 ) arenaLevel += 1 PrintArenaLevel( arenaLevel ) if( maxActiveEnemies < maxActiveEnemiesTotal ) maxActiveEnemies += 1 endIf if( activeForArenaQuest ) if( arenaLevel >= arenaQuestCompleteLevel ) if( aoah_ArenaQuest.getStage() < 1100 ) aoah_ArenaQuest.SetObjectiveCompleted(1000) aoah_ArenaQuest.SetObjectiveDisplayed(1100) aoah_ArenaQuest.setStage(1100) endif endif endif endIf Utility.Wait( 0.75 * activeEnemies ) endIf endIf Utility.Wait( 0.25 ) endWhile deleteEnemies() EndFunction ; Random ActorBase from the list of possible enemies.ActorBase Function GetActorBaseToSpawn() return enemyFormList.getat( Utility.RandomInt( 0, enemyFormList.getSize() - 1 )) as ActorBaseEndFunction ; Spawns a new enemy.bool Function SpawnArenaEnemy( ObjectReference spawnPoint, ActorBase enemyBase, int enemyLevel ) int index = GetNextFreeEnemyIndex() if(( index >= 0 )&&( index < listOfActiveEnemies.length )) Actor newEnemy = spawnPoint.PlaceActorAtMe( enemyBase, enemyLevel ) listOfActiveEnemies[ index ] = newEnemy enemiesCreatedTotal += 1 summonEffect.Cast( newEnemy, newEnemy ) newEnemy.addItem( enemyPotion, 1, true ) Utility.Wait( 0.5 ) newEnemy.StartCombat( Game.GetPlayer() ) return true endIf return false EndFunction ; Random ObjectRefernece where the next enemy spawns.ObjectReference Function GetNextSpawnPoint() if( Utility.RandomInt( 1, spawnAtPlayerRatio ) == 1 ) return Game.GetPlayer() endIf return listOfSpawnPoints[ Utility.RandomInt( 0, listOfSpawnPoints.length ) ] EndFunction ; Counts the active actors in the array of enemies.int Function GetNumberOfActiveEnemies() int index = 0 int enemyAlive = 0 while( index < listOfActiveEnemies.length ) Actor enemy = listOfActiveEnemies[ index ] index += 1 if( enemy.isEnabled() ) enemyAlive += 1 endIf endWhile ;Debug.Notification( "Enemies: alive=" + enemyAlive ) return enemyAlive EndFunction ; Gets the next free index in the array of enemies.int Function GetNextFreeEnemyIndex() int count = 0 while( count < listOfActiveEnemies.length ) count +=1 lastWriteIndex += 1 if( lastWriteIndex >= listOfActiveEnemies.length ) lastWriteIndex = 0 endIf if( !listOfActiveEnemies[ lastWriteIndex ].isEnabled() ) return lastWriteIndex endIf endWhile return -1 EndFunction ; Creates a random level for the enemy to be created.; 2% boss, 10% hard, 43% medium, 45% easy.; Limited by arena level, to prevent too hard enemies at the beginning.int Function GetEnemyLevelToSpawn( int arenaLevel ) int bossLevel = 3 int hardLevel = 2 int mediumLevel = 1 int easyLevel = 0 int randomNumber = Utility.RandomInt( 0, 99 ) int spawnLevel = easyLevel if( randomNumber < 2 ) spawnLevel = bossLevel elseif ( randomNumber < 12 ) spawnLevel = hardLevel elseif ( randomNumber < 55 ) spawnLevel = mediumLevel else spawnLevel = easyLevel endIf if( spawnLevel >= arenaLevel ) spawnLevel = arenaLevel - 1 endIf if( spawnLevel < 0 ) spawnLevel = 0 endIf return spawnLevel EndFunction ; Deletes the arena enemies.Function DeleteEnemies() int index = 0 while( index < listOfActiveEnemies.length ) listOfActiveEnemies[ index ].Delete() index += 1 endWhile enemiesCreatedTotal = 0 EndFunction ; Kills the arena enemies.Function KillEnemies() int index = 0 while( index < listOfActiveEnemies.length ) listOfActiveEnemies[ index ].Kill() index += 1 endWhile EndFunction ; Notification of the current arena level.Function PrintArenaLevel( int level ) if( levelNotificationOn ) if( level <= 1 ) Debug.Notification( "Arena level " + level + ": Novice" ) elseIf( level == 2 ) Debug.Notification( "Arena level " + level + ": Apprentice" ) elseIf( level == 3 ) Debug.Notification( "Arena level " + level + ": Adept" ) elseIf( level == 4 ) Debug.Notification( "Arena level " + level + ": Expert" ) elseIf( level == 5 ) Debug.Notification( "Arena level " + level + ": Master" ) elseIf( level == 6 ) Debug.Notification( "Arena level " + level + ": Angle of Death" ) else Debug.Notification( "Arena level " + level + ": God of War" ) endIf endIf EndFunction Link to comment Share on other sites More sharing options...
BigKevSexyMan Posted November 19, 2012 Share Posted November 19, 2012 Looks like changing this line on the top: bool Property activeForArenaQuest = false Auto to this: bool Property activeForArenaQuest = true Auto will work. Link to comment Share on other sites More sharing options...
SamuraiOkame Posted November 19, 2012 Author Share Posted November 19, 2012 i was thinking thatbut it didnt work but ill try again Link to comment Share on other sites More sharing options...
SamuraiOkame Posted November 19, 2012 Author Share Posted November 19, 2012 it worked thanks a billion :D Link to comment Share on other sites More sharing options...
Recommended Posts