OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: SilentHunter on 24 Apr 2004, 11:48:47
-
Hi,
I was just wondering if there is any way of detecting if a unit has included a certain word in a chat message etc.
I wanted to give my mission a new depth of interactivity, By having certain units react to messages,
For example, the words "Need ammo" included anywhere in a sentence would force the nearest compatible unit to you to drop a mag, or "medic" which would force the nearest medic in the area to come to you.
Thanks in advance
SILENTHUNTER
-
Hmm.
I recon this only makes sense in SP, as in MP people already _should_ work together to achieve their goals, even if this means sharing ammo...
And in SP, you might script this (e.g. have some addactions which will start a script to have some unit come to your position and drop ammo.)
As far as I recall, the chat is not available in SP?!
So you could either use triggers (radio alpha etc. blabla) or actions to do something like this in your SP mission.
Cheers
PiLLe
-
Hi,
I was just wondering if there is any way of detecting if a unit has included a certain word in a chat message etc.
The short answer is No.
But from the example you mention, you can detect when they are getting low on Ammo using the command SomeAmmo (http://www.ofpec.com/editors/comref.php?letter=S#someAmmo)
Read the Command Reference (http://www.ofpec.com/editors/comref.php) to find out what other info you can get from your squad.
-
The medic command works fine alone or in a group. Unit 4 injured. Unit 4 goto medic 5 0'clock.
Or if your alone the medic comes to you.
The ammo one is difficult. Should you be leading, to get yur guys to drop ammo, you have to go through three pages of commands to make them do it, very annoying.
-
excuse my noobishness i must be missing the point somwhere
I was just wondering if there is any way of detecting if a unit has included a certain word in a chat message
what about on the MP servers where people type key words in the chat thing and it plays a sound, coulden't you do it that way
-
Greetings,
You could also do this using actions or radio channels, instead of chat messages.
For instance:
Player types 0-0-1 (for Radio Alpha, defined as "Call for Medic!")
executes command:
player sideChat "Aagh! I've been hit! MEDIC!"
;code to send medic
Similarly, Radio channel Bravo - "Call for ammo!"
player sideChat "I need some ammo here!"
;code to get a unit to drop a mag
It doesn't exactly do what you want, but here's a new idea, which might fit what you're looking for:
Use a simple dialog: A textbox and an OK button:
Player types stuff into the textbox and hits OK.
A script checks for words like "Medic", "ammo" etc. in the textbox output
Text is sent to sideChat channel
Necessary actions are executed by the script.
The dialog itself could be done in about 5 mins with RazorWings' Dialog Editor (Editors Depot-> pending).
The script would be a little harder to write... :P
-Supreme Commander PsyWarrior
-Psychic Productions Studios
-
This brings me nicely onto my next question,
How would you detect for example the word "medic" in for example
"I need a medic"
And BTW all those 'need ammo' and 'medic' things were just examples, not what i actually wanted to do.
SILENTHUNTER
-
To bigcheese: The chat message appears after typing a 0-9-x and is basically just showing the custom sound filename. Thats not a handtyped text.
-
Y'realise this could be very annoying, sometimes :)
"I don't like those medics"
Then a medic runs over to you
When you type something, like I need ammo, what is to happen?
- ben