x


Score script problems

I got this script from activeden.net but I have no idea on how to to make it give me more than 1 score? can someone please just take a look and tell me what I need to change so it can give me more than 1 score?

Score Script Here

more ▼

asked Oct 02, 2011 at 09:12 AM

svettgunnar gravatar image

svettgunnar
16 49 38 41

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

There is a line which reads

 score++;

instead replace that entire function with:

 function scoreMany (points : int)
 {
     score += points
 }

then, when you are calling the score function, call it with

 scoreMany(howeverManyPointsToScore);
more ▼

answered Oct 02, 2011 at 09:26 AM

syclamoth gravatar image

syclamoth
18.4k 20 28 118

I'm a total noobie, you couldn't copy what I wrote and fix it?

Oct 02, 2011 at 10:03 AM svettgunnar

Isn't it much more convenient to actually know scripting yourself if you're programming? ;-) If you're struggling with the very basics of coding then read through the scripting references, go through tutorials within the area you find yourself having issues with. It's a winning situation for you.

Oct 02, 2011 at 10:16 AM save

Alright, I figured it out by myself but I got another problem now, it's says I got no reciver...

Oct 02, 2011 at 11:04 AM svettgunnar

Are you using SendMessage for anything? Make sure you spelled everything right, and are giving the correct paramaters.

Oct 02, 2011 at 12:10 PM syclamoth

yes, I'm using sendMessage:

function OnControllerColliderHit (hit : ControllerColliderHit )

{

 // make sure that we have a reference to the game controller, to tell about the pickup

 if(null==tellWho)

     tellWho=GameObject.Find("gameController");

 

 // check to see if the object we hit is on layer 8, which is the 'pickup' layer

 if(hit.gameObject.layer==8){

     // tell our game controller to increase our score

     tellWho.SendMessage("scoreOne");

     // delete the pickup object completely from the game scene

     Destroy(hit.gameObject);

 }

 

// Debug.DrawRay(hit.point, hit.normal);

 if (hit.moveDirection.y > 0.01) 

     return;

}

Oct 02, 2011 at 01:54 PM svettgunnar
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x4913
x500
x124
x73
x11

asked: Oct 02, 2011 at 09:12 AM

Seen: 1261 times

Last Updated: Oct 02, 2011 at 02:45 PM