Announcement

Collapse
No announcement yet.

Teleporters, bots & aneurisms

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

    Teleporters, bots & aneurisms

    Hi. My first released map is almost finished and I'm very happy with the way it's going so far but there are a few things that I'd like to implement that I need some advice on, so here goes.
    1. How can I make a teleporter have no effects or sound?
    2. I have a small maze with teleporters inside my map. The problem is, the bots know the route to take automaticaly. Humans would need trial and error. Is there a way to dumb down the bots in the maze?
    3. Is there a way to stop someone suiciding in a volume or place (preferably not a zone), with maybe an onscreen message eg. Komek had a failed aneurism. I dont mind altering script, but I'd really like this feature.
    Thanks in advance.

    #2
    About the bots, put some pathnodes leading them to the wrong directions if you want them to not be able to figure out the maze so quick. If it is CTF or BR ive notice bots will usually head strait for the flag or goal.

    I think you can change sounds in the teleporter properties.


    PM me when the map is done i would like to see how it came out.

    good luck and i hope this helps. if not Sorry


    :up: :up: :up:

    Comment


      #3
      For the teleporter, you need to do a bit of scripting. Right click on Teleporter and hit New. Set the Package to MyLevel and the name to something like StealthTeleporter, then hit Ok. Paste this into the script:
      Code:
      simulated function bool Accept( actor Incoming, Actor Source )
      {
      	local rotator newRot, oldRot;
      	local float mag;
      	local vector oldDir;
      	local Controller P;
      
      	if ( Incoming == None )
      		return false;
      		
      	// Move the actor here.
      	Disable('Touch');
      	newRot = Incoming.Rotation;
      	if (bChangesYaw)
      	{
      		oldRot = Incoming.Rotation;
      		newRot.Yaw = Rotation.Yaw;
      		if ( Source != None )
      			newRot.Yaw += (32768 + Incoming.Rotation.Yaw - Source.Rotation.Yaw);
      	}
      
      	if ( Pawn(Incoming) != None )
      	{
      		//tell enemies about teleport
      		if ( Role == ROLE_Authority )
      			For ( P=Level.ControllerList; P!=None; P=P.NextController )
      				if ( P.Enemy == Incoming )
      					P.LineOfSightTo(Incoming); 
      
      		if ( !Pawn(Incoming).SetLocation(Location) )
      		{
      			log(self$" Teleport failed for "$Incoming);
      			return false;
      		}
      		if ( (Role == ROLE_Authority)
      			|| (Level.TimeSeconds - LastFired > 0.5) )
      		{
      			newRot.Roll = 0;
      			Pawn(Incoming).SetRotation(newRot);
      			Pawn(Incoming).SetViewRotation(newRot);
      			Pawn(Incoming).ClientSetRotation(newRot);
      			LastFired = Level.TimeSeconds;
      		}
      		if ( Pawn(Incoming).Controller != None )
      		{
      			Pawn(Incoming).Controller.MoveTimer = -1.0;
      			Pawn(Incoming).Anchor = self;
      			Pawn(Incoming).SetMoveTarget(self);
      		}
      	}
      	else
      	{
      		if ( !Incoming.SetLocation(Location) )
      		{
      			Enable('Touch');
      			return false;
      		}
      		if ( bChangesYaw )
      			Incoming.SetRotation(newRot);
      	}
      	Enable('Touch');
      
      	if (bChangesVelocity)
      		Incoming.Velocity = TargetVelocity;
      	else
      	{
      		if ( bChangesYaw )
      		{
      			if ( Incoming.Physics == PHYS_Walking )
      				OldRot.Pitch = 0;
      			oldDir = vector(OldRot);
      			mag = Incoming.Velocity Dot oldDir;		
      			Incoming.Velocity = Incoming.Velocity - mag * oldDir + mag * vector(Incoming.Rotation);
      		} 
      		if ( bReversesX )
      			Incoming.Velocity.X *= -1.0;
      		if ( bReversesY )
      			Incoming.Velocity.Y *= -1.0;
      		if ( bReversesZ )
      			Incoming.Velocity.Z *= -1.0;
      	}	
      	return true;
      }
      All i did was take out the Incoming.PlayTeleportEffect(false, true); line, which is what does the teleporter dealie. Put one of those in your level and it should be good to go. You might have to hit Recompile Changed Scripts first before it shows up in the Actor browser.

      Comment


        #4
        Great! Thanks alot guys, I'll try it out now. I'll certainly pm you when it's done but I'm on holiday for a week so can't finish it yet. Don't expect too much from the map though, I've had to change it all around for fps reasons (very bps heavy) and it doesn't flow as well. Still it's got some original features and I hope it will be one people will want to come back to.

        Btw, I don't suppose anyone knows how to solve my third question?

        *edit- I tried similar to that before Angel but I only took out the word true. Nothing happened.

        Comment


          #5
          Yeah, but that variable doesn't have anything to do with the teleport effect playing.

          Comment


            #6
            Hmmm.. I can't seem to paste the text. Right clicking inside a new script does nothing. I might have to type it all in, rather not tho, any ideas? Solved I think. ctrl +c = copy and ctrl +v = paste.
            *You made Garden of Heaven! omg I'm not worthy! That, Coret and Checkmate inspire all my maps(FuT & Wid too). Tell me though, did you mean for players to get up on the roof? :haha:

            Quote
            There are several ways to approach the flag, if you have the translocator enabled or if you can do some wacky-ninja moves you can get up to the sniper rifle platform and drop down on the flagroom.
            Endquote

            I see that you did

            Comment


              #7
              It didn't work. I can't really see why. The only idea I have is that when you add a new teleporter script, this is automaticaly placed at the top:-
              class StealthTeleporter extends Teleporter
              placeable;

              Removing it and building the script crashes the editor and using a 'neutral' actor instead, a Jumpspot, produced an error.

              Could extends be the problem? In extending the teleporter maybe the original script is used too. I tried the word replaces and the error was 'Argument extends teleporter is missing' so I'm out of ideas.

              Comment


                #8
                To Question 1:
                Code didn't work for me either, only for the person using the teleporters, but not for other clients, they saw and heared the effect. I'm not a coder, but extending this code should remove all.

                Code:
                simulated function bool Accept( actor Incoming, Actor Source )
                {
                	local rotator newRot, oldRot;
                	local float mag;
                	local vector oldDir;
                	local Controller P;
                
                	if ( Incoming == None )
                		return false;
                		
                	// Move the actor here.
                	Disable('Touch');
                	newRot = Incoming.Rotation;
                	if (bChangesYaw)
                	{
                		oldRot = Incoming.Rotation;
                		newRot.Yaw = Rotation.Yaw;
                		if ( Source != None )
                			newRot.Yaw += (32768 + Incoming.Rotation.Yaw - Source.Rotation.Yaw);
                	}
                
                	if ( Pawn(Incoming) != None )
                	{
                		//tell enemies about teleport
                		if ( Role == ROLE_Authority )
                			For ( P=Level.ControllerList; P!=None; P=P.NextController )
                				if ( P.Enemy == Incoming )
                					P.LineOfSightTo(Incoming); 
                
                		if ( !Pawn(Incoming).SetLocation(Location) )
                		{
                			log(self$" Teleport failed for "$Incoming);
                			return false;
                		}
                		if ( (Role == ROLE_Authority)
                			|| (Level.TimeSeconds - LastFired > 0.5) )
                		{
                			newRot.Roll = 0;
                			Pawn(Incoming).SetRotation(newRot);
                			Pawn(Incoming).SetViewRotation(newRot);
                			Pawn(Incoming).ClientSetRotation(newRot);
                			LastFired = Level.TimeSeconds;
                		}
                		if ( Pawn(Incoming).Controller != None )
                		{
                			Pawn(Incoming).Controller.MoveTimer = -1.0;
                			Pawn(Incoming).Anchor = self;
                			Pawn(Incoming).SetMoveTarget(self);
                		}
                	}
                	else
                	{
                		if ( !Incoming.SetLocation(Location) )
                		{
                			Enable('Touch');
                			return false;
                		}
                		if ( bChangesYaw )
                			Incoming.SetRotation(newRot);
                	}
                	Enable('Touch');
                
                	if (bChangesVelocity)
                		Incoming.Velocity = TargetVelocity;
                	else
                	{
                		if ( bChangesYaw )
                		{
                			if ( Incoming.Physics == PHYS_Walking )
                				OldRot.Pitch = 0;
                			oldDir = vector(OldRot);
                			mag = Incoming.Velocity Dot oldDir;		
                			Incoming.Velocity = Incoming.Velocity - mag * oldDir + mag * vector(Incoming.Rotation);
                		} 
                		if ( bReversesX )
                			Incoming.Velocity.X *= -1.0;
                		if ( bReversesY )
                			Incoming.Velocity.Y *= -1.0;
                		if ( bReversesZ )
                			Incoming.Velocity.Z *= -1.0;
                	}	
                	return true;
                }
                
                //-----------------------------------------------------------------------------
                // Teleporter functions.
                
                function Trigger( actor Other, pawn EventInstigator )
                {
                	local Actor A;
                
                	bEnabled = !bEnabled;
                	if ( bEnabled ) //teleport any pawns already in my radius
                		ForEach TouchingActors(class'Actor', A)
                			PostTouch(A);
                }
                
                event Touch(Actor Other)
                {
                	if ( !bEnabled || (Other == None) )
                		return;
                
                	if( Other.bCanTeleport && Other.PreTeleport(Self)==false )
                	{
                		PendingTouch = Other.PendingTouch;
                		Other.PendingTouch = self;
                	}
                }
                
                // Teleporter was touched by an actor.
                simulated function PostTouch( actor Other )
                {
                	local Teleporter D,Dest[16];
                	local int i;
                
                	if( (InStr( URL, "/" ) >= 0) || (InStr( URL, "#" ) >= 0) )
                	{
                		// Teleport to a level on the net.
                		if( (Role == ROLE_Authority) && (Pawn(Other) != None)
                			&& Pawn(Other).IsHumanControlled() )
                			Level.Game.SendPlayer(PlayerController(Pawn(Other).Controller), URL);
                	}
                	else
                	{
                		// Teleport to a random teleporter in this local level, if more than one pick random.
                
                		foreach AllActors( class 'Teleporter', D )
                			if( string(D.tag)~=URL && D!=Self )
                			{
                				Dest[i] = D;
                				i++;
                				if ( i > arraycount(Dest) )
                					break;
                			}
                
                		i = rand(i);
                		if( Dest[i] != None )
                		{
                			// Teleport the actor into the other teleporter.
                			if ( Other.IsA('Pawn') );
                					Dest[i].Accept( Other, self );
                			if ( Pawn(Other) != None )
                				TriggerEvent(Event, self, Pawn(Other));
                		}
                	}
                }
                Worked for me, hope i could help

                Don't forget to rebuild..

                Comment


                  #9
                  It works. I don't know how you managed it but well done indeed. :up: You mention clients. Did you try this out online? Its a very handy thing to have solved imo.

                  In the map I'm placing them in certain good camping spots. The target teleporter is in a 80 x 70 glass case in the enemy base. Therefore the stealth teleporters dont work unless you're crouching in lame spots. The tank is a water volume so unless you suicide, you become a trophy for the enemy. If I can solve question 3, you'll remain an exhibit until you drown.
                  The moral of the story? If you're gonna be a lamer, you'd better make sure it's not my map! :haha: gg & tvm

                  Comment


                    #10
                    And of course, once again me@netcode = fail.

                    Comment

                    Working...
                    X