I dunno if anyone wants it or will ever use it to make a map, but I thought I would post it to see if people wanted to test it and give me their feedback on it.
Assualt and Deffend Map: Basicly one team starts out with a captured flag. The Other teams has to capture that flag and when they do they get a point and the teams switch sides and the other team gets to try and take the flag for a point.
Now I am still new at OFP scripting and I havn't seen a script like it. (I mainly use C, C++ & VB) There is probably a better way of making this script and if there is anything that can be fixed up apon please tell me.
Also if anyone knows a script to remove bodies and AI please tell me how to use them.
--- Starting off The Mission: Creating The Files ---
You Need 5 Files
File 1: Init.sqs
WestScore = 0
EastScore = 0
WPos = 2
EPos = 1
PublicVariable "tunits"
PublicVariable "WPos"
PublicVariable "EPos"
File 2: FlagCapture.sqs
_flag = _this select 0
_player = flagOwner _flag
goto format ["%1", side _player]
goto "end"
#West
~0.5
(flagOwner _flag) setflagowner _flag
_flag setflagowner _flag
~0.5
_flag setflagtexture "usa_vlajka.pac"
_flag setflagside West
"Flag1Pos" setMarkerColor "ColorBLUE"
titletext [format["NATO Forces Captured The Flag"], "PLAIN DOWN"]
WestScore = WestScore + 1
PublicVariable "WestScore"
hint format ["NATO Score: %1\nSoviet Score: %2", WestScore, EastScore]
goto "end"
#East
~0.5
(flagOwner _flag) setflagowner _flag
_flag setflagowner _flag
~0.5
_flag setflagtexture "rus_vlajka.pac"
_flag setflagside East
"Flag1Pos" setMarkerColor "ColorRED"
titletext [format["Soviet Forces Captured The Flag"], "PLAIN DOWN"]
EastScore = EastScore + 1
PublicVariable "EastScore"
hint format ["NATO Score: %1\nSoviet Score: %2", WestScore, EastScore]
goto "end"
#end
[side _player] exec "Switch.sqs"
Exit
File 3: MTimer.sqs
MTimer = 0
_TCount = 29
#Start
~1
MTimer = _MTimer + 1
_TCount = _TCount + 1
?( _TCount == 30 ): goto "DispScore"
goto "Start"
#DispScore
hint format ["NATO Score: %1\nSoviet Score: %2", WestScore, EastScore]
_TCount = 0
goto "Start"
"end"
exit
File 4: Switch.sqs
_side = _this select 0
goto format ["%1", _side]
#west
WPos = 2
EPos =1
PublicVariable "WPos"
PublicVariable "EPos"
"_x setdammage 1" forEach tunits
goto "endit"
#east
WPos = 1
EPos = 2
PublicVariable "WPos"
PublicVariable "EPos"
"_x setdammage 1" forEach tunits
goto "endit
#endit"
Exit
File 5: Respawn.sqs
_player = _this select 0
?( Side _player == west ): goto "WestRespawn"
?( side _player == east ): goto "EastRespawn"
goto "TheEnd"
#WestRespawn
?( WPos == 1 ): _position = getMarkerpos "assaultbase"
?( WPos == 2 ): _position = getMarkerpos "deffendbase"
_player setpos _position
goto "TheEnd"
#EastRespawn
?( EPos == 1 ): _position = getMarkerpos "assaultbase"
?( EPos == 2 ): _position = getMarkerpos "deffendbase"
_player setpos _position
goto "TheEnd"
#TheEnd
Exit
--- Starting The Mission: Markers ---
You Will Need 4 Makers
Marker 1: respawn_west
Marker 2: respawn_east
^ Theses 2 Markers place out in the middle of now where I will come back to this when I get to triggers.
Marker 3: Assaultbase
Marker 4: Deffendbase
^ These makers can be set to any size and will be the spots where the players will actualy respawn too.
--- Starting The Mission: Triggers ---
You Will Need 4 Triggers
Trigger 1: MTimerStarter
Con: true
Act: [] exec "MTimer.sqs"
Trigger 2: WestFlagTake
Con: (Side (FlagOwner Flag1) == WEST)
Act: [Flag1] exec "FlagCapture.sqs"
Trigger 3: EastFlagTake
Con: (Side (FlagOwner Flag1) == EAST)
Act: [Flag1] exec "FlagCapture.sqs"
Trigger 4: RespawnPositionSetter
This Trigger will go right arond the markers respawn _east & _west, make sure both markers are inside.
X Axis = 50
Y Axis = 50
Activation: Anybody, Repeatedly
Con: alive player
Act: [player] exec "Respawn.sqs"
--- Creating The Mission: Flag ---
You Will need 1 Flag and 1 Marker
Flag Name: Flag1
Init: this setflagtexture "rus_vlajka.pac"; this setflagside east
Maker Name: FlagPos
Set Color To Green
--- Creating Players ---
For The Very First Player You Make You Need To Put This In Their Init Feild.
Init: tunits = [this]
For Every Other Player You Need To Put:
Init tunits = tunits + [this]
That is all you need for the mission if you have any problems post a reply here and I will help you. I am going to create another part for base safezones but I wanted to get this out and see what people thought of it. The Script is now where finished, but I thought I would put it out so people could modify on it and make it better to use in their own missions. This type of mission will deffinatly need a remove the body script, but have fun anyway with it.
I wanted to give thanks to Terox and Tactician for helping me out a couple of times and Backoff because I learned a lot from his tutorials.