Page 3 of 4

Posted: Tue Nov 30, 2004 2:02 am
by agentmad007
i added the end though and i am kicked from the game

Posted: Tue Nov 30, 2004 2:10 am
by strafer
What's the error message?

Posted: Tue Nov 30, 2004 2:19 am
by agentmad007
infinite loop.

i am trying something else by my side.....instead of adding the threads in main i try to add it once the bomb explode.

changed again the thing to avoid the infinite loop.

Code: Select all

bomb_thinker2:





	level.bomb_defuse_time = 40 //tenths of a second
	level.bomb_set_time = 50  //tenths of a second
	level.bomb_tick_time = 15  //seconds
	level.bomb_explosion_radius = 1054  //quake units
	level.bomb_use_distance = 128 //quake units
	level.bomb_damage = 200
	level.bombusefov = 30

	level.subtitleX = 100
	level.subtitleY = 50
	
	self.live = 0

	if (self.target != NIL && self.target != NULL && $(self.target) != NULL)
	{
		self.target.collisionent = self.target.target
		self.target notsolid
	}

	thread bomb_waittill_set2
end

bomb_waittill_set2:
	self model items/pulse_explosive.tik
	while ( $(self.trigger_name) )
	{
		self.trigger_name waittill trigger
		local.player = parm.other

	        if (local.player.dmteam != allies) 
		{
		goto bomb_waittill_set2
		println "failed dmteam check" local.player.dmteam	
		}

		local.counter = 0
		while ( (Isalive local.player) && (local.player cansee self level.bombusefov level.bomb_use_distance) && (local.player.useheld == 1) && self.live == 0 )
		{
			if (local.counter == 0)
				local.player stopwatch (level.bomb_set_time * .1)
				
			local.counter++
			wait 0.1

			if (local.counter >= level.bomb_set_time)
			{
				iprintlnbold ( loc_convert_string "The Allies have planted a bomb!" )
				if (level.planting_team == "allies")
					self playsound dfr_objective_o
				else
					self playsound den_objective_o

				thread bomb_waittill_defuse2
				thread bomb_waittill_explode2

				self.live = 1

				end
			}
		}
		if (local.counter > 0)
			local.player stopwatch 0
	}
end


bomb_waittill_defuse2:
	while ( $(self.trigger_name) )
	{
		self.trigger_name waittill trigger

		local.player = parm.other
	
	if (local.player.dmteam != axis)
	{      
		println "failed dmteam check" local.player.dmteam
		goto bomb_waittill_defuse2
		}
	
		local.counter = 0
		while ( (Isalive local.player) && (local.player cansee self level.bombusefov  level.bomb_use_distance) && (local.player.useheld == 1) && self.live == 1 )
		{
			if (local.counter == 0)
				local.player stopwatch (level.bomb_defuse_time * .1)
			
			local.counter++
			wait 0.1

			if (local.counter >= level.bomb_defuse_time)
			{
				iprintlnbold ( loc_convert_string "The Allies bomb has been defused!" )
				if (level.defusing_team == "allies")
					self playsound dfr_diffused_d
				else
					self playsound den_diffused_d
				thread bomb_waittill_set2 //start first thread again
				self.live = 0
				end
			}
		}
		if (local.counter > 0)
			local.player stopwatch 0
	}
end

bomb_waittill_explode2:
	self model items/explosive.tik
	self playsound plantbomb
	self loopsound bombtick
	
	local.start_time = level.time

	while (level.time < (local.start_time + level.bomb_tick_time) )
	{
		wait 0.1
		if (self.live != 1)
		{
			self stoploopsound
			end
		}
		if (level.time == (local.start_time + level.bomb_tick_time - 10) )
		{
			self stoploopsound
			self loopsound final_countdown
		}
 	}
 	self stoploopsound
	thread bomb_explode2
end

bomb_explode2:
	self.trigger_name remove

	thread global/obj_dm.scr::jitter_large 0
	
	if (self.exploder_set != NIL)
	{
		thread global/exploder.scr::explode self.exploder_set
	}
	
	if (self.explosion_fx != NIL)
		self thread global/obj_dm.scr::spawn_fx self.explosion_fx
	
	if (self.explosion_sound != NIL)
		self playsound self.explosion_sound

	if (self.target != NIL && self.target != NULL && self.target != "" && self.target.size == 1)
	{
		if (self.target.destroyed_model != NIL)
		{
			local.damaged = self.target thread spawn_damaged self.target.destroyed_model
		}

		if (self.exploder_set == NIL)
		{
			self.target remove
		}

		waitframe
	}
	radiusdamage self.origin level.bomb_damage level.bomb_explosion_radius
	if (self.killarea != NIL)
	{
		self.killarea volumedamage 1000
	}
	self hide
	self notsolid
	self remove
	$exploder2 remove
iprintlnbold "Subatomic energy destroyed.Earth is saved"

	self.live = 0


	level.allies_obj++ 
	self.exploded = 1


	wait 0.5

thread check_axis_bomb


end

check_axis_bomb: 

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

                    if ((isAlive $player[local.i]) && $player[local.i].dmteam=="axis") 
                    { 
                              
                    } 

                   if($player[local.i].dead == 0) 
                    { 

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

        
 		}                    
                
   } 


} 

thread prevent_player_spawn

end 

  
prevent_player_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 

Posted: Tue Nov 30, 2004 2:22 am
by agentmad007
i am lazy infinite loop again

Posted: Tue Nov 30, 2004 2:40 am
by strafer
I never have understood why, but it doesn't like it when you make a while loop with no delay. I saw a while loop that you should probably add a wait .1 on it or something. I did it for you. :wink: Here it is:

Code: Select all


check_axis_bomb:

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

                    if ((isAlive $player[local.i]) && $player[local.i].dmteam=="axis")
                    {
                             
                    }

                   if($player[local.i].dead == 0)
                    {

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

       
       }                   
               
   }

wait .1
} 

end


Posted: Tue Nov 30, 2004 2:48 am
by agentmad007

Code: Select all

^~^~^ Script Error: Field 'exploded' applied to NULL listener

   if($player[local.i].dead == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1765)
   if($player^

^~^~^ Script Error: Cannot cast 'NIL' to int

   if (local.self.exploded == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1731)
   if (local.self^

^~^~^ Script Error: Field 'exploded' applied to NULL listener

   if($player[local.i].dead == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1765)
   if($player^

^~^~^ Script Error: Cannot cast 'NIL' to int

   if (local.self.exploded == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1731)
   if (local.self^

^~^~^ Script Error: Field 'exploded' applied to NULL listener

   if($player[local.i].dead == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1765)
   if($player^

^~^~^ Script Error: Cannot cast 'NIL' to int

   if (local.self.exploded == 1)  (maps/obj/mp_stargate_objective_final_obj.scr, 1731)
   if (local.self^

^~^~^ Script Error: Field 'exploded' applied to NULL listener
what the HELL

Posted: Tue Nov 30, 2004 2:54 am
by strafer

Code: Select all

	exec global/exploder.scr
	exec global/door_locked.scr::lock
Instead of doing this after main:, put these scripts after level waittill prespawn.

Posted: Tue Nov 30, 2004 3:03 am
by agentmad007
same , it seems the game cant find my bomb targetname===> "APPLY TO NULL LISTENER "ERROR

Like for the [local.i].dead bla bla..something wrong with .

Posted: Tue Nov 30, 2004 3:07 am
by strafer
Try $bomb1.exploded and $bomb2.exploded instead of local.bomb1 and local.bomb2.

Posted: Tue Nov 30, 2004 3:14 am
by agentmad007
in progress now i have just this error :

" if($player[local.i].dead == 1) (maps/obj/mp_stargate_objective_final_obj.scr, 1765)
if($player^

^~^~^ Script Error: Cannot cast 'NIL' to int
"

console loop that message each 1ms , but about the bomb error it disapeeared :D

Code: Select all


..............bla bla bla 

self.live = 0


	level.allies_obj++ 
	$bomb2.exploded = 1


	wait 0.5

end

check_axis_bomb: 

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

                    if ((isAlive $player[local.i]) && $player[local.i].dmteam=="axis") 
                    { 
                              
                    } 

                   if($player[local.i].dead == 0) 
                    { 

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

        
       }                    
                
   } 

wait .1 
} 

end

Posted: Tue Nov 30, 2004 3:42 am
by strafer
Try taking out the if statement if($player[local.i].dead == 0) and its brackets.

Code: Select all

check_allies_bomb: 

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

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

                    if ((isAlive $player[local.i]) && $player[local.i].dmteam=="allies") 
                    { 
                              
                    } 
                   else 
                    { 

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


} 


end 

Posted: Tue Nov 30, 2004 3:49 am
by agentmad007
same , and cant load my map anymore ,)

Posted: Tue Nov 30, 2004 3:52 am
by strafer
Try this:

Code: Select all

check_allies_bomb:

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

			if($player[local.i].dmteam=="axis")
			{

				$player[local.i] waittill death
				$player[local.i].dead = 1

                  	}
		}
   }
}
end

Posted: Tue Nov 30, 2004 3:57 am
by agentmad007
infinite loop i guess you forget a wait .1 :P

never mind i think i give up the thing .....

Posted: Tue Nov 30, 2004 4:01 am
by strafer
agentmad007 wrote:infinite loop i guess you forget a wait .1 :P

never mind i think i give up the thing .....
Yep I forgot the wait .1. :wink:

Try it now.

It's time for me to go to sleep. :cry:
I have school tomorrow so I will be back after that.