FileFront Forums

FileFront Forums (http://forums.filefront.com/)
-   ST:EF Modding, Mapping and Editing (http://forums.filefront.com/st-ef-modding-mapping-editing-8/)
-   -   [Help] ST:EF2 Scriptipting, level end/map change. (http://forums.filefront.com/st-ef-modding-mapping-editing/399395-st-ef2-scriptipting-level-end-map-change.html)

Chrissstrahl May 18th, 2009 06:29 AM

ST:EF2 Scriptipting, level end/map change.
 
1 Attachment(s)
I have noticed that there is a need to put a tutorial like this on-line, so here it is, perhaps I'll do a full introduction to the ST:EF2 scripting system soon.

THE WORKING-DIRECTORY

Your working directory is the maps directory of your game,
if you have created a map already you should know the location.
If you do not know the location search for your STEF2 base folder.
On default it is: c:\Programms\Activision\EF2\base\
If you can't find it search for ef2.exe, once you have found the
directory in which ef2.exe is located you should be able to find a
folder called base inside it.

THE X-FILE
Create a txt file as your map name is, for example if your map name
is sangreal then the txt file must be named sangreal too.
You have to rename the extension of this file, instead of sangreal.txt
it must be sangreal.scr.
Open sangreal.scr, with a text Editor, I recommend Notepad++,
there you can select c++ highlighting, that will help.

You need to have:
sangreal.bsp -> The level
sangreal.scr -> The level-script


BE ADVISED
To not use to simple function names, since the game might
has already a function with the same name.
Search here if your function name is already in use.


Opening the X-Files
Once you have your sangreal.scr open it must be empty.
Adding a function works like this:
PHP Code:

void doLoadNextLevel()
{
//create the a trigger to end the current level
    
spawn("trigger_changelevel","targetname","endLevelNow","map","");
//wait for the trigger to be created
    
wait(.05);
//fire the trigger, and end the level
    
triggerEntity($endLevelNow);
//now wait a moment (not to long) to show the mission success hud
    
wait(4);
//now load the next map
    
stuffCMD("map zoo1");//replace zoo1 with your own mapname


Now you need to place a trigger on the map which calls this thread.


MAKE IT WORK
To make this script work you need to place a trigger on you map
where the player has to walk into, at best you use trigger_once.
This trigger has to fill the area where the player walks so the player
can't crouch under, jump over or walk next to the trigger.

This trigger has to call the function called "doLoadNextLevel",
names are case sensitive, this means every upper-case and lower-case
letter makes a difference to the scripts, you need to be accurate!

Create a brush in the size you want to have the trigger, make sure
you have only selected this brush (press twitch escape and select
the brush again) and press N this will bring up the entity menu.

Select from the entity menu "trigger_once", then enter the following
attribute into the files and hit enter:
KEY: thread
VALUE: doLoadNextLevel

That's it, compile your map and try it :)
Good luck!


Illumination of the used Classes/Functions
PHP Code:

//Spawns an entity
spawn("trigger_changelevel","targetname","endLevelNow","map",""); 

This creates(spawns) a trigger of the class changeLevel,
this trigger class has the purpose to end the current game, and load the next map.
In this case the map to load is empty ["map",""], this will end the game and crash
if the server(in singleplayer) will not be instructed to load any map or disconnect.
PHP Code:

//Server only command
stuffCMD("map sangreal2"); 

In singleplayer the player is hosting his own server where his singleplayer game runs on.
So in this case it is not refereed to a multiplayer-server!
PHP Code:

//Wait for the specified amount of time.         
wait(.05); 

Does wait, comes handy to delay a action in scripting.
PHP Code:

//Trigger the specified entity
triggerEntity($endLevelNow); 

$endKLevelNow is the name of the trigger spawned before.
The $ marks this as a Entity, which is a Object in the current level,
everything what can be removed or added to the level while the game
is running is a entity, every player, every trigger, every door, every bot, movable objects, models and such.

Here is the Übertools Documentation to guide you:
Scripting Syntax
Need to know knowlage to not mess up the scripts!
Scripting Functions/classes you can make use of

Tricorder May 18th, 2009 01:53 PM

Re: ST:EF2 Scriptipting, level end/map change.
 
Thread sticked. This one is definitely worth keeping. Feel free to add more stuff to it, Chriss.

Edit:
Thread unsticked and link to it added here: http://forums.filefront.com/st-ef-mo...tutorials.html


All times are GMT -7.

Powered by vBulletin®
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.