Page 1 of 3

help with script :)

Posted: June 13th, 2011, 8:12 am
by Goro92
can someone tell me how dantheman did the credits in portal and sonic at the end of the map?is it easy?

Re: help with script :)

Posted: June 13th, 2011, 11:18 am
by Drofder2004
Not sure what they look like, but I assume black screen and scrolling hud.
Although he will the only one who confirm.

Re: help with script :)

Posted: June 13th, 2011, 11:54 am
by Goro92
Drofder2004 wrote:Not sure what they look like, but I assume black screen and scrolling hud.
Although he will the only one who confirm.
thx but how to put a black screen? :(

Re: help with script :)

Posted: June 13th, 2011, 12:35 pm
by IzNoGoD
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.

Re: help with script :)

Posted: June 13th, 2011, 1:30 pm
by Goro92
IzNoGoD 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.
i tried this...i'm not good with scripts..need help

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 ...";
      
   }




}}


and I was wondering how to put images...you also know that true?:D

I NEED HELPPPPPPPP :P

Re: help with script :)

Posted: June 13th, 2011, 5:49 pm
by IzNoGoD
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

Re: help with script :)

Posted: June 13th, 2011, 9:33 pm
by Goro92
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();
     
   }
 
}}

I think i fixed something...but still no work :(

iznogod tell me what's missing now pls

Re: help with script :)

Posted: June 13th, 2011, 11:17 pm
by F |Madness| U
Turn developer mode on then run the script, and it will point you in the direction of where your code is wrong.

Re: help with script :)

Posted: June 14th, 2011, 12:20 am
by Rezil

Code: Select all

player.blackscreen.setshader=("black",640,480);
This line is wrong. Read the documentation as to why.

Re: help with script :)

Posted: June 14th, 2011, 7:47 am
by Goro92
Rezil wrote:

Code: Select all

player.blackscreen.setshader=("black",640,480);
This line is wrong. Read the documentation as to why.

i read this http://rgnwiki.com/index.php/Call_of_Du ... :SetShader

so it is without the point? or it's something else?

Code: Select all

player.blackscreen setshader=("black",640,480);
i tried it but still get me error

Re: help with script :)

Posted: June 14th, 2011, 7:57 am
by IzNoGoD
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 );

Re: help with script :)

Posted: June 14th, 2011, 8:05 am
by Goro92
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);
thx :D

but now i've an other problem: undefined is not an object...line 19

Code: Select all

t waittill("trigger", player);

Re: help with script :)

Posted: June 14th, 2011, 8:27 am
by IzNoGoD
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.

Re: help with script :)

Posted: June 14th, 2011, 9:06 am
by Goro92
IzNoGoD 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.
you won...again :D

very very thank you!now it works!


only one other thing..u told me about scrolling text/hud?
what it is the command to use?

Re: help with script :)

Posted: June 14th, 2011, 10:47 am
by IzNoGoD
Try moveovertime()
Also: scaleovertime() and fadeovertime() for other effects.

For fadeovertime (and most likely scaleovertime/moveovertime too) you have to define a value BEFORE calling the function and a value directly after. Like:

Code: Select all

hud.alpha=1;
hud fadeovertime(5);
hud.alpha=0;
This code will make the text fade away after 5 seconds. It will not introduce any waits though, so if you want to do another fadeovertime AFTER this, you will have to write a wait 5; yourself.