help with script :)

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

help with script :)

Post by Goro92 » 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?
Image

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13315
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: help with script :)

Post by Drofder2004 » June 13th, 2011, 11:18 am

Not sure what they look like, but I assume black screen and scrolling hud.
Although he will the only one who confirm.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 13th, 2011, 11:54 am

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? :(
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script :)

Post by IzNoGoD » June 13th, 2011, 12:35 pm

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.
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 13th, 2011, 1:30 pm

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
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script :)

Post by IzNoGoD » June 13th, 2011, 5:49 pm

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
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 13th, 2011, 9:33 pm

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
Last edited by Goro92 on June 14th, 2011, 8:13 am, edited 1 time in total.
Image

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: help with script :)

Post by F |Madness| U » June 13th, 2011, 11:17 pm

Turn developer mode on then run the script, and it will point you in the direction of where your code is wrong.
-

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: help with script :)

Post by Rezil » June 14th, 2011, 12:20 am

Code: Select all

player.blackscreen.setshader=("black",640,480);
This line is wrong. Read the documentation as to why.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 14th, 2011, 7:47 am

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
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script :)

Post by IzNoGoD » June 14th, 2011, 7:57 am

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 );
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 14th, 2011, 8:05 am

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);
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script :)

Post by IzNoGoD » June 14th, 2011, 8:27 am

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.
LMGTFY!

Its not a glitch... Its the future!

User avatar
Goro92
CJ Spammer!
CJ Spammer!
Posts: 605
Joined: March 7th, 2011, 5:54 pm
Location: Brescia, Italy

Re: help with script :)

Post by Goro92 » June 14th, 2011, 9:06 am

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?
Image

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: help with script :)

Post by IzNoGoD » June 14th, 2011, 10:47 am

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.
LMGTFY!

Its not a glitch... Its the future!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest