no save + kill script

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

Moderator: Core Staff

Post Reply
pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

no save + kill script

Post by pcbouncer » May 28th, 2013, 12:13 am

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?

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: no save + kill script

Post by megazor » May 28th, 2013, 3:34 am

If something isn't working, you should try and debug it. iPrintLnBold() is one of the best ways to do it.

User avatar
Jewel
CJ Wannabe
CJ Wannabe
Posts: 34
Joined: November 8th, 2012, 8:15 pm
Gamertag: Original Lithy
Location: France

Re: no save + kill script

Post by Jewel » May 28th, 2013, 12:10 pm

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;
        }
}


pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 28th, 2013, 8:39 pm

what is defloration?

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 28th, 2013, 8:56 pm

thanks alot! i dont understand some things though, like defloration and some other things

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 28th, 2013, 10:03 pm

it only works with a single trigger, not combined script_brushmodels

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 28th, 2013, 10:56 pm

it doesnt work at all actuallly..

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

Re: no save + kill script

Post by Drofder2004 » May 29th, 2013, 10:45 pm

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.
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

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 30th, 2013, 10:52 am

okay thanks :) but can you explain what defloration is?

megazor
CJ Worshipper
CJ Worshipper
Posts: 414
Joined: July 22nd, 2009, 3:02 am
Location: Russia, Vladivostok

Re: no save + kill script

Post by megazor » May 30th, 2013, 1:07 pm

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.

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

Re: no save + kill script

Post by Drofder2004 » May 30th, 2013, 7:39 pm

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.
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

pcbouncer
CJ Fan
CJ Fan
Posts: 114
Joined: November 27th, 2012, 10:49 pm

Re: no save + kill script

Post by pcbouncer » May 30th, 2013, 8:52 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests