help with script :)
Posted: June 13th, 2011, 8:12 am
can someone tell me how dantheman did the credits in portal and sonic at the end of the map?is it easy?
CoDJumper.com - For all your CoDJumping needs!
https://codjumper.com/forums/
thx but how to put a black screen?Drofder2004 wrote:Not sure what they look like, but I assume black screen and scrolling hud.
Although he will the only one who confirm.
i tried this...i'm not good with scripts..need helpIzNoGoD wrote:Create a new hud element.
Set sort to 99999 or smthing
Make it fullscreen, setshader ("black",640,480); it
Now, create the text with sort over that 999999 that you just gave. Scroll the text. Done.
Remember to precache both the strings and the black shader.
Code: Select all
main()
{
precachestring(&"Map created by ...");
thread credits();
}
credits()
{
t = getent("credits_trigger","targetname");
while(1)
{
t waittill("trigger", player);
if(player isTouching(t)){
player.blackscreen = newclienthudelem(player);
player.blackscreen.setshader=("black",640,480);
player.credits = newclienthudelem(player);
player.credits .font = "default";
player.credits .fontScale = 2;
player.credits .color = (1, 1, 1);
player.credits.label = &"Map created by ...";
}
}}
IzNoGoD wrote:Ever tried to find the scripting docs? (documentation)
If you would have taken the time to either read them or to re-read your script, you could easily point out a few errors.
1. I see no precaching of the black shader
2. setshader is a function, not a sub-var
3. player.credits .font = "default"; shouldnt have a space after player.credits
4. Above stuff could have become visible if you would just use developer 1 and interpret the errors by going to said line (or one above mostly)
5. The hud element is not destroyed after a while. I guess you would eventually fix this?
6. I see no alignx/aligny "fullscreen". Look through some stock scripts, as i know cod2 uses some of these in the killcam. Maybe cod4 does too?
7. Properly align your code. This is a mess to read (and use [c ode=cod] tags here, without the space after the c
Code: Select all
main()
{
precachestring(&"Map created by ...");
precacheShader("black");
thread credits();
}
credits()
{
t = getent("credits_trigger","targetname");
while(1)
{
t waittill("trigger", player);
if(player isTouching(t)){
player.blackscreen = newclienthudelem(player);
player.blackscreen.setshader=("black",640,480);
player.credits = newclienthudelem(player);
player.credits.sort = 99999;
player.credits.x = 400;
player.credits.y = 400;
player.credits.alignX = "right";
player.credits.alignY = "bottom";
player.credits.font = "default";
player.credits.fontScale = 2;
player.credits.color = (1, 1, 1);
player.credits.label = &"Map created by ...";
wait 5;
player.credits destroy();
player.blackscreen destroy();
}
}}
Code: Select all
player.blackscreen.setshader=("black",640,480);
Rezil wrote:This line is wrong. Read the documentation as to why.Code: Select all
player.blackscreen.setshader=("black",640,480);
Code: Select all
player.blackscreen setshader=("black",640,480);
Example:Code: Select all
waypoint SetShader( "playbook_objective_stop", 15, 15 );
IzNoGoD wrote:It is a function, else it wouldnt be in the docs.
There is even an example:Example:Code: Select all
waypoint SetShader( "playbook_objective_stop", 15, 15 );
Code: Select all
player.blackscreen setshader("black",640,480);
Code: Select all
t waittill("trigger", player);
you won...againIzNoGoD wrote:I think your credits_trigger is not present (?)
Maybe recheck your map
Also, next time copy paste the line with the * in it too, so you can see where exactly it goes wrong.
Code: Select all
hud.alpha=1;
hud fadeovertime(5);
hud.alpha=0;