Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Moving spawn points? (ZE multiple levels)

Discussion in Mapping Discussion started by Chris Jenkins, Mar 19, 2013

  1. Jan 14, 2013
    Posts
    Hey guys I was thinking player spawns could be named/killed/created with outputs but I Was wrong when I tried to do it today

    How do you guys move spawn points in ZE levels with multiple stages? Or are you using teleports? I'm stumped :question:

    Thanks!
  2. Jul 4, 2011
    Posts
    I think you can name them and change their origin (addoutput origin x x x), no ZE map thus far has done it though. I'm sure @enviolinador can fill you in.
  3. May 31, 2012
    Posts
    They can be named by giving them a targetname, and upon that you can teleport them with AddOutput origin X Y Z as Tony said. I made a small python script thing a few weeks ago to build the 'spawnpoint matrix' upon one given coordinate; I could upload it if you want to use it. Basically, you need to move the spawn one by one to a given X Y Z coordinate; this is rather tedious, so the script generates all the outputs for you and you just copypaste what it generates on the .vmf.
    • Informative Informative x 3
    • Jan 14, 2013
      Posts
      I would appreciate that! Doing it one by one for 64 spawns will be tedious indeed! Thanks!
    • May 31, 2012
      Posts
      The code is kinda very terrible, but it does it's job. I tested it using the Python GUI on windows; using some web-interpreters showed up different thingies (parentheses were kept and all, which is not intended). If you have any problem with it, just tell me.

      Code:
      # Generates the needed I/O commands to paste into a .vmf directly
      # The matrix will be filled from the given coordinate to either +x,+y,-x or -y.
      #
      # Inputs:
      #
      # X Y Z : Coordinates of the 'initial position' (corner of the square matrix)
      # Distance: Units between the spawnpoints
      # Input: The OnWhatever that makes it work
      # Name: Prefix (assumes the spawnpoints are named as something and a number, SomethingXX)
      # Delay: Time until the spawn 'teleporting' is triggered
      # Times: Amount of times it can be done. -1 for infinite.
       
      def generatorXY (x,y,z,distance,input,name,delay, times):
      for i in range (0,8):
      for j in range (0,8):
      n = i*8 + j
      l = x + i*distance
      r = y + j*distance
      text = '"' + input + '" "'+name+str(n)+',AddOutput,origin'+' '+str(l)+' '+str(r)+' '+str(z)+',' + str(delay) + ',' + str(times) + '"'
      print(text)
       
       
      def generatornXY (x,y,z,distance,input,name,delay, times):
      for i in range (0,8):
      for j in range (0,8):
      n = i*8 + j
      l = x - i*distance
      r = y + j*distance
      text = '"' + input + '" "'+name+str(n)+',AddOutput,origin'+' '+str(l)+' '+str(r)+' '+str(z)+',' + str(delay) + ',' + str(times) + '"'
      print(text)
       
       
       
      def generatorXnY (x,y,z,distance,input,name,delay, times):
      for i in range (0,8):
      for j in range (0,8):
      n = i*8 + j
      l = x + i*distance
      r = y - j*distance
      text = '"' + input + '" "'+name+str(n)+',AddOutput,origin'+' '+str(l)+' '+str(r)+' '+str(z)+',' + str(delay) + ',' + str(times) + '"'
      print(text)
       
       
       
      def generatornXnY (x,y,z,distance,input,name,delay, times):
      for i in range (0,8):
      for j in range (0,8):
      n = i*8 + j
      l = x - i*distance
      r = y - j*distance
      text = '"' + input + '" "'+name+str(n)+',AddOutput,origin'+' '+str(l)+' '+str(r)+' '+str(z)+',' + str(delay) + ',' + str(times) + '"'
      print(text)
       
       
       
      # Examples
      # Generating in all the possible directions, with distance 40 (relatively good value) coming from (0,0,0)
      # When OnTrigger, after 0.00 seconds and infinite (-1) times
      # Useful with map_showspawnpoints to see where the spawnpoints are being moved to
       
      generatorXY(0,0,0,40,'OnTrigger','Spawn',0.00,-1)
      generatornXY(0,0,0,40,'OnTrigger','Spawn',0.00,-1)
      generatorXnY(0,0,0,40,'OnTrigger','Spawn',0.00,-1)
      generatornXnY(0,0,0,40,'OnTrigger','Spawn',0.00,-1)
       
      # How to use it:
      #
      # 0. (You should have already done this) Without the smartedit thingie, add a targetname to every spawnpoint (Spawn0-Spawn63, for example)
      # 1. Place one dummy spawnpoint in Hammer to get the corner of the matrix you want to generate
      # 2. Generate the lines needed with this crap and copy them. Verify that they are correct.
      # 3. Place a logic_relay in Hammer, call it LevelXXChange (or any entity and name you want). Add a dummy output in it. Save and close Hammer
      # 4. Open the .vmf file as raw text and look for that entity. Paste the 64 lines this thing gives as an output and paste it inside the 'Connections part'
      #              ---- Notice that the dummy output can help you find it, and you could just paste over it, replacing or whatever
      # 5. Save the .vmf. Open Hammer. Test that it works.
      
      EDIT: I think the code lost its format and it's missing the needed 'tab' space things. You can add them yourself or tell me to up it somewhere else.
      • Like Like x 1
      • Informative Informative x 1
        enviolinador, Mar 19, 2013 Last edited by enviolinador, Mar 19, 2013
      • Jan 14, 2013
        Posts
        Whew! I think I might be in over my head with this code (never used python) . Is it possible to have my 63 spawns parented to an entity that I can just move to a new location so the spawn points go with it?

        If not Im sure I can figure out the code :smile:
        HONEY BOO BOO WARS, Mar 19, 2013 Last edited by Chris Jenkins, Mar 19, 2013
      • May 31, 2012
        Posts
        I tried parenting and it didn't work well, so I don't think so... I have yet to try a different thing, though; I'll try to do it for later and post if I get something.

        The code is just two nested fors whose iterating variable thing is multiplied by the distance parameter and then added to the X and Y coordinates of the given coordinates, you could easily do the same in C, C++ or Java. The rest is just a filler; however, you might want to at least copy the structure of the text string that gets printed.

        EDIT: Also, for further reference, as Tony pointed out, maps out there don't do this (yet). They use one of the persistent entities instead to save the state (level); func_brush is an example of this.
        • Informative Informative x 1
          enviolinador, Mar 19, 2013 Last edited by enviolinador, Mar 19, 2013
        • Jan 14, 2013
          Posts
          Ok thanks again for the information.

          As a beginning I'm looking to do the most simple way, is the way Tony pointed out any simpler? (Im not sure I know what you mean by using func_brush or other persistend entities.

          Thanks!
        • May 31, 2012
          Posts
          The way Tony pointed out is teleporting the spawnpoints one by one, which I already explained to you. For the simplest (although I seriously doubt that is the 'correct' term to be said, but whatever; common would fit better) level system, you need one of those persistent entities and a way to activate one thing or another. As func_brush is a 'wall', the typical system mappers have built (up to now) has been just placing a prop over the one func_brush and, if the func_brush is disabled, having the prop enter a trigger and, therefore, output thingies. This creates a sort of 'boolean/binary logic' level system, although there are less entity intensive methods; you shouldn't worry about that by now, though.
          • Informative Informative x 1
          • Nov 11, 2011
            Posts
            Couldn't have explained it better.
            [IMG]
            • Like Like x 1
            • Funny Funny x 1
            • Jan 13, 2013
              Posts
              You could, just have a central spawning point, and have 1 info_teleport_destination per level. then have a teleport at that spawn to movie it to the other places (Such as minas Tirith)
              • Informative Informative x 1
              • Jun 4, 2006
                Posts
                Yeah the editor simply can't handle tabs, so I've added a patch that will emulate them in the bbcode editor and be able to convert that emulation over when switching back to the main editor.

                So if you're going to paste some code that has tabs, first switch to the bbcode editor

                [IMG]

                Paste your code and wrap it in code tags (or html, php) - alternatively just hit the code button before entering the bbcode editor mode, and insert blank code.

                You'll notice tabs are now retained. You can now switch back to the main editor and continue your post.

                [IMG] [IMG]

                Code:
                public Action:Command_rocket(client, args)
                {
                	if (args != 1)
                	{
                		ReplyToCommand(client, "sm_rocket <target> - Kaboom.");
                		return Plugin_Handled;
                	}
                	new String:arg1[64];
                	GetCmdArgString(arg1, sizeof(arg1));
                 
                	new String:target_name[MAX_TARGET_LENGTH]
                	new target_list[MAXPLAYERS], target_count
                	new bool:tn_is_ml
                 
                	if ((target_count = ProcessTargetString(
                					arg1,
                					client,
                					target_list,
                					MAXPLAYERS,
                					COMMAND_FILTER_ALIVE,
                					target_name,
                					sizeof(target_name),
                					tn_is_ml)) <= 0)
                	{
                		ReplyToTargetError(client, target_count);
                		return Plugin_Handled;
                	}
                	for (new i = 0; i < target_count; i++)
                	{
                		CreateTimer(Delay, Kaboom, target_list[i]);
                		new Float:vel[3];
                		vel[0] = 0.0;
                		vel[1] = 0.0;
                		vel[2] = 1500.0 * Force;
                		SetEntityMoveType(target_list[i], MOVETYPE_WALK);
                		TeleportEntity(target_list[i], NULL_VECTOR, NULL_VECTOR, vel);
                		admin = client;
                		ShowActivity2(client, "[SM] ","Rocketed %N.", target_list[i]);
                		if (Trail) AttachParticle(target_list[i], "rockettrail");
                	}
                	return Plugin_Handled;
                }
                I'll probably mention this in a site update so others are aware, threw this in here cause your post made me realize this was a minor issue. Really though a better way to share code would probably be via pastebin, pastie, etc.

                Sorry for being off topic. Carry on.
                • Wizard! Wizard! x 2
                • Jan 14, 2013
                  Posts
                  Ok thanks everyone for the help, its appreciated
                • Apr 9, 2007
                  Posts
                  Clearly not my code, but [/php] tags work well.

                  PHP:
                  bool HandleSystem::TryAndFreeSomeHandles()
                  {
                      
                  IPluginIterator *pl_iter g_PluginSys.GetPluginIterator();
                      
                  IPlugin *highest_owner NULL;
                      
                  unsigned int highest_handle_count 0;
                   
                      
                  /* Search all plugins */
                      
                  for (IPluginIterator *pl_iter g_PluginSys.GetPluginIterator(); pl_iter->MorePlugins(); pl_iter->NextPlugin())
                      {
                          
                  IPlugin *plugin pl_iter->GetPlugin();
                          
                  IdentityToken_t *identity plugin->GetIdentity();
                          
                  unsigned int handle_count 0;
                   
                          if (
                  identity == NULL)
                          {
                              continue;
                          }
                   
                          
                  /* Search all handles */
                          
                  for (unsigned int i 1<= m_HandleTaili++)
                          {
                              if (
                  m_Handles[i].set != HandleSet_Used)
                              {
                                  continue;
                              }
                              if (
                  m_Handles[i].owner == identity)
                              {
                                  
                  handle_count++;
                              }
                          }
                   
                          if (
                  handle_count highest_handle_count)
                          {
                              
                  highest_owner plugin;
                              
                  highest_handle_count handle_count;
                          }
                      }
                   
                      if (
                  highest_owner == NULL || highest_handle_count == 0)
                      {
                          return 
                  false;
                      }
                   
                      
                  HANDLE_LOG_VERY_BAD("[SM] MEMORY LEAK DETECTED IN PLUGIN (file \"%s\")"highest_owner->GetFilename());
                      
                  HANDLE_LOG_VERY_BAD("[SM] Unloading plugin to free %d handles."highest_handle_count);
                      
                  HANDLE_LOG_VERY_BAD("[SM] Contact the author(s) of this plugin to correct this error."highest_handle_count);
                      
                  HANDLE_LOG_VERY_BAD("--------------------------------------------------------------------------");
                   
                      
                  IdentityToken_t *pIdentity highest_owner->GetIdentity();
                      
                  unsigned int total 0highest_index 0total_size 0size;
                      
                  unsigned int pCount = new unsigned int[HANDLESYS_TYPEARRAY_SIZE+1];
                      
                  memset(pCount0, ((HANDLESYS_TYPEARRAY_SIZE 1) * sizeof(unsigned int)));
                   
                      for (
                  unsigned int i 1<= m_HandleTaili++)
                      {
                          const 
                  QHandle &Handle m_Handles[i];
                          if (
                  Handle.set != HandleSet_Used || Handle.owner != pIdentity)
                          {
                              continue;
                          }
                   
                          
                  pCount[Handle.type]++;
                          
                  total++;
                   
                          if (
                  Handle.type >= highest_index)
                          {
                              
                  highest_index = ((Handle.type) + 1);
                          }
                   
                          if (
                  Handle.clone != 0)
                          {
                              continue;
                          }
                   
                          if (
                  m_Types[Handle.type].dispatch->GetHandleApproxSize(Handle.typeHandle.object, &size))
                          {
                              
                  total_size += size;
                          }
                      }
                   
                      const 
                  char pTypeName NULL;
                   
                      for (
                  unsigned int i highest_index; --0;)
                      {
                          if (
                  pCount[i] == 0)
                          {
                              continue; 
                  /* We may have gaps, it's fine. */
                          
                  }
                   
                          if (
                  m_Types[i].nameIdx != -1)
                          {
                              
                  pTypeName m_strtab->GetString(m_Types[i].nameIdx);
                          }
                          else
                          {
                              
                  pTypeName "ANON";
                          }
                   
                          
                  HANDLE_LOG_VERY_BAD("Type\t%-20.20s|\tCount\t%u"pTypeNamepCount[i]);
                      }
                   
                      
                  HANDLE_LOG_VERY_BAD("-- Approximately %d bytes of memory are in use by (%u) Handles.\n"total_sizetotal);
                      
                  delete [] pCount;
                   
                      
                  highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS"Memory leak");
                   
                      return 
                  g_PluginSys.UnloadPlugin(highest_owner);
                  }