MMImTyping Bubble Issues (Caution-side scroll and mad code!)

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

MMImTyping Bubble Issues (Caution-side scroll and mad code!)

Postby Allan » Tue Jan 02, 07 7:16 am

Well, I've tried everything I can think of, but come to naught.

I am having a hell of a load of problems with making my bubbles synchronised with a players movement. This is, in fact, a bug that's been pissing me off since the very creation of the mod (where it would spew the bubbles everywhere!)

I'm posting up the files for the package, from the unprotected version.

Also, if you could help me find out how I can see if a player is typing in the command "god", that'd also be a big help. :)

Peacies :)




Code: Select all
//=============================================================================
// IAmTypingBubble.
//=============================================================================
class IAmTypingBubble expands Effects;

#exec TEXTURE IMPORT NAME=SpeechBubble FILE=textures\SpeechBubbleTex.bmp GROUP=Skins
#exec TEXTURE IMPORT NAME=Bubble_A01 FILE=textures\Typingbloon_A01.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A02 FILE=textures\Typingbloon_A02.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A03 FILE=textures\Typingbloon_A03.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A04 FILE=textures\Typingbloon_A04.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A05 FILE=textures\Typingbloon_A05.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A06 FILE=textures\Typingbloon_A06.bmp GROUP=Icon
#exec TEXTURE IMPORT NAME=Bubble_A07 FILE=textures\Typingbloon_A07.bmp GROUP=Icon

// --- Importing scripts for the 3d-bubble. (It pwns)

#exec MESH IMPORT MESH=SpeechBubble ANIVFILE=MODELS\SpeechBubble_a.3d DATAFILE=MODELS\SpeechBubble_d.3d X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=SpeechBubble X=0 Y=0 Z=0
#exec MESH SEQUENCE MESH=SpeechBubble SEQ=All STARTFRAME=0 NUMFRAMES=1
#exec MESH SEQUENCE MESH=SpeechBubble SEQ=Still STARTFRAME=0 NUMFRAMES=1
#exec MESHMAP NEW MESHMAP=SpeechBubble MESH=SpeechBubble
#exec MESHMAP SCALE MESHMAP=SpeechBubble X=0.084062 Y=0.084062 Z=0.084062
#exec MESHMAP SETTEXTURE MESHMAP=SpeechBubble NUM=0 TEXTURE=SpeechBubble

var int BubbleDisplayMode;
var float Scale;
var bool bInReverse, bAttached;
var DeusExPlayer AttachedPlayer;

replication
{
   Reliable If(Role==ROLE_Authority)
      FollowTyper;
}

Function PostBeginPlay()
{
   Super.PostBeginPlay();
   bInReverse=False;
}

Simulated Function EditDisplayBasedOnMode()
{
   if(BubbleDisplayMode==1)
   {
      Style=STY_Masked;
      Texture=Texture'MMImTyping110.Icon.Bubble_A01';
      bUnlit=True;
      Mesh=None;
      DrawType=DT_Sprite;
   }
   else if(BubbleDisplayMode==2)
   {
      Style=STY_Masked;
      Texture=Texture'DeusExUI.UserInterface.DatalinkIcon';
      bUnlit=True;
      Mesh=None;
      DrawType=DT_Sprite;
   }
   else if(BubbleDisplayMode==3)
   {
      Style=STY_Normal;
      Texture=None;
      bUnlit=False;
      Mesh=LodMesh'MMImTyping110.SpeechBubble';
      DrawType=DT_Mesh;
   }
}

Function Tick(Float Deltatime)
{
   local DeusExPlayer myPlayer;
   if (AttachedPlayer == None)
   {
      SetTimer(1.0,False);
   }
   else
   {
      FollowTyper();
   }
   
   if(!bInReverse)
   {
      Scale+=Deltatime;
   }
   else if(bInReverse)
   {
      Scale-=Deltatime;
   }
   EditDisplayBasedOnMode();
   if(Scale>1)
   {
      bInReverse=True;
   }
   else if(Scale<0)
   {
      bInReverse=False;
   }
   DrawScale=0.5+Scale;
}

Simulated function FollowTyper()
{
   local vector AttachLocation;

   AttachLocation=AttachedPlayer.Location;
   AttachLocation.Z+=AttachedPlayer.CollisionHeight+10;
   bAttached=True;
   SetLocation(AttachLocation);
}

function Timer()
{
   if(!bAttached)
   {
      Destroy();
   }
}

defaultproperties
{
     Physics=PHYS_Rotating
     LifeSpan=600.000000
     DrawType=DT_Sprite
     Style=STY_Masked
     Texture=Texture'MMImTyping110.Icon.Bubble_A01'
     bUnlit=True
     bFixedRotationDir=True
     RotationRate=(Yaw=16383)
}
IAmTypingBubble

Code: Select all
//=============================================================================
// MMIAmTyping.
//=============================================================================
class MMIAmTyping expands Mutator config (MMIAmTyping);

enum DisplayMode
{
   Mode_Classic,
   Mode_Datalink,
   Mode_3D
};

var Pawn P;
var bool bActivated;
var() string version;
Var config DisplayMode BubbleDisplayMode;
var config bool bActive,bTypersInGod,bPunishTypeKilling,bHideCloakerBubble,bCloakNoTKPen,bDisplayLogInfo;
var int Warnings[1024];
var Config Int WarningsPreKick, KickMessageColour,WarningMessageColour,SecondsTKStart,SecondsTKEnd;
var IAmTypingBubble Bubble[1024];
var name PriorState[1024]; // The last ReducedDamageType the player had before typing. (Used to keep godders godded, etc...)
var int bStillTyping[1024],TypeTimer[1024]; // I used an int array using only values of 1 and 0 to represent True and false, as you can't have Boolean arrays...

Replication
{
   Reliable if(Role==ROLE_Authority)
      Bubble;
}

Function PostBeginPlay()
{
   local int i;
   
   for (i=0;i<1024;i++)
   {
      Bubble[i]=None;
      Warnings[i]=0;
      PriorState[i]='';
      bStillTyping[i]=0;
   }
   bActivated=bActive;   
   if(bActive)
   {
      Log("MMImTyping is now active.",'MMImTyping');
      if(bTypersInGod)
      {
         Log("Typers are god-moded add-on activated.",'MMImTyping');
      }
      SetTimer(0.333333,True);
   }
   else
   {
      Log("MMImTyping is not active.",'MMImTyping');
   }
   SaveConfig();
   Super.PostBeginPlay();
}

Function EditBubble(int IDNumber,DeusExPlayer D)
{
   if((Bubble[IDNumber]!=None)&&(D!=None))
   {
      if(bHideCloakerBubble)
      {
         if(D.Style==STY_Translucent)
         {
            Bubble[IDNumber].bHidden=True;
         }
         else
         {
            Bubble[IDNumber].bHidden=False;
         }
      }
      if(Bubble[IDNumber].AttachedPlayer==None)
      {
         Bubble[IDNumber].AttachedPlayer=D;
      }
      if(BubbleDisplayMode==Mode_Classic)
      {
         Bubble[IDNumber].BubbleDisplayMode=1;
      }
      else if(BubbleDisplayMode==Mode_Datalink)
      {
         Bubble[IDNumber].BubbleDisplayMode=2;
      }
      else if(BubbleDisplayMode==Mode_3D)
      {
         Bubble[IDNumber].BubbleDisplayMode=3;
      }
   }
}

Function Timer()
{
   local Int ID;

   if(bActivated)
   {
      for(P=Level.PawnList;P!=None;P=P.NextPawn)
      {
         if(P.IsA('DeusExPlayer'))
         {
            if((DeusExPlayer(P)!=None)&&(DeusExPlayer(P).PlayerReplicationInfo.PlayerID<1000))
            // Check if someone even exists, and if they do, that they aren't on TelNet(So far as I know, Telnet ID's are always are always >=1000).
            {
               ID=DeusExPlayer(P).PlayerReplicationInfo.PlayerID;
               if((bStillTyping[ID]==0)&&(DeusExPlayer(P).bIsTyping))
               {
                  Bubble[ID]=Spawn(class'IAmTypingBubble',,,DeusExPlayer(P).Location+Vect(0,0,55));
                  if(Bubble[ID]!=None)
                  {
                     ModBubbleForMoving(ID,DeusExPlayer(P));
                  }
               }
               if(DeusExPlayer(P).bIsTyping)
               {
                  TypeTimer[ID]++;
                  bStillTyping[ID]=1;
                  if(Bubble[ID]!=None)
                  {
                     EditBubble(ID,DeusExPlayer(P));
                     if(bTypersInGod)
                     {
                        PriorState[ID]=DeusExPlayer(P).ReducedDamageType;
                        DeusExPlayer(P).ReducedDamageType='All';
                     }
                  }
                  else
                  {
                     bStillTyping[ID]=0;
                  }
               }
               else if((!DeusExPlayer(P).bIsTyping)&&(Bubble[ID]!=None))
               {
                  Bubble[ID].Destroy();
                  TypeTimer[ID]=0;
                  if(bTypersInGod)
                  {
                     DeusExPlayer(P).ReducedDamageType=PriorState[ID];
                     PriorState[ID]='';
                  }
                  bStillTyping[ID]=0;
               }
            }
         }
      }
   }
}

Function ModBubbleForMoving(int IDNumber,DeusExPlayer D)
{
   Bubble[IDNumber].SetBase(D);
}

function ScoreKill(pawn Killer, pawn Other)
{
   if(bActivated)
   {
      if((DeusExPlayer(Other)!=None)&&(DeusExPlayer(killer)!=None))
      {
         if ((DeusExPlayer(Other).bIsTyping)&&(DeusExPlayer(Killer)!=DeusExPlayer(Other))&&(bPunishTypeKilling))
         {
            if((TypeTimer[DeusExPLayer(Other).PlayerReplicationInfo.PlayerID]>=SecondsTKStart*3)&&(TypeTimer[DeusExPLayer(Other).PlayerReplicationInfo.PlayerID]<=SecondsTKEnd*3))
            {
               if((Other.Style==STY_Translucent)&&(bCloakNoTKPen))
               {
                  Other.ClientMessage("|c401000You have been Type-Killed in cloak. As people can't see you, this kill cannot be penalised. Sorry.");
                  Super.ScoreKill(Killer,Other);
                  Return;
               }
               if(WarningsPreKick<=1)
               {
                  Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]=0;
                  DeusExPlayer(Killer).ClientMessage("You have comitted too many Type-Kills, and have been kicked.");
                  DeusExPlayer(Killer).ForceDisconnect("You have comitted too many Type-Kills, and have been kicked.");
                  DeusExPlayer(Other).BroadcastMessage("|P"$KickMessageColour$""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been kicked for type-killing!!!");
                  if(bDisplayLogInfo)
                  log(""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been kicked for excessive type-killing.",'MMImTyping');
               }
               else
               {
                  Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]++;
                  if(Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]>=WarningsPreKick)
                  {
                     Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]=0;
                     DeusExPlayer(Killer).ClientMessage("You have comitted too many Type-Kills, and have been kicked.");
                     DeusExPlayer(Killer).ForceDisconnect("You have comitted too many Type-Kills, and have been kicked.");
                     DeusExPlayer(Other).BroadcastMessage("|P"$KickMessageColour$""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been kicked for type-killing!!!");
                     if(bDisplayLogInfo)
                     log(""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been kicked for excessive type-killing.",'MMImTyping');
                  }
                  else
                  {
                     if(WarningsPreKick-Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]==1) // Fixed small error here, for nicer grammar. Used to read from Other, instead of Killer.
                     {
                        DeusExPlayer(Other).BroadcastMessage("|P"$WarningMessageColour$""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been warned for type-killing. They have "$WarningsPreKick-Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]$" warning remaining.");
                        if(bDisplayLogInfo)
                        log(""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has "$WarningsPreKick-Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]$" warning remaining.",'MMImTyping');
                     }
                     else
                     {
                        DeusExPlayer(Other).BroadcastMessage("|P"$WarningMessageColour$""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has been warned for type-killing. They have "$WarningsPreKick-Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]$" warnings remaining.");
                        if(bDisplayLogInfo)
                        log(""$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerName$"("$DeusExPlayer(Killer).PlayerreplicationInfo.PlayerID$") has "$WarningsPreKick-Warnings[DeusExPlayer(Killer).PlayerReplicationInfo.PlayerID]$" warning remaining.",'MMImTyping');
                     }
                  }
               }
            }
         }
      }
      Super.ScoreKill(Killer,Other);
   }
}

function Mutate(string MutateString, PlayerPawn Sender)
{
   local Actor A;
   local Pawn P;
   local DeusExPlayer PlayerP;
   local IAmtypingBubble B;

   if (MutateString ~= "MMImTyping.Version")
   {
      Sender.ClientMessage(version);
   }
   if(Sender.bAdmin)
   {
      if (MutateString ~= "MMImTyping.Off")
      {
         if(bActivated)
         {
            bActivated=False;
            Foreach AllActors(class'IamTypingBubble', B)
            {
               B.Destroy();
            }
            BroadcastMessage("MMImTyping -- Typing Mutator has been turned off by "$Sender.PlayerReplicationInfo.PlayerName$".");
            log("MMImTyping has been turned off by "$Sender.PlayerReplicationInfo.PlayerName$".",'MMImTyping');
         }
         else
         {
            Sender.ClientMessage("MMImTyping -- Typing Mutator is already off.");
         }
      }
      if (MutateString ~= "MMImTyping.On")
      {
         if(!bActivated)
         {
            bActivated=True;
            BroadcastMessage("MMImTyping -- Typing Mutator has been turned on by "$Sender.PlayerReplicationInfo.PlayerName$".");
            log("MMImTyping has been turned on by "$Sender.PlayerReplicationInfo.PlayerName$".",'MMImTyping');
         }
         else
         {
            Sender.ClientMessage("MMImTyping -- Typing Mutator is already on.");
         }
      }
   }
   else
   {
      Sender.ClientMessage("|c401000MMImTyping -- Only admins can activate/deactivate the mutator.");
   }
   Super.Mutate(MutateString,Sender);
}

defaultproperties
{
     version="This is version 110(v1.1) of MMImTyping. Coded by [A]llan. Avaliable for download at: 'http://www.dxalpha.com/forum/' (Without quotes, of course!)"
     BubbleDisplayMode=Mode_3D
     bActive=True
     bPunishTypeKilling=True
     bHideCloakerBubble=True
     WarningsPreKick=3
     KickMessageColour=2
     WarningMessageColour=3
     SecondsTKStart=4
     SecondsTKEnd=105
}


MMIAmTyping (Mutator code)
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.

Postby Dae » Tue Jan 02, 07 11:48 am

Holy crap.. thats lots of code.

Could you describe the problem? (how does the bubble act when you move?)
User avatar
Dae
Alpha
 
Posts: 12086
Joined: Sat Sep 06, 03 4:40 pm

Postby Allan » Tue Jan 02, 07 2:09 pm

The bubble follows you for about 0.2 seconds, then just floats on its own.

Oddly though, if you are in cloak, it seems to follow you until you un-cloak =S

(Prehaps this board could do with attachments mod? Seems to be disabled here :? )
User avatar
Allan
Alpha
 
Posts: 4545
Joined: Wed Dec 21, 05 1:41 pm
Location: Northamptonshire, England.


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 5 guests