PDA

View Full Version : Printbold help needed!



EvoloZz
7th November 2012, 18:07
Hello, i need help with "self iprintlnbold" command. I want to make something like an automatic welcome message, that when player joins in game it will print some nice welcome message on his screen. I think it goes under Callback_PlayerConnect()
I am newb in this kinda stuff ^^

~EvoloZz

Tally
7th November 2012, 18:30
Hello, i need help with "self iprintlnbold" command. I want to make something like an automatic welcome message, that when player joins in game it will print some nice welcome message on his screen. I think it goes under Callback_PlayerConnect()
I am newb in this kinda stuff ^^

~EvoloZz

Basically, don't call the function on a connecting player. It's not the best place to use it because as soon as they connect, a menu of some sorts will pop up and block them seeing it. Wait till they spawn, then do your message.


init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for( ;; )
{
level waittill( "connecting", player );

player.pers[ "welcomed" ] = undefined;

player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon( "disconnect" );

for( ;; )
{
self waittill( "spawned_player" );

self thread WelcomeMessage();

}

}

WelcomeMessage()
{
self endon( "disconnect" );

if( isdefined( self.pers[ "welcomed" ] ) ) return;
self.pers[ "welcomed" ] = true;

self iprintlnBold( "Hello" );

}

EvoloZz
7th November 2012, 18:41
Basically, don't call the function on a connecting player. It's not the best place to use it because as soon as they connect, a menu of some sorts will pop up and block them seeing it. Wait till they spawn, then do your message.


init()
{
level thread onPlayerConnect();
}

onPlayerConnect()
{
for( ;; )
{
level waittill( "connecting", player );

player.pers[ "welcomed" ] = undefined;

player thread onPlayerSpawned();
}
}

onPlayerSpawned()
{
self endon( "disconnect" );

for( ;; )
{
self waittill( "spawned_player" );

self thread WelcomeMessage();

}

}

WelcomeMessage()
{
self endon( "disconnect" );

if( isdefined( self.pers[ "welcomed" ] ) ) return;
self.pers[ "welcomed" ] = true;

self iprintlnBold( "Hello" );

}


So i have to make entirely new .gsc file? Like _welcomemessage.gsc?

Tally
7th November 2012, 18:45
So i have to make entirely new .gsc file? Like _welcomemessage.gsc?

Yes. You could put it in any of the stock files, but it is best to learn how to create your own files and put them in your mod.

BTW - a sign of a good modder, someone who has the aptitude for modding is someone who takes the initiative. Don't ask first, do it and find out. If you then run into problems, go to a forum and ask. But always try something first before you ask. I learnt from mod forums like this, but I rarely asked questions. I just jumped in the deep end and tried swimming.