Fandom

BattleForge Wiki

Map Tutorial 07 - Create a PvE Map

1,156pages on
this wiki
Add New Page
Talk0 Share

BattleForge Tutorial (2)Edit

T07 27
“Hmmm, the curse didn´t disappear! So I have to train you a little bit more. Today our goal is to build a little single player versus environment (PvE) map, therefore you will create your first script commands. So listen carefully!”








1. Start the community BattleForge editor
2. Open the “File” drop down menu to create a new PvE map.
3. At the moment we have to create a 1vs1 PvP map and after that we have to delete all the things we do not need for a one player PvE map. But for the future we will get a new PvE selection for the random generator, so that we can create directly a one player PvE map. You should use the same parameters to create this 1vs1 PvP map than I use.

T07 26















4. After that click at the “Calculate Preview” button to take a look at your map.
If you like it click at the “Generate and Load” button, otherwise try out some other parameters (change the seed value first).


5. Save the map as “MyFirstPvEMap.map” into the Documents\BattleForge\Map directory you used the last time in Tutorial (1). If you have no “Map” folder create a new one first.

T07 25








6. And in this “Map” folder we need a new one with the name “script1”. Than your directory should look like this:

T07 24






7. Now we have created a 1vs1 PvP map. To change our map to a 1vs1 PvE we have to delete the second player. Click at the “Map Settings” drop down menu and choose “Team Setup & Player Kits”. Press the “PVE 1P” button and you will see that the team “tm_Team2” will change into “tm_Enemy1”. After that press the “save” button.

T07 23




T07 22



















8. Now you have two starting possibilities, one in the south-west and one in the north-east It depends which map you have created, if you use the same parameters than I or not). In our game it is useful to play from the south to the north, so I decide to activate my starting place in the south-west. Zoom to the place where the starting point, the power generators and the monument are.

T07 21










9. Select the “Windows” drop down menu and click at the “Entity Properties” or press Shift+P.

T07 20










10. After that select the “Starting Point”.

11. Now change the “Player Kit” parameter from “none” to “pk_kit1”, that is the kit for your player. Repeat this procedure for the orb (Token) and for the three power generators (Power Slots). Now all of them should have the player kit “pk_kit1”. That means when you start the game you will located at the starting point and you will have one orb and three power generators. That is a standard for nearly all of the BattleForge maps.

T07 19











12. Now we have to create a camp for our enemies. But use breaks to save your map as a precaution.

13. Look for a nice place to locate your first enemy camp. It should be not to close to your starting point, else they will overrun you in some seconds after you start the game.

T07 18










14. If you find a nice place, select the “Window” drop down menu and click at “Entity Placement” or press Shift+E.
15. First we have to think about our opponents. Which race should they have. I will choose the “Twilight” fraction, because we have a much stuff (buildings and units) of them. After I know which race the computer enemy will have I search for a nice spawn building.
16. Look at the “Entity Placement” tool select “Buildings” click and at the “Twilight” fraction. At the right window you will see all of the different twilight buildings with their description. I choose the “Twilight humanoid Spawn” building because it’s a “T1” building (one token building, you need only one token to build it). You have to know that the computer player don’t need any token or power, but it is good to know for the balancing of the map how much the enemy buildings or units will cost for you. But before you place your building, by left clicking at a place on the map, look at the window below. Here you will see the “Entity Properties” information. Give your building first the right “Team” and the right “Player Kit”. Choose for the Team “tm_Enemy1” and for the Player Kit “pk_enemy1”.

T07 17










If you click at the building it appears at your mouse pointer, now move your mouse to an adequate place (Warning be sure the place is not blocked) and click at the left mouse button to place the building. With the mouse wheel you can rotate the building before or after you placed it.

T07 16
If you want to know if it is enough free space to spawn the enemy units select first the “Window” drop down menu and click at the “Blocking Visualization Settings”. Click at the check boxes for s = small m=medium, l=large and xl=extra large squads/units, like this:


After that select the “View” drop down menu and click at “Blocking”.)


T07 15












Now you will see a lot of red and yellow blocking bits. The red ones are hardly positioned the yellow ones are dynamic block bits. That means your spawn building is blocked and no unit can walk through it, but when you destroy them units can walk through the former building place of the spawn building. Now it is important that your building is not standing in any red blocking bits.

T07 14










17. Ok let’s place some nice enemy creatures. Select “Squads” from the “Entity Placement” tool than the fraction “Twilight Generic” and at least the “Thugs” squad. The “Thugs” are a squad group of six orcish creatures. They are T0 that is the lowest difficulty we have. You will see at the window below that your last input will be saved, so the “Thugs” will have the same Team and Player Kit like your building and that is correct. If you have the “Thugs” at your mouse pointer click it close to the spawn building. Be sure they are not blocked by the red blocking bits.
(If you won’t see any unit or building after selection, maybe you have filter them out
with your “Render Filter”. Select “Render Filter” at the drop down menu and check if any button was clicked?)

T07 13

Right

T07 12

Wrong









T07 11











To switch in the selection mode press Q or click at the selection mode at the top bar.
T07 10




18. Save your map. When you play the map now, your troops will fight against the enemy Thugs and their spawn building. But at the moment there is no respawn by the thugs although the enemy spawn building is a live or not. For this we need a script command. But before we can control a squad or a building by our script we have to give them names (“Tags”).

T07 09










19. Open the “Entity Properties” tool (Shift+P) and select the Thugs. Now give them an useful “Tag” (name) like “EnemySquad01Camp01”.
20. Repeat that process with the building too. I named it “EnemyBuilding01Camp01”.
21. Before we save the map and start with the scripting you can create a minimap, see tutorial 1 (“Camera” drop down menu/”Create Minimap”).
22. Now we will create our first “Lua” script file.
23. Open an editor which can create “Lua” files I prefer “Ultra Edit”. You can download a free testversion from the internet.
24. Create a new “Lua” file and named it like your spawn building “EnemyBuilding01Camp01.Lua”.

T07 08









25. Each “Lua” file need a state and in the state an event. States and events includes blocks. The blocks will started with an opening “{“ and ended with a closing “},”.
Comments will be write with -- .

26. I use the “Respawn Event”. Copy this and paste it into your “script1” folder:

State --Start of the State "Init"
{
StateName = "INIT", --Statename
   OnRespawnEvent --Start of the Respawn Event
   {
      StartDespawned = true,
      --The squad is alive when you start the map
      TargetTag = "EnemyBuilding01Camp01",
      --The place where the squad will respawn
      RespawnDelayMinutes = 0,
      --how many minutes you have to wait before the squad will respawn
      RespawnDelaySeconds = 15,
      --how many seconds you have to wait before the squad will respawn
      HealthPercent = 100,
      --With how much health will the squad respawn 100 = 100%
      Conditions = --What is the condition that the squad will respawn
        { --Start with the condition block
           BuildingIsAlive {For = "ALL", Tag = "EnemyBuilding01Camp01"},
          --The squad will only respawn when the spawn building with the name (Tag)
          --EnemyBuilding01Camp01 is alive
         }, --End of the condition block
       Actions = --any actions when the squad respawn
         { --Start with the action block
         }, --End with the action block
    }; --End of the Respawn event
}; --End of the State


In “UltraEdit” it could look like this:

T07 07







27. Now you create an “Entity” script file. But now we need a second “Lua” script file, the “Main”file. Without the main file you can’t start any BattleForge map. Create a new lua file and name it “_Main.lua” (you also can use the name of your map for example “_MyFirstPvEMap.lua”). At the moment our main file is empty.
28. Before we start our map we should create our description.xml (see also tutorial 06).

29. To change the map name and the map description displayed please provide the information in the file “description.xml” in the “UI” folder.
The structure of the file looks like this:



<?xml version="1.0" encoding="utf-8" ?>
<mapdescription author="MyName">
<description language="en">
<mapname>MyFirstPvEMap</mapname>
<description>This is my first PvE map.</description>
</description>
<description language="de">
<mapname>Meine erste eigene PvE Map</mapname>
<description>Dies ist meine erste eigene PvE Map.</description>
</description>
</mapdescription>


30. You can provide localized versions of both the map name and its description. Supported languages are English (“en”), German (“de”), French (“fr”) and Russian (“ru”). The loading screen will show the translated text for the language the user plays BattleForge in. If you provide no translation in the user’s language it will fall back to English. The file must be UTF-8 encoded.
31. To create this file, open your notepad. Copy and paste the structure in, replace my examples with your own names and save it into the “UI” folder. Change the ending .txt to .xml and you are ready to play your own map!
32. The final structure should look like this:

T07 06












33. Start BattleForge and log in.

34. Jump to the World Map (Games) menu and click at the “PvE-Community-Karten”.

T07 05












35. Search for your map and start it.
36. After playtesting the first time I want to change something. At the moment the “Thugs” will respawn and than they do nothing, they still standing in front of their spawn building. For the next time the enemy “Thugs” should go to a special meeting place after they have respawned. For that we need an action script command.
37. But before we added the new script command we have to name a place at the map. So open again the BattleForge Editor and look for a nice gathering place for all of my enemy squads in camp01 in the future.
38. If you are in the BattleForge community editor open the “Enemy Placement” tool (Shift+E).
39. Select “Objects”, click at “Scriptmarker” and choose the “Scriptmarker Target”. In the lower window you can give the object a useful “Tag” (name) . I named it “MeetingPlaceCamp01”. Save your map and copy the name of the target object.

T07 04










40. Open your “EnemySquad01Camp01.lua”script, add the new script command “Squad Goto” and paste the name of your target object into the “TargetTag” parameter of this command in the “OnRespawnEvent”. Do not forget it at the new “OnOneTimeEvent” too. I need an extra “OnOneTimeEvent” because the Thugs should go to the meeting place instantly and not until they respawned the first time.
Here you will see the complete new code:

State --Start of the State "Init"
{
   StateName = "INIT", --Statename
   OnRespawnEvent --Start of the Respawn Event
   {
      StartDespawned = true,
      --The squad is alive when you start the map
      TargetTag = "EnemyBuilding01Camp01",
      --The place where the squad will respawn
      RespawnDelayMinutes = 0,
      --how many minutes you have to wait before the squad will respawn
      RespawnDelaySeconds = 15,
      --how many seconds you have to wait before the squad will respawn
      HealthPercent = 100,
      --With how much health will the squad respawn 100 = 100%
      Conditions = --What is the condition that the squad will respawn
      { --Start with the condition block
         BuildingIsAlive {For = "ALL", Tag = "EnemyBuilding01Camp01"},
         --The squad will only respawn when the spawn building with the name (Tag)
         --EnemyBuilding01Camp01 is alive
      }, --End of the condition block
      Actions = --any actions when the squad respawn
      { --Start with the action block SquadGoto {Tag = "EnemySquad01Camp01", TargetTag = "MeetingPlaceCamp01"},
          --squad goto command
      }, --End with the action block
    }; --End of the Respawn event
    
    OnOneTimeEvent --Start of the OnOneTime Event (this event will trigger only once)
    { 
       EventName = "FirstWalk", 
       Conditions = 
       { --Start with the condition block 
       }, --End of the condition block 
       Actions = 
       { --Start with the action block 
          SquadGoto {Tag = "EnemySquad01Camp01", TargetTag = "MeetingPlaceCamp01"},
          --squad goto command 
       }, --End with the action block 
    }; --End of the OnOneTime Event


}; --End of the State


In “UltraEdit” it could look like this:

T07 03








41. At least I woud say we need a goal and a winning condition. For that I will use our main file. Look at the script.

State
{ --Start of the State
   StateName = "INIT",
   --My first goal
   OnOneTimeEvent --Start of the OnOneTime Event (this event will trigger only once)
   {
      EventName = "Goal",
     Conditions =
     { --Start with the condition block
       --No condition means this event will trigger automatically
     }, --End of the condition block
     Actions =
     { --Start with the action block
         MissionTaskSetActive{Player = "ALL", TaskTag = "Goal01", TargetTag = "x", Summary = "Destroy all enemy camps"},
     }, --End with the action block
   }; --End of the OnOneTime Event
--winning event
   OnOneTimeEvent --Start of the OnOneTime Event (this event will trigger only once)
   {
      EventName = "Goal",
      Conditions =
      { --Start with the condition block
         BuildingIsDestroyed {For = "ALL", Tag = "EnemyBuilding01Camp01"},
      }, --End of the condition block
      Actions =
      { --Start with the action block
         MissionTaskSetSolved {Player = "ALL", TaskTag = "Goal01", TargetTag = "x", Summary = "Destroy all enemy camps"},
         MapTimerStart {Name = "mt_MapWon"},
        --Timer will be started
      }, --End with the action block
   }; --End of the OnOneTime Event
   --game won
   OnOneTimeEvent --Start of the OnOneTime Event (this event will trigger only once)
   {
      EventName = "Goal",
      Conditions =
      { --Start with the condition block
         MapTimerIsElapsed {Name = "mt_MapWon", Seconds = 5, Minutes = 0}, --After 5 seconds
      }, --End of the condition block
      Actions =
      { --Start with the action block
         PlayerGameWon {Player = "ALL"},
         --Player won action
      }, --End with the action block
    }; --End of the OnOneTime Event
}; --End of the State


I use three “OnOneTimeEvents”:
One for starting the goal
One for solving the goal
One for the game won command.
I also use a timer command that the player has time to see how his quest will solved and after five seconds he will get the winning screen. With “UltraEdit” it could look like this:

T07 02












If you are finished with your two script files you can reload your map and playtest it again. If you meet the “Thugs” now, they are waiting at their new meeting place and when you kill them and you will wait as long as the respawn timer, they will respawn and they will go directly to the new meeting point. Only if the player troops are too close to them, than they will attack the player instead of walking to the meeting place.

T07 01

“So I hope you will enjoy your own new PvE map and you are thankfully that you learned so much from the one and only tutor in BattleForge! I hope that was enough collecting possible karma to lose this terrible curse! Else we will see us again.
But if there is any Skylord in range, please, please free me right now!”


back

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.