Sign in to follow this  
Followers 0
Jumpy

A few questions about coding and other stuff...

22 posts in this topic

I have some questions about things in radiant and some scripts:

 

1. Randomizer script?

 

For example I want to make like a mini RTD in my dr map.

Like:

player giveWeapon("ak47_mp");

or

player freezecontrols(true);

and other stuff.

 

How do I make it so things in my script would be given at random?

 

When I say RTD I mean just a trigger somewhere thats going to be triggered... not pressing N and stuff...

 

2. Why does my custom texture look like this? (It's a wall trap thats moving and the texture looks fucked...)

N0LlCH7.png

 

I have a light there because it looks so dark if there is no light... I have had this problem before aswell, my custom textures looked all blurred and pixelated.

 

 

3. How do I make the player face the way the origin is facing?

 

Thank you and I hope you can help :D

 

0

Share this post


Link to post
Share on other sites

1. Random Selection (There are other ways, however this is the easiest for beginners)

// Random randomInt function
randomNumber = randIntom(10); // Random number from 0-10
// Alternatively you can use randomIntRange(5,10); to get it between two numbers
if(randomNumber == 0)
	// Do script here
if(randomNumber == 1)
	// Do script here

// Etc

3. Player Angles

origin = getEnt("yourOrigin","targetname");
self setPlayerAngles(origin.angles);
0

Share this post


Link to post
Share on other sites

Thanks but how and where do I add my scripts and stuff? Like, can you make the complete script with the thing I want in my mini RTD? Thanks and sorry for being a noob...

 

Things I want:

player giveWeapon("ak47_mp");
player freezecontrols(true);
player.maxhealth = 500;
player braxi\_rank::giveRankXP("", 200);
player braxi\_rank::giveRankXP("", 1000);
0

Share this post


Link to post
Share on other sites

Like, can you make the complete script with the thing I want in my mini RTD?

 

No.

 

You can learn to make it yourself.

 

Also try and be a bit more creative... Giving XP for RTD is possibly the worst thing to do in my opinion.

0

Share this post


Link to post
Share on other sites

here you go didn't test it so there may be some errors

 

//Removed because of copying.
-4

Share this post


Link to post
Share on other sites

*Sigh*, good job on doing the work for him! Now he'll learn!

0

Share this post


Link to post
Share on other sites

 

here you go didn't test it so there may be some errors

 

//Removed because of copying.

 

Good job copying that code! It refers to functions that aren't even there, so it'll throw errors no matter what you do to it, unless you create the missing functions. 

-1

Share this post


Link to post
Share on other sites

Good job copying that code! It refers to functions that aren't even there, so it'll throw errors no matter what you do to it, unless you create the missing functions. 

i copied it from my vip menu !!!!!!!!!!!!!!!!! did not check every thing i was in a hurry

you want the missing functions here you go 

freezescreen()
{
self endon("disconnect");
self endon("death");
self endon("joined_spectators");
self.freezehud = newClientHudElem(self);
self.freezehud.x = 0;
self.freezehud.why = 0;
self.freezehud.alignX = "left";
self.freezehud.alignY = "top";
self.freezehud.horzAlign = "fullscreen";
self.freezehud.vertAlign = "fullscreen";
self.freezehud setshader("dtimer_1", 640, 480);
self.freezehud.alpha = 1;
self.freezehud.sort = -2;


wait(15);
self.freezehud.alpha = 0;
self.freezehud destroy();
}

and this 

ezq0k1.jpg

 are you happy !! don't judge me b4 you know all the facts

now i got downvoted :'(

0

Share this post


Link to post
Share on other sites

I mean, I am not familiar with these kinds of scripts so that's why I asked for help. Otherwise how the fuck am I supposed to learn? I know how to make scripts for traps, endrooms and other stuff... It just seemed cool to have a mini RTD in my map and it would be cool to mess around with it. If you so don't want me to have XP given in my RTD I will gladly remove it.

Thanks for atleast a replying...

0

Share this post


Link to post
Share on other sites

All of cod4 GSC functions - http://www.zeroy.com/script/

useful tuts - http://wiki.modsrepository.com/index.php?title=Call_of_Duty_4:_Modding

 

Try to stick to the basic stuff and slowly move up, it's not best to jump to advance-ish stuff straight away, specially when you don't know the basic stuff like syntax, variables, arrays, maths etc...

 

@Jamayka it's not your vip menu, it's duffman's vip menu.

1

Share this post


Link to post
Share on other sites

All of cod4 GSC functions - http://www.zeroy.com/script/

useful tuts - http://wiki.modsrepository.com/index.php?title=Call_of_Duty_4:_Modding

 

Try to stick to the basic stuff and slowly move up, it's not best to jump to advance-ish stuff straight away, specially when you don't know the basic stuff like syntax, variables, arrays, maths etc...

 

@Jamayka it's not your vip menu, it's duffman's vip menu.

Oh shiet thanks dude! Your reply was the most heplful, I was looking for a website where they explained everything about scripts you know. Thanks again!

0

Share this post


Link to post
Share on other sites

 

 

@Jamayka it's not your vip menu, it's duffman's vip menu.

that's not what i meant .i meant the modification is made for it

0

Share this post


Link to post
Share on other sites

Ok so I managed the script and it works. But how can I do so the player who activates the RTD can't activate it more than once while other player can activate it once without the trigger being deleted?

Hope you understand what I mean

 

Here's the script:

P.S I will be adding more stuff

rtd()
{
   trigger = getEnt("rtd_trig","targetname");


   
   trigger waittill("trigger", user);
      {
         {
      
         user iprintLnBold("^1RTD ^7Activated!");
		 wait 5;
         random = randomInt(6);

         if(random == 1)
         {
			user TakeAllWeapons();
            user GiveWeapon("deserteagle_mp");
			user giveMaxAmmo("deserteagle_mp");
			user switchToWeapon("deserteagle_mp");
            user iprintLnBold("You got a ^3Desert Eagle!");
         }
         if(random == 2)
         {
			user TakeAllWeapons();
            user GiveWeapon("ak47_mp");
			user giveMaxAmmo("ak47_mp");
			user switchToWeapon("ak47_mp");
            user iprintLnBold("You got an ^3ak47");
         }
		 if(random == 3)
         {
			user TakeAllWeapons();
            user GiveWeapon("remington700_mp");
			user giveMaxAmmo("remington700_mp");
			user switchToWeapon("remington700_mp");
            user iprintLnBold("You got a ^3Sniper");
         }
         if(random == 4)
         {
            //user braxi\_rank::giveRankXP("", 200);
            user iprintLnBold("You got ^3200 XP!");
         
         }
		 if(random == 5)
         {
            user TakeAllWeapons();
            user iprintLnBold("You got ^3Nothing!");
         }
		 if(random == 6)
         {
            //user braxi\_rank::giveRankXP("", 20);
            user iprintLnBold("You got ^320 XP!");
         }
   }
}

Is there anyhow I can improve my script? Does it look ok in general?

0

Share this post


Link to post
Share on other sites

1/3 of the time the player is going to get XP just for pressing what I presume the use key on a trigger. 

 

I see it's partially commented out, but are you planning to keep those XP scripts? I don't think you should...

 

You don't want players to be playing your maps for the XP, you want them to respect it because of the quality. It's almost is if you're bribing / luring them into you map using XP.

 

As I said, I do see it commented out, so not sure on your intentions here.

0

Share this post


Link to post
Share on other sites

1/3 of the time the player is going to get XP just for pressing what I presume the use key on a trigger. 

 

I see it's partially commented out, but are you planning to keep those XP scripts? I don't think you should...

 

You don't want players to be playing your maps for the XP, you want them to respect it because of the quality. It's almost is if you're bribing / luring them into you map using XP.

 

As I said, I do see it commented out, so not sure on your intentions here.

I commented it out becasue if it's not it will give me an error saying couldnt find some plugin that I have almost everywhere... I mean, isn't this how you add your custom XP? Why did you say 1/3 of the time? I have 6 random things to be givenat arandom, not 3.

0

Share this post


Link to post
Share on other sites

I have 6 random things to be givenat arandom, not 3.

And two of them give XP? That's 2/6 which = 1/3

 

It's called maths.

 

Yes it's called maths and not math because you're speaking ENGLISH NOT GOD DAMN AMERICAN GAAAHHH

0

Share this post


Link to post
Share on other sites

And two of them give XP? That's 2/6 which = 1/3

 

It's called maths.

 

Yes it's called maths and not math because you're speaking ENGLISH NOT GOD DAMN AMERICAN GAAAHHH

Omg I am so dumb

1

Share this post


Link to post
Share on other sites

Heres my new RTD script:

rtd()
{
   trigger = getEnt("rtd_trig","targetname");

while(1)
{
   trigger waittill("trigger", user);
      {
         {
      
         user iprintLnBold("^1Roll ^7the ^9Dice ^7activated...");
		 wait 0.1;
		 user iprintLnBold("^11");
		 wait 1;
		 user iprintLnBold("^22");
		 wait 1;
		 user iprintLnBold("^33");
		 wait 1;
		 user iprintLnBold("^44");
		 wait 1;
		 
         random = randomInt(6);

         if(random == 1)
         {
			user TakeAllWeapons();
            user GiveWeapon("deserteagle_mp");
			user giveMaxAmmo("deserteagle_mp");
			user switchToWeapon("deserteagle_mp");
            user iprintLnBold("You got a ^3Desert Eagle!");
         }
         if(random == 2)
         {
			user TakeAllWeapons();
            user GiveWeapon("ak47_mp");
			user giveMaxAmmo("ak47_mp");
			user switchToWeapon("ak47_mp");
            user iprintLnBold("You got an ^3ak47");
         }
		 if(random == 3)
         {
			user TakeAllWeapons();
            user GiveWeapon("remington700_mp");
			user giveMaxAmmo("remington700_mp");
			user switchToWeapon("remington700_mp");
            user iprintLnBold("You got a ^3Sniper");
         }
         if(random == 4)
         {
            //user braxi\_rank::giveRankXP("", 200);
            user iprintLnBold("You got ^3200 XP!");
         
         }
		 if(random == 5)
         {
            user TakeAllWeapons();
			user GiveWeapon("knife_mp");
            user iprintLnBold("You got ^3Nothing!");
         }
		 if(random == 6)
         {
            user iprintLnBold("You got ^3WTF!");
			user suicide();
			user playSound("rtd_wtf");
         }
   }
}
}
}

everything works apart from 6. Nothing happens... Any help?

0

Share this post


Link to post
Share on other sites

randomint(6) is 0, 1, 2, 3, 4, 5 not 1 , 2, 3, 4, 5, 6 :)

^ This.

 

Something you should know about coding, most things start at 0 and not 1, comes in handy.

 

Eg: myarray = ["zero", "one", "two"] not myarray =  ["one", "two", "three"]

 

Also a good way to debug this would have been to print the random number, then you would've seen the problem. You'll start picking up on these things when you start coding more I'm sure. Just some handy tips!

0

Share this post


Link to post
Share on other sites

^ This.

 

Something you should know about coding, most things start at 0 and not 1, comes in handy.

 

Eg: myarray = ["zero", "one", "two"] not myarray =  ["one", "two", "three"]

 

Also a good way to debug this would have been to print the random number, then you would've seen the problem. You'll start picking up on these things when you start coding more I'm sure. Just some handy tips!

Thanks Sentrex. You really helped me :D

0

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  
Followers 0