Zone where players can not save.
Moderator: Core Staff
Zone where players can not save.
Is is possible to make a zone on a map where players can't save ? ;s
And if it it , then how ?
And if it it , then how ?
Re: Zone where players can not save.
Make the whole floor (or where ever a player can stand) into a trigger_multiple, with targetname "nosave".
Im not sure, but i think this removes the loading of positions too...
Then, add this script (the notify in here goes for cod2, not sure about cod4...)
This code is not working, as i dont have access to the codjumper source code. Drofder might be able to help with the correct therads/notifies.
Im not sure, but i think this removes the loading of positions too...
Then, add this script (the notify in here goes for cod2, not sure about cod4...)
Code: Select all
 main()
{
    level.trig_stopsave=getent("nosave","targetname");
    level thread waitforconnect();
}
Â
waitforconnect()
{
    while(true)
    {
        level waittill("connecting",player);
        player thread waitforspawn();
    }
}
Â
waitforspawn()
{
    self endon("disconnect");
    self.saving=true;
    while(true)
    {
        self waittill("spawned");
Â
        self thread onspawn();
    }
}
Â
onspawn()
{
    self endon("disconnect");
    self endon("spawned");
    if(!self.saving)
        self notify("end_saveposition_threads"); //plz change this to the correct notify
    while(true)
    {
        if(isdefined(self.sessionstate)&&self.sessionstate=="playing")
        {
            if(self.saving&&self istouching(level.trig_stopsave))
            {
                self.saving=false;
                self notify("end_saveposition_threads"); //change this too
            }
            else if(!self.saving&&!self istouching(level.trig_stopsave)&&self isonground())
            {
                self.saving=true;
                self thread maps\mp\cj::monitorsaveload(); //im pretty sure this is not the correct thread.. drof?
            }
        }
        wait 0.05;
    }
}
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
This method will simply not work for CoD4, there are no save/load terminating notify commands (other than stock) and the load/save can be done through menu response (removing the need for melee).
The easiest method would be to do one of the following things:
1. Checkpoint
When you enter a no-save area, you are assigned a checkpoint as your savepoint. Problems being, you will have to set all 3 saves to the same point.
2. Memory
When entering a save point, you store a temp value of the old save point and you continue to spam this into the players save variable until they leave the point.
Number two is a mroe user friendly option and number one is more server friendly.
If I ever update the mod, I will add easy support for this, but it will not be any time soon.
Variables you may need:
self.cj["save"]["org1"]
self.cj["save"]["ang1"]
self.cj["save"]["org2"]
self.cj["save"]["ang2"]
self.cj["save"]["org3"]
self.cj["save"]["ang3"]
The easiest method would be to do one of the following things:
1. Checkpoint
When you enter a no-save area, you are assigned a checkpoint as your savepoint. Problems being, you will have to set all 3 saves to the same point.
2. Memory
When entering a save point, you store a temp value of the old save point and you continue to spam this into the players save variable until they leave the point.
Number two is a mroe user friendly option and number one is more server friendly.
If I ever update the mod, I will add easy support for this, but it will not be any time soon.
Variables you may need:
self.cj["save"]["org1"]
self.cj["save"]["ang1"]
self.cj["save"]["org2"]
self.cj["save"]["ang2"]
self.cj["save"]["org3"]
self.cj["save"]["ang3"]
![Image](http://www.pingtest.net/result/43108009.png)
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
Re: Zone where players can not save.
Option 2 ftw
Code: Select all
 main()
{
    level.trig_stopsave=getent("nosave","targetname");
    level thread waitforconnect();
}
Â
waitforconnect()
{
    while(true)
    {
        level waittill("connecting",player);
        player thread waitforspawn();
    }
}
Â
waitforspawn()
{
    self endon("disconnect");
    self.spamming=false;
    while(true)
    {
        self waittill("spawned_player");
        self thread onspawn();
    }
}
Â
onspawn()
{
    self endon("disconnect");
    self endon("spawned_player");
    while(true)
    {
        if(isdefined(self.sessionstate)&&self.sessionstate=="playing")
        {
            if(!self.spamming&&self istouching(level.trig_stopsave))
            {
                self.cj["save_backup"]["org1"]=self.cj["save"]["org1"];
                self.cj["save_backup"]["org2"]=self.cj["save"]["org2"];
                self.cj["save_backup"]["org3"]=self.cj["save"]["org3"];
                self.cj["save_backup"]["ang1"]=self.cj["save"]["ang1"];
                self.cj["save_backup"]["ang2"]=self.cj["save"]["ang2"];
                self.cj["save_backup"]["ang3"]=self.cj["save"]["ang3"];
                self.spamming=true;
                self thread spamsaves();
            }
            else if(!self.spamming&&!self istouching(level.trig_stopsave)&&self isonground())
            {
                self.spamming=false;
                self notify("stop_spamming_saves");
            }
        }
        wait 0.05;
    }
}
Â
spamsaves()
{
    self endon("disconnect");
    self endon("stop_spamming_saves");
    while(true)
    {
        self.cj["save"]["org1"]=self.cj["save_backup"]["org1"];
        self.cj["save"]["org2"]=self.cj["save_backup"]["org2"];
        self.cj["save"]["org3"]=self.cj["save_backup"]["org3"];
        self.cj["save"]["ang1"]=self.cj["save_backup"]["ang1"];
        self.cj["save"]["ang2"]=self.cj["save_backup"]["ang2"];
        self.cj["save"]["ang3"]=self.cj["save_backup"]["ang3"];
        wait 0.05;
    }
}
Last edited by Drofder2004 on June 20th, 2011, 8:27 pm, edited 2 times in total.
Reason: Change 'Notify' for CoD4
Reason: Change 'Notify' for CoD4
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
Fixed the notify for CoD4 usage.
Also, might be worth tweaking for an array of no save areas.
Also, might be worth tweaking for an array of no save areas.
![Image](http://www.pingtest.net/result/43108009.png)
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
Re: Zone where players can not save.
Although im not very familiar with mapping, i guess trigger_multiple already does this?Drofder2004 wrote:Fixed the notify for CoD4 usage.
Also, might be worth tweaking for an array of no save areas.
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
trigger_multiple is just a trigger that detects an entity. I would figure "multiple" has lost its original meaning, ut has nothing to do with allowing multiples.IzNoGoD wrote:Although im not very familiar with mapping, i guess trigger_multiple already does this?Drofder2004 wrote:Fixed the notify for CoD4 usage.
Also, might be worth tweaking for an array of no save areas.
Each individual trigger_multiple is considered an entity.
![Image](http://www.pingtest.net/result/43108009.png)
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
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
Not quite. It would be a lot more effective to make a thread per zone and then when entering the zone a thread on that player, instead of a thread per person with multiple loops.
![Image](http://www.pingtest.net/result/43108009.png)
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
Re: Zone where players can not save.
That is a bit of a problem, because then it can be glitched.
Triggers only allow one player to activate them, and once activated by said player, they cannot be activated by another player.
istouching() removes this disability, and allows multiple players to "touch" a trigger, but it increases the serverload a bit.
Triggers only allow one player to activate them, and once activated by said player, they cannot be activated by another player.
istouching() removes this disability, and allows multiple players to "touch" a trigger, but it increases the serverload a bit.
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
If you use "istouching" then you also no longer need a trigger, a "script_brushmodel" with an invisible texture set to non-coliding.IzNoGoD wrote:istouching() removes this disability, and allows multiple players to "touch" a trigger, but it increases the serverload a bit.
And if you can use a script_brushmodel, you can then avoid using an array, because you select all the brushes and make them one entire brushmodel...
Requires testing I feel, but in theory, this method would be incredibly more resourceful than triggers and loops.
![Image](http://www.pingtest.net/result/43108009.png)
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
-
- Core Staff
- Posts: 13313
- Joined: April 13th, 2005, 8:22 pm
- Location: UK, London
Re: Zone where players can not save.
Double posting to correct myself!
Infact, I proved a long time ago, that a trigger mutliple infact triggers on ALL entities within the trigger, not just one!
http://www.megavideo.com/?v=9NPPNNC8
Test = Drop 30 'bots' onto a trigger multiple and see if they all get a thread given to the, and quite clearly, they do![Smile :)](./images/smilies/icon_smile.gif)
Infact, I proved a long time ago, that a trigger mutliple infact triggers on ALL entities within the trigger, not just one!
http://www.megavideo.com/?v=9NPPNNC8
Test = Drop 30 'bots' onto a trigger multiple and see if they all get a thread given to the, and quite clearly, they do
![Smile :)](./images/smilies/icon_smile.gif)
![Image](http://www.pingtest.net/result/43108009.png)
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
Re: Zone where players can not save.
try this:
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: Zone where players can not save.
Thanks guys for helping me
.
Megazor's script works just like i wanted , thanks you very much.
IzNoGoD's script works too , but you can't save/load anymore , if you saved in the trigger and you have to reconnect to be able to save / load again.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Megazor's script works just like i wanted , thanks you very much.
IzNoGoD's script works too , but you can't save/load anymore , if you saved in the trigger and you have to reconnect to be able to save / load again.
Re: Zone where players can not save.
Damnit
For it to work, edit this line:
else if(!self.spamming
to
else if(self.spamming
(remove the !)
For it to work, edit this line:
else if(!self.spamming
to
else if(self.spamming
(remove the !)
Re: Zone where players can not save.
IzNoGoD wrote:Damnit
For it to work, edit this line:
else if(!self.spamming
to
else if(self.spamming
(remove the !)
Quote from the thread !!!!!HELP!!!!!IzNoGoD wrote:You could at least have made your topic title a little more descriptive...
Ehm...? *cough*hypocrite*cough*
Join my server @ 217.163.22.223:28960
Who is online
Users browsing this forum: No registered users and 1 guest