Script

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

Moderator: Core Staff

Post Reply
User avatar
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Script

Post by YaNo » August 23rd, 2006, 4:24 pm

Well i tried to script for the first time and it didnt worked, i think just a little bug ='(
Here's what i did :) (for my new map jm_smooth_colour)

jm_smooth_colour.gsc:

Code: Select all

main()
{
	ambientPlay("ambient_mp_carentan");

	maps\mp\_load::main();
	maps\mp\blahsc::main();
	maps\mp\zzblah::main();

	game["allies"] = "american";
	game["axis"] = "german";

	game["american_soldiertype"] = "airborne";
	game["american_soldiervariation"] = "normal";
	game["german_soldiertype"] = "fallschirmjagergrey";
	game["german_soldiervariation"] = "normal";

	game["attackers"] = "allies";
	game["defenders"] = "axis";

}



in blahsc.gsc:

Code: Select all

main() 
{ 
  trigger = getent ("finnish","targetname"); 
  while(1) 
{ 
   trigger waittill ("trigger",user); 
   user iprintlnbold("^7Congratz! You Finnished");
   iprintln ("Congratz to " + user.name + " ^7for finnishing the map!"); 
   wait(1);
   user iprintlnbold("^7You can now kill yourself with a panzer...");
   wait(5); 
} 
}
in zzblah.gsc:

Code: Select all

main() 
{ 
  trigger = getent ("blah_trigger","targetname"); 
  while(1) 
{ 
   trigger waittill ("trigger",user); 
   user iprintlnbold("^7CoDJumper!!");
   iprintln ("Map By YaNo");
   wait(1);
   user iprintlnbold("^7For All Your Jumping Needs!");
   wait(1);
   user iprintlnbold("^7Visit ^1www.codjumper.com^7!");
   wait(5); 
} 
}
can some1 help me?
Last edited by YaNo on August 23rd, 2006, 5:13 pm, edited 1 time in total.

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

Post by Nightmare » August 23rd, 2006, 4:34 pm

what error does it give?
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]

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » August 23rd, 2006, 4:36 pm

Indeed, we need to know what error it gave, and what you are trying to do (describe).

Btw, it's "finishing" not "finnishing" :)
Image
Image

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

Post by Drofder2004 » August 23rd, 2006, 4:37 pm

/developer 1

Type that in console before running your map and then check console for the error.
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
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Post by YaNo » August 23rd, 2006, 4:51 pm

it dont gives an error
when i trigger the zzblah it dont do anything, while the other works :s

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

Post by creator » August 23rd, 2006, 5:09 pm

gsv? isnt it gsc? :P
Cod 1 Mapper&Modder&Moddeler

User avatar
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Post by YaNo » August 23rd, 2006, 5:12 pm

creator wrote:gsv? isnt it gsc? :P
ye lol =P i will edit ma post ^^
but they are all gsc ^^

Pedsdude
Site Admin
Site Admin
Posts: 15914
Joined: October 15th, 2004, 7:18 pm
Location: UK

Post by Pedsdude » August 23rd, 2006, 5:22 pm

I take it it's a trigger_multiple you're using.

Code: Select all

main()
{
thread zzblah();
}

zzblah()
{
  trigger = getent ("blah_trigger","targetname");
  while(1)
{
   trigger waittill ("trigger",user);
   user iprintlnbold("^7CoDJumper!!");
   iprintln ("Map By YaNo");
   wait(1);
   user iprintlnbold("^7For All Your Jumping Needs!");
   wait(1);
   user iprintlnbold("^7Visit ^1www.codjumper.com^7!");
   wait(5);
}
}
Try that, I prefer having it as thread to make life easier if you plan to add more threads to the same .gsc file.

Are you aware that "iprintln ("Map By YaNo");" will make it show "Map By YaNo" to everyone? People might get annoyed if that's spammed to them by people setting off the trigger. I would recommend making it only visible to the user.
Image
Image

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

Post by Drofder2004 » August 23rd, 2006, 5:44 pm

Yeah just noticed, you didnt use thread.

If you do not thread it, then the rest of the script will not run.

Example...

maps\mp\blahsc::main();
maps\mp\zzblah::main();

Your script loads up blahsc::main.
Your main script in that gsc has an infinite loop. So zzblah will be waiting an inifinite amount of time to start.

If you use thread, then both of your threads will run at the same time.
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
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Post by YaNo » August 23rd, 2006, 5:48 pm

well they are both use =D
going to test now

btw, thnx ^^

User avatar
Moriar
CJ Newbie
CJ Newbie
Posts: 88
Joined: March 12th, 2006, 8:15 pm
Location: The Netherlands

Post by Moriar » August 23rd, 2006, 5:55 pm

Yup, the threads :)


And sometimes if your triggers don't work, it could be the map ;) not the script ;)
I had that problem once, couldn't fix it :? I made the triggers both trigger_multiple, but they kept being brushes :shock: I deleted the triggers and replaced them by new triggers several times.....
But that didn't work either...
I still haven't fixed it but gladly it was a testmap :lol:

BTW: If it are the triggers they should be normal brushes, so you can stand on it and jump on it(if it's not too high :lol: )




This doesn't happen many times, but does anyone know why this happens?

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests