Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!
Moderator: Core Staff
-
Reality
- CJ Newbie
- Posts: 51
- Joined: May 3rd, 2011, 9:57 pm
Post
by Reality » July 11th, 2011, 3:32 pm
Okay so i have a trigger for admin only teleport and for some reason it doesnt detect the player.. it may be a script problem? could some please correct my GSC;
Code: Select all
 main()
{
    //maps\mp\mp_levels_fx::main();
    //maps\createart\mp_levels_art::main();
    maps\mp\_load::main();
    //maps\mp\mp_levels_struct::main();  Â
    maps\mp\_teleport::main();
Â
    //maps\mp\_compass::setupMiniMap("compass_map_mp_backlot");
Â
    //setExpFog(500, 2200, 0.81, 0.75, 0.63, 0);
    //VisionSetNaked( "mp_levels" );
    ambientPlay("ambient_explicit_ext");
Â
    game["allies"] = "marines";
    game["axis"] = "opfor";
    game["attackers"] = "axis";
    game["defenders"] = "allies";
    game["allies_soldiertype"] = "desert";
    game["axis_soldiertype"] = "desert";
Â
    setdvar( "r_specularcolorscale", "1" );
Â
    setdvar("r_glowbloomintensity0",".25");
    setdvar("r_glowbloomintensity1",".25");
    setdvar("r_glowskybleedintensity0",".3");
    setdvar("compassmaxrange","1800");
Â
    thread quake();
    thread kill();
    thread playerjoin();
    thread teleporter();
Â
}
Â
Â
Â
quake()
Â
{
trigger = getent("earthquake","targetname"); // this finds the entity you created (the trigger)
quake = getent("quake","targetname"); Â Â Â // this finds the entity you created (the origin named Â
Â
quke)
sound = getent("sound","targetname"); Â Â Â // this finds the entity you created (the origin named Â
Â
sound)
while (1)
Â
  {
  trigger waittill ("trigger",user);
  wait 1;
  iprintlnbold( "^1ROTANT ^7HAS AWAKEN^1!!!!");   //prints inbold "EAARRTHHHQUUAAKKE!!!" to all
Â
the users  on the map, feel free to change the text :)
  sound PlaySound( "elm_quake_sub_rumble");  //plays the sound of an earthquake at the origin Â
Â
"sound"
  Earthquake( 0.7, 8, quake.origin, 10000 ); // (magnitude of the earthquake, length, at what origin, Â
Â
and the radius) these values can be changed apart from the origin
  wait 2;
  }
}
Â
Â
Â
kill()
Â
{
trigger = getent( "Deathtrigger","targetname" );
while (1)
 Â
  {
  trigger waittill ("trigger",player);
  if(player isTouching(trigger) )
  {
  player suicide();
  }
}
}
Â
Â
Â
teleporter()
Â
{
teleporttrigger = getent( "admin","targetname" );
while (1)
 Â
  {
  teleporttrigger waittill ("trigger",player);
  if(player isTouching(teleporttrigger) && isdefined(player.admin) )
  {
    player setOrigin((0, 1424, 128));
    player iprintlnbold("TESTING");
    }
  }
}
Â
Â
Â
playerjoin()
{
    for(;;)
    {
        level waittill( "connected", player );
       Â
        if(player getGuid() == "9ac3810f8e8e73bfb79e5a322ad66b4f")
        {
            player.admin = 1;
        }
    }
}
-
Rich
- CJ Wannabe
- Posts: 18
- Joined: October 24th, 2010, 11:52 pm
Post
by Rich » July 11th, 2011, 3:51 pm
you need to test it on a server and not local as you don't have a guid if its local. you can try puting the
before the if to see if its working before it checks if your admin.
-
Nekoneko
- CJ Fan
- Posts: 170
- Joined: April 18th, 2011, 3:48 pm
Post
by Nekoneko » July 11th, 2011, 3:54 pm
What is your problem exactly.
Is it some error, or does it just not work.
And to whoever started that player istouching(trigger), it's totally meaningless.
Also, maybe the player.admin isn't defined, since you probably started it on lan, where getguid won't work.
-
Reality
- CJ Newbie
- Posts: 51
- Joined: May 3rd, 2011, 9:57 pm
Post
by Reality » July 11th, 2011, 3:56 pm
Rich wrote:you need to test it on a server and not local as you don't have a guid if its local. you can try puting the
before the if to see if its working before it checks if your admin.
Okay it detects the player fine because TESTING comes up but it doesnt teleport me?
-
IzNoGoD
- CJ Worshipper
- Posts: 343
- Joined: January 6th, 2009, 8:39 pm
- Location: Netherlands/Holland
Post
by IzNoGoD » July 11th, 2011, 4:41 pm
then player.admin is not defined.
Remember, cod doesnt define any by itself. You have to script everything.
LMGTFY!
Its not a glitch... Its the future!
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » July 11th, 2011, 6:25 pm
GUID is not assigned during local testing. You must test this on a real server for it to work.
A good way to test things which I prefer to use, is an error dvar.
Code: Select all
playerjoin()
{
for(;;)
{
level waittill( "connected", player );
if(player getGuid() == "9ac3810f8e8e73bfb79e5a322ad66b4f")
{
player.admin = 1;
setDvar("myError", ("\nGUID: " + player getGUID() + " was given admin\n"));
}
else
{
setDvar("myError", ("\nGUID: " + player getGUID() + " is not admin\n"));
}
}
}
Then once you have loaded up the game, just type "/myError" in console and you will get the results.
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
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » July 11th, 2011, 6:41 pm
Cool way of testing things, I may have to use that. What is with the /n before and after the string though?
-
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » July 11th, 2011, 6:49 pm
F |Madness| U wrote:Cool way of testing things, I may have to use that. What is with the /n before and after the string though?
Creates a new line, makes it easier to read when using full sized console.
Code: Select all
setErr(err)
{
    setDvar("cj_errors", (getDvar("cj_errors") + "\n" + err));
}
That is the codjumper error log.
Just call "setErr(string)" and it will just add it on to the list of errors.
"/clear;cj_errors" in console, will provide a clean console with just the errors (got that bound when coding).
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
-
F |Madness| U
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Post
by F |Madness| U » July 11th, 2011, 7:17 pm
Ah very nice, thanks. Kind of on topic..about new lines..in CoD4 when you use iprintlnbold(), the message appears in the middle of your screen, and lasts around 5 seconds or so (rough guess). Now if 2 more iprintlnbold()'s are printed on your screen before the first one has disappeared, it kind of shifts them up, and so you can see all 3 on your screen at once. (Until the first disappears, then second and third).
In Black Ops however, if a second iprintlnbold is printed on the screen whilst the first one is still present, the first one immediately disappears and the second one takes its place. This is really annoying, and I was wondering is there anyway to change the settings of iprintlnbold() function, or are they `hardcoded in`. I can't see why they would have changed it to how it is as it's just inpractical.
-
-
Drofder2004
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Post
by Drofder2004 » July 11th, 2011, 8:12 pm
I would assume hardcoded.
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
Users browsing this forum: No registered users and 36 guests