SCRIPTING

Co-Op scriptMod - Manual




INDEX



Introduction

IMPORTANT: This tutorial is neighter supported by the creator(s) nor by the publisher(s) of the respective game(s). Use this at your own risk.


The HazardModding Co-Op scriptMod is a one of the most advanced Fan made Scripts relased for EF2. For that reason it requires a lot of background knowledge which is given in this document.(This document is still in development)


Even when we try to make the script as stable and secure as possible there always can a bug flee and stay alive... ...also this Manual won't be perfect or contain all informations about the Mod nor the knowhow we have gathered by developing this Mod.


We try to provide you with all data of which we are aware of that you will require thise. Even when you are an advanced Scripter you should read our Manual with great attention, it can still contain informations of which you where not aware of.



This document is not meant as Explanation for the Co-Op Matrix, nor how it is working. We will explain for sure some of the functions but this is not our target. Our target is to allow you(a developer), to include the Co-Op Mod and translate on your own Single Player Mission Scripts for Multi Player use. You should see the Co-Op Mod as a Matrix at which you can plug in Single Player Mission Scripts to make them Multi Player usable.


What is a cVar?

A cVar is a variable wich is stored in a config-file. Each server requires such a *.cfg file and there you can store those variables.


Tools


It is highly logical that you can only deliver good work with good Tools. That better your tools are that easier it will be for you to reach a high quality level and keep it. We are not perfect and our work is not perfect but we try to make it as good as it is possible without spending a whole live on it...



This list of tools below is an advice for you, but no must have.

Translation Items


A Elite Force II Multi Player Server was orginaly not created to play Single Player Missions on it, but it is capable of. A Multi Player Server does work different as when you start a Single Player Game.


Some commands do not work with the Multi Player Servers, they have been commented out in the Game Code or are just not Classified for Multi Player Mode.

Using such commands will end in a Game Server crash.


There is also a difference between Windows and Linux Servers, Linux Servers do not support some Commands because they are totally dressed for Multi Player which makes them faster more stable and secure. So since the Co-Op Matrix has become stable and rich on features most Levelscripts do not need much changes to work with the Co-Op Mod, but there are still a few Commands wich have to be removed or Translated. Not only for that reason it is necessary to edit every Levelscript.


Legend: e = entity, s=string, f=float, i=integer, b=boolan



waitfordialog(e); //Wrong!!!

globalCoop_playDialog(entity,string,float,float,dialogLegth,float). //correct




Including the Co-Op Matrix in a Mission Script


Each EF2 Level script called after Map load by the game and Compiled by the Script Master starts at the main thread. From within this thread the Co-Op Mod needs to be called. But before the Co-Op Mod can be called it needs to be included, and this have to be before the main thread is defined.

EXAMPLE:

Co-Op Variable Explaination

There are a few Variables wich can be costumisized for each Map/Level, the Table below contains them. Some of them are required, those are marked. They are already delared in the global_co-op.scr they only need to be set to an value.


EXAMPLES

Float

coop_spawnorigin0 = '0 44 -111';




Variable Name

Type

Description

coop_regenHealthAmmount

Float

Ammount of Health regerating per cycle.

coop_regenArmoryAmmount

Float

Ammount of Armory regerating per cycle.

coop_regenAmmoAmmount

Float

Ammount of Ammo regerating per cycle.

coop_regenHealthMax

Float

Maximum Health allowed, will automaticly applay the highest Health value set somewhere else in the vars.

coop_startHealth

Float

Start Health the Players get Equipt with on Re/Spawn

coop_startArmory

Float

Start Armory the Players get Equipt with on Re/Spawn

coop_weapon0a

coop_weapon0b

coop_weapon0c

coop_weapon0d

coop_weapon0e

coop_weapon0f

coop_weapon0g

coop_weapon0h

coop_weapon0i

coop_weapon0j

String

Equipment for each Player, the Integer stands for the Player-ID and the Letter after the it stands for the Weapon Group. The Co-Op Matrix supports 10 Weapon Groups: a,b,c,d,e,f,g,h,i,j

At last the ID 0 have to be customized no matter wich Group


Example:

coop_weapon0a="models/weapons/worldmodel-fieldassaultrifle.tik";

coop_spawnangle0

coop_spawnangle1

coop_spawnangle2

etc...

Float

Start Angle of the Players, each integer indicates the Player id. 1=Player1, 2=Player2, 3=Player3, 4=Player4, 5=Player5, 6=Player6, 7=Player7, 8=Player8 (0=Player No Id) At last the ID 0 have to be customized.

coop_spawnorigin0

coop_spawnorigin1

coop_spawnorigin2

etc...

Vector

Start Vector of the Players, each integer stands for a Player id. 1=Player1, 2=Player2, 3=Player3, 4=Player4, 5=Player5, 6=Player6, 7=Player7, 8=Player8 (0=Player)

coop_respawnorigin0

coop_respawnorigin1

coop_respawnorigin2

etc...

Vector

Respaw Vector of the Players, each integer stands for a Player id. 1=Player1, 2=Player2, 3=Player3, 4=Player4, 5=Player5, 6=Player6, 7=Player7, 8=Player8 (0=Player)

coop_objectiveItem1

coop_objectiveItem2

coop_objectiveItem3

etc...

String

Objective Items, there are eight Items possible.






Mod Features

Some actions are used on all or the most Levelscripts over and over again, and some of them where in need of becomming compatible to the Co-Op script Mod. For that reason there are some functions wich can be used as features once the Co-Op script Mod has been included in a Levelscript. But remember that the Mod is still in development and maybe some of the Features below will be altred of the time.


Legend: e = entity, s=string, f=float, i=integer, b=boolan

Purpose + Description

Code

Return Type

Tells the Co-Op Mod that the current Map comes to it's end. The Mod Script will do now all things wich needs to be done and then load the next map, wich is given as string with in the function on call.

globalCoop_levelComplete(s maptoload);

Void

Does Mission Failure for all Players. And displays the reason for failure. Fades out the camera to red. And restarts the Level.

globalCoop_missionFaild(s reason);

Void

Returns the number of Players currently on the Server. This can be used to set special events, like spawn a monster for each player, etc...

globalCoop_returnNumOfPlayers();

Int

Returns the number of Living Players currently on the Server.

globalCoop_returnNumOfLivingPlayers();

Int

Returns the Integer 1 for TRUE if the given entity exists and is still allive, else it returns 0 for FALSE...

globalCoop_checkForExistenceAndLive(e e);

Bool

Returns a float wich is the result of a Multiplication of the given value on call. Can be used to set a monsters health to a higher value, so if there are 3 Players on the Server you can set the monster its health to be 3 times higher.

globalCoop_returnNewFloatMultiplierPlayerNum

(f fMultipliedNew);


$lurker1.health(globalCoop_returnNewFloatMultiplierPlayerNum($lurker1.gethealth()));

Float

Immobilize or mobilize all Players. If the Integer 0 is given all Players will be mobilized, if 1 is given all Players will be immobilized.

globalCoop_immoPlayers( b true);

Void

Item or Weapon wich will given to all Players. If the second parameter is a float or integer grather then 0 the players will use the given weapon after the given ammount of secounds, else the given Weapon or iteam will not be used instantly.

globalCoop_give(s itemtoGive,f useNow);

Void

Item or Weapon wich will be taken away from all Players. Remember that you don't get in competition with the Items wich have be definied as equipment, or u wipe them out before...

globalCoop_take(s toTake);

Void

Forces all Players to instantly use the given Item or Weapon, if they have it. With that command you can switch the Weapon of all Players, etc...

globalCoop_use(s UseThis);

Void

Applays new given Weapons wich have not been definied for each ID individualy, cuz ur to lazy for that then u'll love that one here. It does your job!!!! By applaying the new Weapons/Groups to all Player ID's.

You need to define then just for the ID 0 the Groups you are using.

coop_weapon0a, coop_weapon0b, etc...

globalCoop_applayToAll();

Void

Applays the value of each Spawn Origin for each Respawn Origin with the same ID...

Again something to make your live easyer, yes. You will now give us your soul for such a wounderful gift...

globalCoop_applaySpawnOrigins();

Void

Sends a Message to all Players and notifies the Players that there is something happening with a sound...

globalCoop_globalMessage(s msg);

Void

Plays a dialog attached to a player. Remember that we are dealing with at last tow languages, german and english, so we need both dialogs played at the same time. Using the normal Dialog feature plays only in the language the SV uses...

globalCoop_playerPlayDialog(e player,

s playerDumy,s dialogToPlay,f dialogVolume,

f dialogMinRange,float dialogLegth);

Void

Returns the entity wich is playing the dialog... Almost then the same as the Function above... Can be useful if the dialog is some thing like „today is a god day to die...“ and u gona kill the entity after the dialog...

globalCoop_returnPlayerPlayDialog

(s playerDumy, s dialogToPlay,f dialogVol,

f dialogMinRange, f dialogLegth);

Entity


drop or droptofloor
kill
immobilize
or mobilize
freeze
or unfreeze
hide
show
immortal
or nodamage
mortal
or takedamage
healthy
or healt
ammo
give all
or giveall or all
armor
or armory or shild or give armor

or give armory or give shild

globalCoop_globalCommand(s coopGlobalCmd);

Float










Configuration


The Mod does also have a great flexibility, it can be massivly configured. The Table below does contain the names of the Vars wich can be costumisized and what each Var accutly does. Some Features are currently are not or not fully supported.


Var Nam

Description

Range

Type

coop_missionObjectiveShowTime

Show Time of the Objectives Hud. Value -1 does disable the Mission Objectives Hud.

2.510 sec

cVar

coop_intermissionTime

Time after Mission completion to wait before the next map gets loadad.

560 sec

cVar

coop_regenHealthMax

Maximum of Health wich will be regenerated by the Mod.

N/A

var

coop_regenAmmoAmmount

Amount of ammo regeneration per cycle.

N/A

var

coop_regenHealthAmmount

Amount of Health regeneration per cycle.

N/A

var

coop_equipInterval

Equip Interval periode.

N/A

var

coop_startArmor

Amount of Armor Players beeing Equipt on Spawn.

N/A

var

coop_startHealth

Amount of Health Players beeing Equipt on Spawn.

101 - 500

var

coop_disForceOneTeam

Disables that Players get forced all into one team only. Ensure you have not enabled that the Server evens the Teams, or it will come to an havy fight between the script and the Server and maybe to an Server chras. 0=force all in one team,

1=do not force in one team only

0 or 1

cVar

coop_forceOneTeamColor

Select the Color of the Team all Players will be forced in.

blue or red

cVar





coop_allowGodCheat

Allow Players to use the God cheat. Of course if cheats are activated.

0 or 1

cVar

coop_disNonCampainWeapons

Disable all other weapons wich are not used in the Mission.

0 or 1

cVar

coop_disAutokick

Disable auto kick by script...

0 or 1

cVar

coop_disCamFade

Disable camera fadings Managed by the

Co-Op Mod.

0 or 1

cVar

coop_disShowID

Disable the ID beeing Printed to the Players Hud.

0 or 1

cVar

coop_disCampaigns

Disallows playing Campaign Maps.

0 or 1

cVar

coop_disTraining

Disallows playing Training Maps.

0 or 1

cVar

coop_disSecretLevels

Disallows playing Secret Maps.

0 or 1

cVar

coop_disForcedMapLoad

Disallowes the script to select the Next Map loadad on Mission completion.

0 or 1

cVar

coop_disCinematic

Disable Cinematic Sequences.

0 or 1

cVar

coop_disRandomRespawn

Disables Random Respawn locations for the players, so they allways respawn at thair ID location

0 or 1

cVar

Credits

Special thanks to:

(KO)Gilligan

[-GF-]Adm.Myers


//Eof @Chrissstrahl