Point System

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

Moderator: Core Staff

Post Reply
User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Point System

Post by Nightmare » October 2nd, 2006, 1:25 am

Hey drof, got a script which can display points in the top left, and when you enter a trigger multiple, the script will add a point a second to the points in the top left hand corner, I am making a lazer tag and I need it to be able to work with two teams.

So basically: two bases, entering it adds points.

Thanks :)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » October 2nd, 2006, 3:55 pm

just made a small script, propoble not the best but i think it will work (i havent learned a other methode of waittill trigger so i made them between them [works fine] o and i only made it for 10 points but i think u get the point of it

Code: Select all

main()
{
thread team_1();
thread team_2();
}

team_1()
{
point1_1 = getent("point1","targetname");
point2_1 = getent("point2","targetname");
point3_1 = getent("point3","targetname");
point4_1 = getent("point4","targetname");
point5_1 = getent("point5","targetname");
point6_1 = getent("point6","targetname");
point7_1 = getent("point7","targetname");
point8_1 = getent("point8","targetname");
point9_1 = getent("point9","targetname");
point10_1 = getent("point10","targetname");
trig_point_team1 = getent("trig_point_team1","targetname");

while(1)
{
trig_point_team1 waittill ("trigger",user);
point1_1 show();
point2_1 hide();
point3_1 hide();
point4_1 hide();
point5_1 hide();
point6_1 hide();
point7_1 hide();
point8_1 hide();
point9_1 hide();
point10_1 hide();
trig_point_team1 waittill ("trigger",user);
point1_1 hide();
point2_1 show();
trig_point_team1 waittill ("trigger",user);
point2_1 hide();
point3_1 show();
trig_point_team1 waittill ("trigger",user);
point3_1 hide();
point4_1 show();
trig_point_team1 waittill ("trigger",user);
point4_1 hide();
point5_1 show();
trig_point_team1 waittill ("trigger",user);
point5_1 hide();
point6_1 show();
trig_point_team1 waittill ("trigger",user);
point6_1 hide();
point7_1 show();
trig_point_team1 waittill ("trigger",user);
point8_1 hide();
point9_1 show();
trig_point_team1 waittill ("trigger",user);
point9_1 hide();
point10_1 show();
trig_point_team1 waittill ("trigger",user);
point10_1 hide();
}
}

team_1()
{
point1_2 = getent("point1","targetname");
point2_2 = getent("point2","targetname");
point3_2 = getent("point3","targetname");
point4_2 = getent("point4","targetname");
point5_2 = getent("point5","targetname");
point6_2 = getent("point6","targetname");
point7_2 = getent("point7","targetname");
point8_2 = getent("point8","targetname");
point9_2 = getent("point9","targetname");
point10_2 = getent("point10","targetname");
trig_point_team2 = getent("trig_point_team2","targetname");

while(1)
{
trig_point_team2 waittill ("trigger",user);
point1_2 show();
point2_2 hide();
point3_2 hide();
point4_2 hide();
point5_2 hide();
point6_2 hide();
point7_2 hide();
point8_2 hide();
point9_2 hide();
point10_2 hide();
trig_point_team2 waittill ("trigger",user);
point1_2 hide();
point2_2 show();
trig_point_team2 waittill ("trigger",user);
point2_2 hide();
point3_2 show();
trig_point_team2 waittill ("trigger",user);
point3_2 hide();
point4_2 show();
trig_point_team2 waittill ("trigger",user);
point4_2 hide();
point5_2 show();
trig_point_team2 waittill ("trigger",user);
point5_2 hide();
point6_2 show();
trig_point_team2 waittill ("trigger",user);
point6_2 hide();
point7_2 show();
trig_point_team2 waittill ("trigger",user);
point8_2 hide();
point9_2 show();
trig_point_team2 waittill ("trigger",user);
point9_2 hide();
point10_2 show();
trig_point_team2 waittill ("trigger",user);
point10_2 hide();
}
}
just make the numbers where u want and make them 1 by 1 brushmodel and then place them on each other, give them the targetnames that are in the script and compile add the script and test it
i havent had time to test it so.. test it :P
i hope this is what u wanted lol took me 10 mins to make it

creator.
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » October 2nd, 2006, 6:47 pm

wtf ^

I think you misread something creator...

What you need to do is start by creating a new hud for each player.

So lets run a script check if a player has their hud...

Code: Select all

_checkHud()
{
while(1)
{
   players = getEntArray("player","classname");

   for(i=0;i<players.size;i++)
   {
      if(!isDefined(players[i].trigscore))
         players[i].trigscore = 0;

      if(!isDefined(players[i].scorehud))
         players[i] thread _createHud();
   }

   wait 0.5;

}
}
that will check the players to see if they have a hud or not (this is so if players joiun half way through).

Now we must create the hud if it doesn't exist...

Code: Select all

_createHud()
{
   self.scorehud = newClientHudElem(self);
   self.scorehud.alignX = "center";
   self.scorehud.alignY = "middle";
   self.scorehud.x = 320;
   self.scorehud.y = 70;
   self.scorehud.archived = false;
   self.scorehud setValue(self.trigscore);
}
Ok, thats the HUD, you will have to adjust the x/y values to get the correct positioning.
At the end of the thread, I have threaded another function, this one will check the score constantly...

Now you need a function that adds to the score...

Code: Select all

_updateScore(points)
{
   if(!isDefined(self) || !isDefined(self.trigscore) || !isDefined(self.scorehud))
      break;

   self.trigscore+=points;
   self.scorehud setValue(self.trigscore);
}
Now, all you have to do is check the trigger...

Code: Select all

while(1)
{
trig waittill("trigger", other);
other thread _updateScore(1);
}
Look for mistakes as this is mostly written off the top of my head...
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
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » October 2nd, 2006, 8:26 pm

ok, I dont get anything 0_O alitle more explanation would be nice :)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

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

Post by Drofder2004 » October 2nd, 2006, 8:50 pm

try the code for yourself and see...

all YOU have to do is thread the first code I put from the main() and put the last code in another function and thread that from main also...
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » November 5th, 2006, 2:18 pm

how can i make a hud (server not for a map) with in like: Gravity settings. and when u change gravity it also changes
Cod 1 Mapper&Modder&Moddeler

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest