Page 1 of 1

no save + kill script

Posted: May 28th, 2013, 12:13 am
by pcbouncer
ive tried making a kill script but it does not work - here it is:

room1trigger(){
thread killplayer();
trigger = getent("room1trig","targetname");
door = getent("door1","targetname");

exit = getent("room1exit","targetname");

kill = getent("room1kill","targetname");

while(true){
trigger waittill ("trigger", user );

door moveZ(150, 5, 3, 2);

exit moveZ(60, 10, 6, 4);

wait 10;

door moveZ(-150, 5, 3, 2);

exit moveZ(-60, 10, 6, 4);

wait 10;

}

}

killplayer(){
exit = getent("room1exit","targetname");
kill = getent("room1kill","targetname");
kill enablelinkto();
kill linkto (exit);

while(true){
kill waittill("trigger", user);
players = getEntArray("player", "classname");
for(i=0;i<players.size;i++){
if(players IsTouching(exit) ){
players suicide();
}
}
}
}



alos how would i go about making a no save script or area?

Re: no save + kill script

Posted: May 28th, 2013, 3:34 am
by megazor
If something isn't working, you should try and debug it. iPrintLnBold() is one of the best ways to do it.

Re: no save + kill script

Posted: May 28th, 2013, 12:10 pm
by Jewel
No save script :

Code: Select all

main()
{
        level.trig_stopsave=getent("nosave","targetname");   //the only brushmodel out of the 'no draw not solid' texture
        level thread cunt();
}

cunt()
{
        while(-1111111111111111111111111111111)
        {
   wait 0;   //hopefully this will work. so the rest of the loop will run after the player may have saved their position. so it will be overriden within the same frame, not in .05 second.
   players = getEntArray("player", "classname");
   
   for (i = 0; i < players.size; i++)
   {
                     if (players[i].sessionstate != "playing")
         continue;
      if (!players[i] isTouching(level.trig_stopsave))
      {
         if (isDefined(players[i].defloration))
            players[i].defloration = undefined;
         continue;
      }

      if (!isDefined(players[i].defloration))
         for (a = 1; a < 4; a++)
         {
            players[i].defloration = 1;
            players[i].cj["save_backup"]["org"+a]=players[i].cj["save"]["org"+a];
            players[i].cj["save_backup"]["ang"+a]=players[i].cj["save"]["ang"+a];
         }
      else
         for (a = 1; a < 4; a++)
            if (players[i].cj["save"]["org"+a] != players[i].cj["save_backup"]["org"+a])
            {
               players[i].cj["save"]["org"+a] = players[i].cj["save_backup"]["org"+a];
               players[i].cj["save"]["ang"+a] = players[i].cj["save_backup"]["ang"+a];
            }

            }
        wait .05;
        }
}


Re: no save + kill script

Posted: May 28th, 2013, 8:39 pm
by pcbouncer
what is defloration?

Re: no save + kill script

Posted: May 28th, 2013, 8:56 pm
by pcbouncer
thanks alot! i dont understand some things though, like defloration and some other things

Re: no save + kill script

Posted: May 28th, 2013, 10:03 pm
by pcbouncer
it only works with a single trigger, not combined script_brushmodels

Re: no save + kill script

Posted: May 28th, 2013, 10:56 pm
by pcbouncer
it doesnt work at all actuallly..

Re: no save + kill script

Posted: May 29th, 2013, 10:45 pm
by Drofder2004
No save zones are a built in feature to the CJ mod (3.12b).
viewtopic.php?f=29&t=14623&p=163011

Just set up the brush and the mod will do the rest.

As for your script, like Megazor said, enter some "else" and "iprintln" calls to your if statements and check to see what is going on.
Make sure you are using /developer 1 and if you have an error, post it.

Re: no save + kill script

Posted: May 30th, 2013, 10:52 am
by pcbouncer
okay thanks :) but can you explain what defloration is?

Re: no save + kill script

Posted: May 30th, 2013, 1:07 pm
by megazor
It is what you will experience some day.

Anyway, why didn't you ask what cunt() or while(-1111111111111111111111111111111) was for?

Ok, I'll explain.

At first, player.defloration is undefined.

Once the player has touched the no save entity, player.defloration becomes 1 (getting defined), plus the position of the player is backed up. From then, if the player is still in the no save zone, their saved positions are forced to the backed up ones. Once the player has left the no save zone, player.defloration gets undefined, and you can read my explanation again.

Re: no save + kill script

Posted: May 30th, 2013, 7:39 pm
by Drofder2004
Just to make sure you fully understand, the use of the terms "defloration" and "cunt" are not standard within CoDScript :P

Also, stop asking what defloration is, your parents should be explaining the birds and the bees, not CoDJumper.

Re: no save + kill script

Posted: May 30th, 2013, 8:52 pm
by pcbouncer
i just wanted to make sure it wasnt an object variable :c, thanks for the explanation mega, it makes sense; i only know javascript, this stuff is pretty alienated to me.. im getting more accustomed to it