Announcement

Collapse
No announcement yet.

!! Replication problem? Maybe?

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

    !! Replication problem? Maybe?

    Below is the code to my "Observer" (God bless Starcraft). This is the first vehicle I've ever made and basically the first unrealscript-anything I've "completed". It works awesome in an "Instant Action" local game, but if I load it up into a network game, all people connecting to my listen server have problems with it. They say when they get in it, their view just shakes around and they can't fire, move, or anything... only get out. I'm guessing it's high time I learn about replication cuz that is most likely the issue, I'm guessing. If someone could tell me what I'm doing wrong or what replication I need to add and why (and the replcation statement), I would highly appreciate it.

    Code:
    //The Observer by 'Playerpawn'
    
    class Observer extends ONSAttackCraft
    	placeable;
    
    #exec OBJ LOAD FILE=..\sounds\CicadaSnds.uax
    #exec AUDIO IMPORT FILE="Sounds\pwiYes01.wav" NAME="StartUp" GROUP="Observer"
    #exec AUDIO IMPORT FILE="Sounds\pwiYes00.wav" NAME="ShutDown" GROUP="Observer"
    #exec AUDIO IMPORT FILE="Sounds\pwiWht01.wav" NAME="Report" GROUP="Observer"
    #exec AUDIO IMPORT FILE="Sounds\pwiWht00.wav" NAME="Special" GROUP="Observer"
    
    
    var bool bJustEntered;  //hack so vehicle doesn't cloak if heavily damaged upon entering.
    var bool bIsCloaked;  //tips Tick Function to check Blur or Hidden status.
    var bool bCloakDamaged;  //tips Timer to check for cloak to have regenerated.
    var bool bStealthActive;  //slower speeds activated for better Hidden control.
    
    var int BlurSpeed;  //how fast the craft must be moving to blur when cloaked.
    var int DamagedCloakHealth;  //how low health must be for cloak to break.
    
    var() Sound CloakDamagedSnd;  //sound played when cloak breaks due to damage.
    var() Sound CloakRestoredSnd;  //sound played when cloak restores after being broken.
    
    var Material NormMaterial;  //overlay material when uncloaked.
    var Material PendMaterial;  //overlay material storage value.
    var Material InvisMaterial;  //overlay material when cloaked.
    
    
    simulated event DrivingStatusChanged()
    {
    Super.DrivingStatusChanged();
    
    	if (bDriving)
    		{
    		bJustEntered=True;
    		Cloak(true);
    		SetTimer(1.0,true);
    		ClientMessage("Type OBSHELP in the console for assistance.");
    		}
    
    	if (!bDriving)
    		{
    		Cloak(false);
    		SetTimer(1.0,false);
    		}
    }
    
    
    function Cloak(bool bCloak)
    {
    	if (bJustEntered)
    	{
    	bJustEntered=False;
    	if (Health < DamagedCloakHealth)
    		{
    		bCloakDamaged=True;
    		return;
    		}
    	}
    
    	if (Driver.HasFlag)
    	{
    	ClientMessage("Flag disables cloaking.");
    	return;
    	}
    
    	if ((bCloak) && (bDriving))
    	{
    	bIsCloaked=True;
    	if (OverlayMaterial != InvisMaterial)
    	{
    	NormMaterial=OverlayMaterial;
    	}
    	SetOverlayMaterial(InvisMaterial,999999999,true);
    	bShadowCast=False;
    	}
    
    	if (!bCloak)
    	{
    	bIsCloaked=False;
    	bHidden=False;
    	SetOverlayMaterial(NormMaterial,999999999,true);
    	bShadowCast=True;
    	Visibility=128;
    	}
    }
    
    
    function StealthMode();
    {
    	if (bStealthActive)
    	{
    	//slow speeds down
    	}
    
    	if (!bStealthActive)
    	{
    	//restore normal speeds
    	}
    }
    
    
    function Tick(float DeltaTime)
    {
    	if (bIsCloaked)
    	{
    	if (VSize(Velocity) > BlurSpeed)
    		{
    		bHidden=False;
    		Visibility=40;
    		}
    	if (VSize(Velocity) < BlurSpeed)
    		{
    		bHidden=True;
    		Visibility=0;
    		}
    	}
    
    	if ((bIsWalking) && (!bStealthActive))
    	{
    	ClientMessage("Stealth Mode Activated.");
    	bStealthActive=True;
    	StealthMode();
    	}
    
    	if ((!bIsWalking) && (bStealthActive))
    	{
    	ClientMessage("Stealth Mode Deactivated.");
    	bStealthActive=False;
    	StealthMode();
    	}
    
    Super.Tick(DeltaTime);
    }
    
    
    function Timer()
    {
    	if ((bDriving) && (Health < Healthmax))
    	{
    	if (Health >= DamagedCloakHealth)
    	{
    	Health = Health + 1;
    	}
    	if (Health < DamagedCloakHealth)
    	{
    	Health = Health + 3;
    	}
    	}
    	
    	if (Health > HealthMax)
    	{
    	Health = HealthMax;
    	}
    
    	if((bCloakDamaged) && (Health > DamagedCloakHealth)) 
    	{
    	ClientMessage("Cloaking restored.");
    	bCloakDamaged=False;
    	PlaySound(CloakRestoredSnd,SLOT_Interact,1.0,true,);
    	Cloak(true);
    	}
    	}
    }
    
    
    function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType)
    {
    super.TakeDamage( Damage, instigatedBy, hitlocation, momentum, damageType);
    
    	if ((Health < DamagedCloakHealth) && (!bCloakDamaged) && (bDriving))
    	{
    	ClientMessage("Uncloaked due to damage.");
    	bCloakDamaged=True;
    	PlaySound(CloakDamagedSnd,SLOT_Misc,1.0,true,);
    	Cloak(false);
    	}
    }
    
    
    exec function ObsHelp()
    {
    //insert help menu here
    }
    
    
    defaultproperties
    {
    	VehicleNameString="Observer"
    	VehiclePositionString="in an Observer"
    	StartUpSound=Sound'Observer.Observer.StartUp'
    	ShutDownSound=Sound'Observer.Observer.ShutDown'
    	IdleSound=None
    	StartUpForce=""
    	ShutDownForce=""
    	Health=75
    	HealthMax=75
    	DamagedCloakHealth=37	
    	DriverWeapons(0)=(WeaponClass=Class'Onslaught.ONSAttackCraftGun',WeaponBone="PlasmaGunAttachment")
    	HeadlightCoronaMaterial=None
    	HeadlightCoronaMaxSize=0.0
    	TrailEffectClass=None
    	StreamerEffectClass=None
    	VehicleMass=4.000000
    	bTurnInPlace=True
    	bShowDamageOverlay=True
    	bDriverHoldsFlag=False
    	bCanCarryFlag=True
    	RanOverDamageType=Class'Onslaught.DamTypeAttackCraftRoadkill'
    	CrushedDamageType=Class'Onslaught.DamTypeAttackCraftPancake'
    	MaxDesireability=0.100000
    	HornSounds(0)=None
    	HornSounds(1)=None
    	InvisMaterial=FinalBlend'XEffectMat.Combos.InvisOverlayFB'
    	BlurSpeed=125
    	CloakDamagedSnd=Sound'CicadaSnds.Decoy.DecoyLaunch'
    	CloakRestoredSnd=Sound'CicadaSnds.HUD.TargetLock'
    }
    Thanks in advance. I'll read up on the Wiki about replication but I'm the kinda guy that needs his own work to be put into an example to learn.

    Mad props to whoever can help me out. Thx!

    #2
    COOL!

    Well i dont know the awser to your problem but:
    Me and my friend are working on making a veichle replacement
    (maybe a TC one day) baste on star craft both of us are great modelers i sorta know a bit of coding mostly just how to mess with default propertys.
    but anyways i can see we have the same idea of a mod wana help?
    you can also email me at ut2k4moder@gmail.com

    Comment


      #3
      I have it working. Model an observer, I'll code it to be like Starcraft or whatever is needed.

      Comment


        #4
        k

        um cool thx but that not all i mean
        i ment do you want to help make other things
        what ever has to do with star craft.

        um like join the team

        peas

        BTW when we say star craft we just mean the units we dont mean the RTS stuff

        Comment


          #5
          OH!

          I mis understood what you sead

          i thoght you sed you have a working model of a observer but your asking me to make a model of a observer sure.

          um i will do it right now brb in a hr

          Comment


            #6
            um im gona need

            im gona need some info

            What do you want the skelaton bone names to be and stuff
            how many bones

            Comment


              #7
              I'll e-mail you when I get home. No need to spam the forums with our work.

              Comment

              Working...
              X