Announcement

Collapse
No announcement yet.

Creating a Singleplayer deathmatch like in Quake 1 Arena?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating a Singleplayer deathmatch like in Quake 1 Arena?

    Hi,

    Maybe some of you know the Quake 1 mod "Quake Arena".
    When you press Singleplayer you will play deathmatch with 5 bots connected..

    Anybody knows how i can do this in QuakeC?

    my old code i got from Dusterdoo gives me a crash
    (Runaway loop counter thing)

    Code:
        float num_bots;   
        float bot_add; 
    
    
    
        void() bot_add_cycle =
        {
           while(num_bots < 5)
           {
              if(bot_add < time)
              {
                 BotConnect(); 
                 num_bots = (num_bots + 1);
                 bot_add = (time + 2); 
              }
           }
    
    
    
    
        {
           localcmd("deathmatch 1\n"); 
           localcmd("maxclients 6\n"); 
           
           bot_add_cycle();
        };

  • #2
    if num_bots == 0 then your stuck in that loop from the go.

    instead try something...

    Code:
    entity (void() func, float t) job =
    {
       local entity  work;
       
       work  = spawn();
       work.think = func;
       work.owner = self;
       work.nextthink = time + t;
       return work;
    };
    Code:
    void () ConnectBots =
    {
    	if (num_bots)
    	{
    		BotConnect();
    		remove(self); // Job's entity
    	}	
    };
    Code:
        void() bot_add_cycle =
        {
           float x;
    
           x = num_bots;
    
           while(x)
           {
              	job(ConnectBots, x + 2);
              	x -= 1;          	
           }
    Last edited by R00k; 02-10-2012, 11:58 PM.
    www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

    Comment


    • #3
      Thanks, i will give it a try later

      Comment


      • #4
        maybe its a stupid question but where should i put the code?
        atm it is in a seperate qc file and called from client.qc in "PutClientInServer", at the end of the function and it doesnt work.

        Comment

        Working...
        X