This member has provided no bio about themself...
Hi, here I'm going to show you to how make a little script, that would spawn any kind of unit from SF2 world editor in your map.
First, create a Coop map in SF2 Editor and choose a Teamsetup in a World section.
Setup a Coop Team system:
World Editor automatically created five different teams: tm_Animal, tm_Creep, tm_Human, tm_Neutral, tm_Enemy. You have also a possibility to create more teams if you want. As you can see, tm_Enemy is highlighted in the picture, because I'm planning to show a script, which would spawn an enemy figure in the map, but you have a complete freedom and can make a script, which could spawn a unit of any team, which are listed above.
After these first steps, we are ready to decorate the map and look for some places, where the unit may be spawned.
After planning, which unit will be spawned and where the unit will appear, we need to gather some info about him, which will be used in a script code. As you can see, we will need his Type ID and coordinates.
After gathering the data from a World Editor, delete the unit, which is planned for a spawn event. Now we are finally ready to write a code in a script file. But before doing it, we must create a "script" and "dialog" folders in the "map_name" folder!
Keep in mind, that even if you're not planning creating dialogs in your map, you still must create the "dialog" folder!
A "dialog" folder must consist of these two files (.lua):
The code, which is written in these two files, is depicted down below:
Now we are ready to create a Script in the "script" folder (for example: _map_name.lua)
I'm going to show an example, where the unit is going to be spawned without any conditions (it will be spawned at a very beginning of the game).
The example of the code shows that you must assign a tagname for the spawned unit, level, ID, coordinates and a team.
A more detailed example:
Then place a "PortalEndPoint" in your map to spawn your heroes and save the map to test it in your game.
Run the game and click on a "Freegame" mode, then find your map (might be at the very end of the map list) and load it.
Ta-da! The script should work and a skeleten must be spawned near the rock. :)
No blogs were found matching the criteria specified. We suggest you try the blog list with no filter applied, to browse all available. Join now to share your own content, we welcome creators and consumers alike and look forward to your comments.