OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Glitchx0x on 23 Apr 2004, 20:00:39
-
Hi i'v be following a tuturiol on making a CTF map and i'v made the basics, so it all works but i would like to add sounds and text to when the flag is taken, at the moment i can only make sounds and text when u score a point using the trigger. ;D
-
try being a bit more specific, like showing the section of code where your want your titltext message and sounds etc
example of how to place a titletext message in a script
EFlagrunner = Flagowner EFlag
?(Side Player==West):titletext[format["%1 has East's Flag!",name EFlagrunner],"PLAIN DOWN"];PlaySound "fanfare"
you would place the soundfile "fanfare" in your missions "sound" folder
and your description.ext entry would look like the following
class CfgSounds
{
   sounds[] = { fanfare };
  ÂÂ
   class fanfare
   {
      name = "fanfare";
      sound[] = {"zft\sound\fanfare.ogg", 10, 1.0};
      titles[] = {   };
   };
};
-
This is my script that makes it all work:
; capture.sqs line 1
_side = _this select 0
; capture.sqs line 2
?!(local Server): goto "client"
; capture.sqs lines 3-4
?(_side == WEST): WestScore = WestScore + 1; PublicVariable "WestScore"
?(_side == EAST): EastScore = EastScore + 1; PublicVariable "EastScore"
; capture.sqs line 5
#client
; capture.sqs lines 6-7
?(_side == WEST): goto "wclient"
?(_side == EAST): goto "eclient"
; capture.sqs line 8
#wclient
; capture.sqs lines 9-10
eastflag setFlagOwner objNull
(flagOwner eastflag) setFlagOwner objNull
; capture.sqs line 11
titleText ["West captured the flag!", "PLAIN DOWN"]
; capture.sqs line 12
goto "end"
; capture.sqs lines 13-16
#eclient
westflag setFlagOwner objNull
(flagOwner westflag) setFlagOwner objNull
titleText ["East captured the flag!", "PLAIN DOWN"]
; capture.sqs line 17
#end
; capture.sqs line 18
~10
#end
; capture.sqs line 19
titleText [format["West: %1 East: %2", WestScore, EastScore], "PLAIN DOWN"]
; capture.sqs line 20
exit
I can change the text displayed when your score from this script, but i can only add sound using the trigger that init this script. I would like to make it so i can create sound and text saying when the flag has been stolen, not just when someone scores.
Incase you need it heres the code for the sound:
class CfgMusic
{
// List of music tracks (.ogg files without the .ogg extension)
tracks[] = {oh_crap, simp193, Track07};
// Class definition needed for each music track
class oh_crap
{
// Name to display in mission editor
name = "oh_crap";
// Music path, volume, pitch
sound[] = {\music\oh_crap.ogg, db + 0, 1.0};
};
class simp193
{
// Name to display in mission editor
name = "simp193";
// Music path, volume, pitch
sound[] = {\music\simp193.ogg, db + 0, 1.0};
};
class Track07
{
// Name to display in mission editor
name = "Track07";
// Music path, volume, pitch
sound[] = {\music\Track07.ogg, db + 0, 1.0};
};
};
-
uhm...i think this would work...u need 2 more triggers.
let's begin with the first.
Size = 0
Activated = anybody repeatedly
Condition = !isNull (flagOwner eastflag) AND side (flagOwner eastflag) == WEST
On Activation = [WEST] exec "message.sqs"
Make the second trigger the same as the first, just replace each "east" with "west" and vice versa.
Now to the script...you need a new one, since the one which you already have is executed too late (when you're already at your own flag)
;message.sqs
_side = _this select 0
?(_side == WEST): _flag = "East Flag"
?(_side == EAST): _flag = "West Flag"
_msg = format ["%1 has taken %2", _name flagowner, _flag]
titletext [_msg, "PLAIN DOWN"]
playsound "mysoundname"
exit
This is untested and right out of my mind...which isn't always running smooth ;D
-
I'v tried what your said terox and all i get when i take the flag is:
'titletext [_msg, "PLAIN DOWN"]|#|': Error Typr Any, expected string
at the top of the screen in white.
-
then try this:
;message.sqs
_side = _this select 0
?(_side == WEST): _flag = "East Flag"
?(_side == EAST): _flag = "West Flag"
titletext[format["%1 has %2!",name flagowner, _flag],"PLAIN DOWN"]
playsound "mysoundname"
exit
-
thats got the sound working but i'm still getting a error message so it dusnt display any text. :-[