Announcement

Collapse
No announcement yet.

ThingFactory? Or how to spawn objects.

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

  • #16
    You can safely ditch the local variables in both functions. DLO is most useful to load a class from a string (ie, unreferenced), if you compile a level with that thingyspawner set, it should pickup the class and add it to your level's import table.

    What you could do is precache the materials and static meshes of the class you're spawning, but since it's alienswarm stuff it will be precached anyway.

    My version would be:
    Code:
    //=============================================================================
    // Aothingyspawnar.
    //=============================================================================
    class Aothingyspawnar expands Triggers;
    
    var()	float		RespawnTime;
    var()	bool		bRespawn;
    var()	class<actor>	spawnclass;
    var()	name		SpawnTag;
    
    event beginplay()
    {
    	respawntime = fmax(0.1,respawntime);
    }
    
    event Trigger( Actor Other, Pawn EventInstigator )
    {
    	setTimer(respawntime, bRespawn);
    }
    
    	
    event Timer()
    {
    	spawn(spawnclass,,Spawntag);
    }
    
    defaultproperties
    {
    	bDirectional=True
    }
    The bDirectional bool gives you a little arrow in the editor, like spawnpoints. You can of course endlessly expand this class, but this ought to do the trick as elegantly as possible.
    Last edited by Pestcontrol; 30th Jul 2005, 05:13 PM.
    [THN] Gaming community - www.thehavennet.org.uk
    Proud admin of the THN AlienSwarm server #3 at 82.156.164.3:7777 and #4 at 87.117.203.96:7777. Teamspeak at: teamspeak.thehavennet.org.uk (def. port)

    Comment


    • #17
      yes thats much neater pestcontrol

      hm, isnt the spawntag supposed to be the third parameter spawn(class,owner,tag,location,rotation); ?..or has it been changed for 2k4

      Comment


      • #18
        Thanks for the great help

        Comment


        • #19
          UArchitect: It is in fact, i had two commas in there and then started messing with more things and removed it again because a voice whispered "keep it simple, stupid"

          I stand corrected.
          [THN] Gaming community - www.thehavennet.org.uk
          Proud admin of the THN AlienSwarm server #3 at 82.156.164.3:7777 and #4 at 87.117.203.96:7777. Teamspeak at: teamspeak.thehavennet.org.uk (def. port)

          Comment

          Working...
          X