OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: greg147 on 05 Aug 2005, 11:21:14

Title: Names in titletext
Post by: greg147 on 05 Aug 2005, 11:21:14
Hi all,

I was looking at Toadlifes HALO script, when I saw this hint command

Code: [Select]
hint format["Hello %1! When your chopper reaches land, your group will automatically be ejected and the units will perform a HALO drop. This is a realistic HALO drop, so be sure and pull your chute at 100m or higher, or you may die! Once on the ground, you can order your men into one of the choppers and use the radio [0,0,1] to eject them again!",name player]

When it activates, where '%1' is, the players username comes up.

Anyway, I was wondering if there is a way to convert this method to titletext, so the players name comes up in writing at the bottom of the screen.

Thanks  ;)
Title: Re:Names in titletext
Post by: klavan on 05 Aug 2005, 11:26:41
titletext [format ["Good morning, Captain %1.", name player],"plain down"]

Klavan
Title: Re:Names in titletext
Post by: greg147 on 05 Aug 2005, 11:35:22
Thanks for the quick reply.
When I try it, I get an error that says:
 
Good morning, Captain ERROR: NO VEHICLE.

Have I missed something out here?   :P
Title: Re:Names in titletext
Post by: Dane on 05 Aug 2005, 12:00:04
Quote
titletext [format ["Good morning, Captain %1.", name player],"plain down"]

Works for me, are you sure you have a name in the player setup meny?

Edit. Nvm just found out player can't can't :P have a name.
Title: Re:Names in titletext
Post by: klavan on 05 Aug 2005, 12:17:45
Edit. Nvm just found out player can't can't :P have a name.

Yes he can: you must create an identity in the description file.

@greg147
Has your player a name? I mean: in the GUI you can create an identity for the player. Have you did it?
Klavan
Title: Re:Names in titletext
Post by: greg147 on 05 Aug 2005, 12:18:17
This is what I have:

Code: [Select]
titletext [format ["{Major} You and your squads are going to be inserted into enemy territory early tommorrow morning\n led by Captain %1 to destroy the enemies artillery prior to the main assualt.", name player],"plain down"]
But its not working for me   :-\
Title: Re:Names in titletext
Post by: klavan on 05 Aug 2005, 12:22:56
@greg147
Your code it's OK: works fine with me!
I still continue to think your player doesn't have a  name.
Klavan
Title: Re:Names in titletext
Post by: 456820 on 05 Aug 2005, 13:10:24
since when was there a [ in front or format i use

Code: [Select]
titletext format ["{Major} You and your squads are going to be inserted into enemy territory early tommorrow morning\n led by Captain %1 to destroy the enemies artillery prior to the main assualt.", name player,"plain down"]
thats what i use and it always works for me
Title: Re:Names in titletext
Post by: RujiK on 05 Aug 2005, 17:13:14
With hint format is outside the [ with titletext its inside.
Example:
titletext...
Code: [Select]
titletext [format["%1 says hi!",name player],"Plain Down"]hint...
Code: [Select]
hint format["%1 says hi!",name player]
Title: Re:Names in titletext
Post by: 456820 on 05 Aug 2005, 18:35:45
oh ok i just persumed that its outside the format alsoits out side with sidechats aswell
Title: Re:Names in titletext
Post by: greg147 on 05 Aug 2005, 20:00:17
I found out that it works in a mission, but doesn't work in an intro. Which is knida what I need it for.
At first I thought it was because I have [ and ] in my username, but it turns out that its not.
Title: Re:Names in titletext
Post by: klavan on 05 Aug 2005, 20:07:52
Do you receive an error message?
If yes what kind of error message?
I've tested it: i've putted a dude (the player) in the intro section of the editor and in the his init field I pasted your code. I ran the prewiev and....Result: the text appeared correctly.
Klavan
Title: Re:Names in titletext
Post by: greg147 on 05 Aug 2005, 20:16:07
The only error message I recieved was in the text itself.

When I ran it, the text said:

{Major} You and your squads are going to be inserted into enemy territory early tommorrow morning led by Captain error: no vehicle to destroy the enemies artillery prior to the main assualt.

My username is [Pte] Greg (The [Pte] is there because of the MP squad i'm in, so I don't really want to change it.)
Problem is, I have tried changing my username, and it won' let me. Whenever I click on my existing one, and select edit, it creates a new user.  :P

Heres the code I have again:
titletext [format ["{Major} You and your squads are going to be inserted into enemy territory early tommorrow morning\n led by Captain %1 to destroy the enemies artillery prior to the main assualt.", name player],"plain down"]

EDIT: BTW, I have not used setidentity on the player.
Title: Re:Names in titletext
Post by: h- on 06 Aug 2005, 10:10:23
No need for setIdentity..
And that code of yours works fine here too...

Are you by any change editing an MP mission?
If so, maybe that has something to do with yer problem ???
Title: Re:Names in titletext
Post by: Sui on 09 Aug 2005, 01:30:43
The name command can be a bit wierd sometimes I've found...

name player will work fine in a mission, but not in the intro.
Try giving your unit a name (in the name field of the unit in the mission editor) and referring to that instead in the intro, eg.

name unit1

That's how I've always done it in my missions ;)