custom respawn/teleporter effects

Discussions about Coding and Scripting

Re: custom respawn/teleporter effects

Postby Barbie » Tue Jan 10, 2017 9:20 pm

OwYeaW wrote:by the way, i want this mutator to be inside the map
So if you want this effect for your own created maps, you can also just subclass the Teleporter (and/or VisibleTeleporter) Actor and overwrite its function
Code: Select all
function PlayTeleportEffect(actor Incoming, bool bOut)
{
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      Level.Game.PlayTeleportEffect(Incoming, bOut, true);
   }
}
You only need a mutator if you want to apply this effect to all maps.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1607
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: custom respawn/teleporter effects

Postby OwYeaW » Tue Jan 10, 2017 9:38 pm

Barbie wrote:
OwYeaW wrote:by the way, i want this mutator to be inside the map
So if you want this effect for your own created maps, you can also just subclass the Teleporter (and/or VisibleTeleporter) Actor and overwrite its function
Code: Select all
function PlayTeleportEffect(actor Incoming, bool bOut)
{
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      Level.Game.PlayTeleportEffect(Incoming, bOut, true);
   }
}

and how to change the teleporter sound?

so since im creating a map with a certain theme, id like to have the players respawn effects & sound changed (not only the teleporters effects & sounds, so i had the idea to create this mutator that overwrites it all at once)
i see you guys replied with some info about this idea but can we get this more simplified? just a simple mutator(or whatever possible actor) to put in the map that overwrites these effects & sounds?
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby sektor2111 » Tue Jan 10, 2017 10:04 pm

So you want a mutator ? Pretty much posted but it needs some implementation, some config, etc. Being configurable you might use that Q3 effect by configuring ini properly without "extract" code, just using that file as it is.
User avatar
sektor2111
Godlike
 
Posts: 3774
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: custom respawn/teleporter effects

Postby OwYeaW » Tue Jan 10, 2017 11:25 pm

alright, im emulating the Q3AMutator and got this now:

Mutator:

Code: Select all
class QuakengMutator expands Mutator;

var() globalconfig bool bTeleportEffect;
var() globalconfig bool bTeleportSound;

simulated function PreBeginPlay()
{
   local QuakengTeleNotify Tele;
   local ScriptedPawn S;

   if(bTeleportEffect)
      Tele = Spawn(Class'QuakengTeleNotify');

   if(bTeleportSound)
      
Super.PreBeginPlay();
}

SpawnNotify:

Code: Select all
class QuakengTeleNotify expands SpawnNotify;

simulated event Actor SpawnNotification(Actor A)
{
   local Actor O, OG;
   local Vector L, LA;
   local Rotator R, RA;
   local class<Actor> aClass;

   if(A.IsA('UTTeleportEffect'))
   {
      O = A.Owner;
      L = A.Location;
      R = A.Rotation;

      A.SetCollision(False,False,False);
      A.Destroy();

      aClass = class<Actor>(DynamicLoadObject("QuakengEffects.QuakeTeleportEffect", class'Class'));

      if(aClass == None)
         return None;

      A = Spawn(Class'QuakeTeleportEffect',O,,L,R);

      if(A == None)
         return None;
   }

   return A;
}

so now whats left open is bTeleportSound
i guess this should be done with a sub-class from DeathMatchPlus as explained by Rocky
Code: Select all
function PlayTeleportEffect( actor Incoming, bool bOut, bool bSound)
{
   local QuakeTeleportEffect PTE;

   if ( bRequireReady && (Countdown > 0) )
      return;

   if ( Incoming.bIsPawn && (Incoming.Mesh != None) )
   {
      if ( bSound )
      {
         PTE = Spawn(class'QuakengEffects.QuakeTeleportEffect',Incoming,, Incoming.Location, Incoming.Rotation);
         PTE.Initialize(Pawn(Incoming), bOut);
         PTE.PlaySound(sound'QuakengSounds.Tele2',, 10.0);
      }
   }
}

so if i make the sub-class of DeathMatchPlus with only this, would that be all thats needed for the sub-class?
and how can the "if(bTeleportSound)" 'activate' the sub-class of DeathMatchPlus?

--Edit by UnrealGGecko--

wauw the Mutator + SpawnNotify works :)
although only the first 2 times spawning has the original teleport sound(Resp2A)
after spawning 2 times, there is no teleport sound at all, not by spawning and not by teleporting
so now: how to complete the scripts?
Last edited by UnrealGGecko on Wed Jan 18, 2017 2:25 pm, edited 1 time in total.
Reason: Merged posts
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby sektor2111 » Wed Jan 11, 2017 12:08 am

Meh, I did a mutator but looks only a little operational in my custom DM and NOT that much operational in original DM from Botpack. I was using UnrealShare.PawnTeleportEffect, lol.
Yep... answer is another game-type - Like I have in MH2, old teleport effect...
User avatar
sektor2111
Godlike
 
Posts: 3774
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: custom respawn/teleporter effects

Postby OwYeaW » Thu Jan 12, 2017 12:46 am

i want to lower the custom teleport effect by a few units
how can i do this?
Code: Select all
class QuakengTeleNotify expands SpawnNotify;

simulated event Actor SpawnNotification(Actor A)
{
   local Actor O, OG;
   local Vector L, LA;
   local Rotator R, RA;
   local class<Actor> aClass;

   if(A.IsA('UTTeleportEffect'))
   {
      O = A.Owner;
      L = A.Location;
      R = A.Rotation;

      A.SetCollision(False,False,False);
      A.Destroy();

      aClass = class<Actor>(DynamicLoadObject("QuakengEffects.QuakeTeleportEffect", class'Class'));

      if(aClass == None)
         return None;

      A = Spawn(Class'QuakeTeleportEffect',O,,L,R);

      if(A == None)
         return None;
   }

   return A;
}
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby Barbie » Thu Jan 12, 2017 1:01 am

OwYeaW wrote:i guess this should be done with a sub-class from DeathMatchPlus
You want to embed a modified game type into your map? AFAIK the game type is given in the URL that loads the map so that an embedded game type will have no effect. Correct me if I'm wrong...

OwYeaW wrote:i want to lower the custom teleport effect by a few units

Code: Select all
L = A.Location + vect(0, 0, -123);

"-123" is measured in UU units.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1607
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: custom respawn/teleporter effects

Postby OwYeaW » Thu Jan 12, 2017 1:36 am

Barbie wrote:
OwYeaW wrote:i guess this should be done with a sub-class from DeathMatchPlus
You want to embed a modified game type into your map? AFAIK the game type is given in the URL that loads the map so that an embedded game type will have no effect. Correct me if I'm wrong...

i dont have enough knowledge to see the possibilities that i can choose from, but my guess would be to not change the gametype because i want it to be played on online servers
isnt there a possibility to use the same method as done with the effect? destroy default effect and spawn custom effect?
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby Barbie » Thu Jan 12, 2017 3:14 am

OwYeaW wrote:isnt there a possibility to use the same method as done with the effect?
I'd do that with a custom Teleporter, PlayerStart and whatever else that uses that default effects.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1607
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: custom respawn/teleporter effects

Postby OwYeaW » Thu Jan 12, 2017 4:42 am

Barbie wrote:I'd do that with a custom Teleporter, PlayerStart and whatever else that uses that default effects.

alright then ill forget about the mutator now
so how can i make those Teleporters and PlayerStarts?
ive already spend hours on the mutator so it would be nice if you can give me the codes straightaway

here is a teleporter i made earlier to fix the bChangesYaw
Code: Select all
class QuakengTeleporter expands FavoritesTeleporter;

var UTTeleEffect T;

simulated function Destroyed()
{
    if ( T != None )
        T.Destroy();
    Super.Destroyed();
}

simulated function PostBeginPlay()

{
    LoopAnim('Teleport', 2.0, 0.0);
}
simulated function bool Accept( actor Incoming, Actor Source )
{
   return Super.Accept( Incoming, None );
}

(it has something strange that even when it has no URL it will give the message: Teleport destination for Autoplay.QuakengTeleporter0 not found!, i fixed this by doing bCollideActors=False)
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby Barbie » Thu Jan 12, 2017 5:59 am

Let's break up this in smaller tasks:
OwYeaW wrote:
Code: Select all
class QuakengTeleporter expands FavoritesTeleporter;
Wiki says: This [FavoritesTeleporter] class is broken, it acts the same as a normal Teleporter.
OwYeaW wrote:it has something strange that even when it has no URL it will give the message: Teleport destination for Autoplay.QuakengTeleporter0 not found!, i fixed this by doing bCollideActors=False)
That message appears if the destination URL is empty or not found. As a thumb rule: use Teleporter if it is intended as an invisible teleport destination only (here URL is empty), else use VisibleTeleporter.
OwYeaW wrote:here is a teleporter i made earlier to fix the bChangesYaw
That thing really worked concerning Yaw changing? I cannot see any relation to that... In the Wiki you can find an example of a YawTeleporter .

OwYeaW wrote:so how can i make those Teleporters and PlayerStarts?
I assume you know how to subclass Actors, enter the code, compile it and add these custom Actors to your map - if not, just reply. For the following replacements I took the original code, commented out the Level.Game.PlayTeleportEffect() function and added a custom function PlayMyTeleportEffect(Actor Incoming) instead:
Replacements
Code: Select all
class MyTeleporter extends Teleporter;

function PlayTeleportEffect(actor Incoming, bool bOut) {
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      //Level.Game.PlayTeleportEffect(Incoming, bOut, true);
      PlayMyTeleportEffect(Incoming);
   }
}

Code: Select all
class MyVisibleTeleporter extends VisibleTeleporter;

function PlayTeleportEffect(actor Incoming, bool bOut) {
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      //Level.Game.PlayTeleportEffect(Incoming, bOut, true);
      PlayMyTeleportEffect(Incoming);
   }
}

Code: Select all
class MyPlayerStart extends PlayerStart;

function PlayTeleportEffect(actor Incoming, bool bOut)
{
   if ( Level.Game.bDeathMatch && Incoming.IsA('PlayerPawn') )
      PlayerPawn(Incoming).SetFOVAngle(135);
   //Level.Game.PlayTeleportEffect(Incoming, bOut, Level.Game.bDeathMatch );
   PlayMyTeleportEffect(Incoming);
}
You have to add your custom function PlayMyTeleportEffect(Actor Incoming) to all three Actors and do your custom effects there.
<EDIT>
Because the PlayTeleportEffect() of the Translocator cannot be handled in this way, I'm just testing SpawnNotify for this although I don't like this actor. Stay tuned...
</EDIT>
<EDIT2>
If a Translocator is used in your map you can add the the following Actor instead of above replacements:
Code: Select all
class MySpawnNotify expands SpawnNotify;

simulated event Actor SpawnNotification(Actor A) {
local class<Actor> aClass;
local PawnTeleportEffect MyEffect;

   if (A.Class == class'UTTeleportEffect')
   {
      aClass = class<Actor>(DynamicLoadObject("UnrealShare.PawnTeleportEffect", class'Class'));
      if (aClass != None)
      {
         // your effect starts here:
         MyEffect = Spawn(Class'PawnTeleportEffect', , , A.Location, A.Rotation);
         // your effect ends here
         if (MyEffect != None && A.Destroy())
            return MyEffect;
      }
   }
   return A;
}
Test map attached.
</EDIT2>
Attachments
TestTeleportEffect.7z
Example map with MySpawnNotify actor
(2.96 KiB) Downloaded 41 times
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1607
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: custom respawn/teleporter effects

Postby OwYeaW » Thu Jan 12, 2017 7:35 am

Barbie wrote:That thing really worked concerning Yaw changing? I cannot see any relation to that... In the Wiki you can find an example of a YawTeleporter .

lol yea the script didnt seem to make sense but worked
i used that code from the wiki, but when compiling it had an error so i removed a lot of lines until it didnt give an error anymore :P
the problem is this line: (Incoming.Rotation);
pretty strange that people put a bad code on the wiki

Replacements
Code: Select all
class MyTeleporter extends Teleporter;

function PlayTeleportEffect(actor Incoming, bool bOut) {
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      //Level.Game.PlayTeleportEffect(Incoming, bOut, true);
      PlayMyTeleportEffect(Incoming);
   }
}

Code: Select all
class MyVisibleTeleporter extends VisibleTeleporter;

function PlayTeleportEffect(actor Incoming, bool bOut) {
   if ( Incoming.IsA('Pawn') )
   {
      Incoming.MakeNoise(1.0);
      //Level.Game.PlayTeleportEffect(Incoming, bOut, true);
      PlayMyTeleportEffect(Incoming);
   }
}

Code: Select all
class MyPlayerStart extends PlayerStart;

function PlayTeleportEffect(actor Incoming, bool bOut)
{
   if ( Level.Game.bDeathMatch && Incoming.IsA('PlayerPawn') )
      PlayerPawn(Incoming).SetFOVAngle(135);
   //Level.Game.PlayTeleportEffect(Incoming, bOut, Level.Game.bDeathMatch );
   PlayMyTeleportEffect(Incoming);
}

nice these work good, and how to replace their sounds?
i wont be using a translocator but thanks anyway
(although the mutator i made did the same as all these scripts do now so...)
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

Re: custom respawn/teleporter effects

Postby Barbie » Thu Jan 12, 2017 8:29 am

OwYeaW wrote:i used that code from the wiki, but when compiling it had an error so i removed a lot of lines until it didnt give an error anymore :P
the problem is this line: (Incoming.Rotation);
pretty strange that people put a bad code on the wiki
That YawTeleporter was created by Wormbo and later changed by AX000. Maybe he put that erroneous line in there. @Wormbo: can you have a look there and correct that?

OwYeaW wrote:nice these work good, and how to replace their sounds?
Have you really tried MyVisibleTeleporter for example? If you don't play a sound in your custom function PlayMyTeleportEffect() that teleporter stays quite.

The usual teleport sound is created in DeathMatchPlus.PlayTeleportEffect(): an UTTeleportEffect is spawned there (replaced by PawnTeleportEffect if you use that MySpawnNotify) and it is given the sound 'Resp2A'. When using MySpawnNotify the sound can be suppressed by returning None from SpawnNotification() but Server admins will bite you because every time two Access None appears in log because of shortsighted stock code in DeathMatchPlus.PlayTeleportEffect().
DeathMatchPlus.PlayTeleportEffect
Code: Select all
function PlayTeleportEffect( actor Incoming, bool bOut, bool bSound)
{
   local UTTeleportEffect PTE;

   if ( bRequireReady && (Countdown > 0) )
      return;

   if ( Incoming.bIsPawn && (Incoming.Mesh != None) )
   {
      if ( bSound )
      {
         PTE = Spawn(class'UTTeleportEffect',Incoming,, Incoming.Location, Incoming.Rotation);
         PTE.Initialize(Pawn(Incoming), bOut);
         PTE.PlaySound(sound'Resp2A',, 10.0);
      }
   }
}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Barbie
Godlike
 
Posts: 1607
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: custom respawn/teleporter effects

Postby sektor2111 » Thu Jan 12, 2017 4:09 pm

You still don't get that a new subclass of game-type is solving problem in a clean state with 0 issues and even more than that...
User avatar
sektor2111
Godlike
 
Posts: 3774
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: custom respawn/teleporter effects

Postby OwYeaW » Thu Jan 12, 2017 9:14 pm

sektor2111 wrote:You still don't get that a new subclass of game-type is solving problem in a clean state with 0 issues and even more than that...

im not sure to who youre talking, to me?
as ive explained the map should be playable on online servers and everything should be inside the map itself, (to my small knowledge) it seems that a new gametype is definitely not what i need
Barbie wrote:Have you really tried MyVisibleTeleporter for example? If you don't play a sound in your custom function PlayMyTeleportEffect() that teleporter stays quite.

i didnt have much time so i quickly played your test map and it seemed to work fine, but apparently i see now that your test map uses the SpawnNotify and not the custom Teleporter and custom PlayerStart
sooo... i tried to compile those subclasses but they gave errors at "PlayMyTeleportEffect(Incoming);"
i did some trial and error stuff to make it work but i just have too less knowledge on this so ill probably end up wasting hours on figuring out a few simple lines of code
since the codes dont work for me(im probably missing something), how to complete the code?

and just for clarification, this is what i need:
1. a custom PlayerStart that spawns a custom Sound and a custom Effect
2. a custom Teleporter that spawns a custom Sound and a custom Effect
OwYeaW
Average
 
Posts: 56
Joined: Fri Jan 09, 2015 4:24 pm

PreviousNext

Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 1 guest