Page 1 of 1

Trigger detecting play problem?

Posted: July 11th, 2011, 3:32 pm
by Reality
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;
                }
        }
}

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 3:51 pm
by Rich
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

Code: Select all

player iprintlnbold("TESTING");
before the if to see if its working before it checks if your admin.

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 3:54 pm
by Nekoneko
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.

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 3:56 pm
by Reality
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

Code: Select all

player iprintlnbold("TESTING");
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?

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 4:41 pm
by IzNoGoD
then player.admin is not defined.
Remember, cod doesnt define any by itself. You have to script everything.

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 6:25 pm
by Drofder2004
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.

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 6:41 pm
by F |Madness| U
Cool way of testing things, I may have to use that. What is with the /n before and after the string though?

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 6:49 pm
by Drofder2004
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).

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 7:17 pm
by F |Madness| U
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.

Re: Trigger detecting play problem?

Posted: July 11th, 2011, 8:12 pm
by Drofder2004
I would assume hardcoded.