prevent axis respawn

Post your scripting questions / solutions here

Moderator: Moderators

agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

prevent axis respawn

Post by agentmad007 »

Hi ,

Can you enlight me plz .I want to stop alies or axis respawn after a bomb explode.

Here is my guess.

Code: Select all

bomb_explode:

....bla bla 
this is the thread that make explode my bomb

once my bomb exploded i make this thread call another thread

thread avoid_axis_to_respawn

end

Code: Select all


avoid_axis_to_respawn:

for (local.i=1; local.i<=$player.size; local.i++) 
    { 
	if (local.player.dmteam != axis)

                   {

                    level.dmrespawning = 0

                    }

    }

end 

I am not good to scripting , if i can have more details they are welcome !

Thx
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

I asked this very same question in a different thread today:

viewtopic.php?t=9203

That thread shows what I have so far. All I have is to make it LIKE they aren't spawning. What it really does, is make it so they get noclip, lose their weapons, and cannot be seen. I cannot figure out how to do this to the axis players that are dead and not alive. That was my question.

What you have done is turned off respwning for everyone. It scans each player and sees if they are on the axis side and if they are, it sets level.dmrespawning to 0, which turns it off for everyone.

If you are doing this for your own map, just do something like this:

Code: Select all

avoid_respawn:

if ($bomb_targetname.exploded == 1)
{
     $spawn_targetname disablespawn
}

end
If it is a stock map, check out the thread I gave you above and it explains how to convert .bsp files into .map files, but I had no luck with that because it didn't show the spawn targetnames.
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

If you disable all axis spawn points they'll just spawn at the info_player_start or at an allied spawn point :(
Image
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

jv_map wrote:If you disable all axis spawn points they'll just spawn at the info_player_start or at an allied spawn point :(
Ok yeah, that would be bad. I think my script that I have done so far may be as close as it can get. :(

Also, does anyone know how to figure out if someone is dead using script? In other words, the opposite of isAlive.
Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

isalive tells you if alive or dead.

If isalive

....

else

hes dead

or as a varibale

if isalive local.player_alive = 1

if not hes dead and local.player_alive is still 0

Maybe there is a command you could use for multiple parameter loops... but I dont know it =) If I wanted to check if a dead person was touching something in one statement, I would find out if he was alive first and put it in a variable, then if istouching && local.player_islive != 1 etc etc

or nest the isalive statement inside others.


the mefy scripts have instances of spawn prevention i believe, you should check those out
When I am king, you will be first against the wall~
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

I set all my info player with tagernames , but now i read thta it is useless coze they will spawn to the info_plater start .

level.dmrespawning = 0 wont work and

$allies_spawn (targetname) disable wont work also .

Is there a possibility to stop them to spawn or should i let this idea from side ? ....


Thanks for your answers
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

or can whe remove axis spawn and info player start .

removeclass info_player_start
removeclass info_player_axis

or remove the info_player_start and only disable the axis spawn, when the bomb had explode.


i think those spawn are usefull to let the player spectate when he is dead.
Deadly and slient.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Or after the bomb goes off you disable the current spawn and enable other ones farther back maybe or somewhere else ?
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

respawning should be available only the next round.The problem is to disable the current spawn points when target achieved and to stop players spawning from the info_player_start.
Or after the bomb goes off you disable the current spawn and enable other ones farther back maybe or somewhere else ?
it wil only have the same effect as

Code: Select all

enable/disable
spawn, and the player will still be able to join the game from the player_start as said Jv_map.

Tom trude talked about a removeclass comand in a scripting topic, not about info_player_start but for vis_leaf_group , i guess it should work also if i ask through script to remove this class.I'd like to have your opinion .

Thank you
Deadly and slient.
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

Try this:

Code: Select all


thread check_bomb
thread prevent_axis_spawn
end

check_bomb:

while(1)
{
if (local.bomb_name.exploded == 1)
{

	while(1)
	{
		for(local.i=1;local.i<=$player.size;local.i++)
		{

		  if (isAlive $player[local.i])
		{
                    //do nothing
		}
                else
                {
 		  if($player[local.i].dmteam=="allies")
		  {
  			 //do nothing
		  }
 		  else if($player[local.i].dmteam=="axis")
		  {
			if($player[local.i].dead == 0)
			{

				$player[local.i].dead = 1
			}
                  }
                }
		wait .1
        }

                         }
                         end 

 

}


end


prevent_axis_spawn:

while(1)
{

	if($player[local.i].dead == 1)
	{
		$player[local.i] takeall
		$player[local.i] hide
		$player[local.i] notsolid
		$player[local.i] noclip
	}
wait .1
}

end
This basically makes them a spectator that is "dead", but yet is still alive. It takes away the player's weapons, hides the player model, and gives him noclip. Use this script to count the number of axis players alive so you can do teamwin allies if there are no axis players alive:

Code: Select all


thread count_players
end

count_players:

	while(1)
	{
		level.allies = 0
		level.axis = 0
		for(local.i=1;local.i<=$player.size;local.i++)
		{

		  if(isAlive $player[local.i])
		{
 		  if($player[local.i].dmteam=="allies")
		  {
  			 level.allies++
		  }
 		  else if($player[local.i].dmteam=="axis")
		  {
			if($player[local.i].dead != 1)
			{
 			  level.axis++
			}
                  }
		}
        }
                           iprintln ("Axis: " + (level.axis))
                           iprintln ("Allied: " + (level.allies))
                           wait 5
                         }
 end 
This makes it so if ($player[local.i].dead == 1) then it won't count as a "live" axis player. Otherwise, it does.

Hope this helps. :wink:

P.S.

Your sig is friggin huge. :wink:
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

okay thx for the script i will try it and tell the effects .

And jv_map told me about my sig np ;) he has removed it.but i ll be back!
Deadly and slient.
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

However just a question , i understood that the script check if the bomb explode .Once it is done , the script check how many axis is alive , but i dont see any teamwin if there is no more axis .

one more thing i'd like the script to check allies and axis , but no worries i think i can change it......and actually the bomb run with another objective so i dont want to make them win only if they explode the bomb.

If i can grab more details plz :roll:
Deadly and slient.
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

agentmad007 wrote:However just a question , i understood that the script check if the bomb explode .Once it is done , the script check how many axis is alive , but i dont see any teamwin if there is no more axis .

one more thing i'd like the script to check allies and axis , but no worries i think i can change it......and actually the bomb run with another objective so i dont want to make them win only if they explode the bomb.

If i can grab more details plz :roll:
Where it has the iprintln statements, you can replace those with

Code: Select all

if (level.axis == 0)
{
     teamwin allies
}

If you want the allies to win after a certain amount of bombs exploded, set a new variable, such as level.objectives. Make multiple if statements to figure out if the bomb has exploded then add 1 to the variable. Once the variable is equal to a certain number, then do the script to check how many axis players are alive.

Lets do a little example. :wink:

If there are 3 bombs in your map that you want to explode before the axis spawn is disabled, then you could do something like this:

Code: Select all


level.objectives = 0

thread check_obj
thread check_players
thread prevent_axis_spawn

end

check_obj:

while(1)
{

     if(local.bomb1.exploded == 1)
     {
          level.objectives = level.objectives + 1
     }

     if(local.bomb2.exploded == 1)
     {
          level.objectives = level.objectives + 1
     }
     if(local.bomb3.exploded == 1)
     {
          level.objectives = level.objectives + 1
     }
}

end

check_players:

while(1)
{

     if(level.objectives == 3)
     {
          for(local.i=1;local.i<=$player.size;local.i++)
         {

              if (isAlive $player[local.i])
             {
                    //do nothing
             }
             else
             {
                   if($player[local.i].dmteam=="allies")
                   {
                        //do nothing
                   }
                  else if($player[local.i].dmteam=="axis")
                 {
                       if($player[local.i].dead == 0)
                      {

                           $player[local.i].dead = 1
                      }
                 }
             }

        }

     }

 

}


end


prevent_axis_spawn:

while(1)
{

   if($player[local.i].dead == 1)
   {
      $player[local.i] takeall
      $player[local.i] hide
      $player[local.i] notsolid
      $player[local.i] noclip
   }
wait .1
}

end 

}

end

In this example, it doesn't check the players until AFTER the three bombs have exploded. Once they explode, it triggers the script to check if any axis players die. If so, the next time they spawn, they will "unspawn." Hope this helps.
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »


Where it has the iprintln statements, you can replace those with

Code: Select all

if (level.axis == 0)
{
     teamwin allies
}

I think the thing above answer to my question.

level.axis refer to axis alive right ? if level.axis = 0 ( all dead no one can finish the objectives so allies win)

if thats right , thats is what i need then i will paste these lines somewhere :D

Thank you strafer
Deadly and slient.
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

agentmad007 wrote:

Where it has the iprintln statements, you can replace those with

Code: Select all

if (level.axis == 0)
{
     teamwin allies
}

I think the thing above answer to my question.

level.axis refer to axis alive right ? if level.axis = 0 ( all dead no one can finish the objectives so allies win)

if thats right , thats is what i need then i will paste these lines somewhere :D

Thank you strafer
Yep, that is what it means. Glad that I could help.
Image
Post Reply