Netfix Code Problem....

Discussions about Coding and Scripting
User avatar
zacman
Adept
Posts: 412
Joined: Wed Apr 15, 2009 5:36 am
Personal rank: M-M-M-MONSTER KILL

Netfix Code Problem....

Post by zacman »

Ok, so, I basicly suck at coding. Completely. Most of this code is guesswork. It might be completely retarded Anyway, and never have had a chance of working. Anyway, talking with someone the other day, the topic of Netmodes came up. A long time ago, a MH map I was working on (Which has since been canned) featured a SkaarjWarrior that was insanely fast. Anyway, one issue that occured to me was that such speed would make the skaarj Unhittable online (Because of lag, the Skaarj would be moved before the server processed that the shot had been fired and so you would always miss unless you used something with a big explosion like the Deemer and took it by surprise) And I had the idea for this workaround:

Code: Select all

//=============================================================================
// ZMNSkaarjWarrior.
//=============================================================================
class ZMNSkaarjWarrior expands SkaarjWarrior;

Var() Int OnlineHealth;
Var() float OnlineGroundSpeed;
Var() float OnlineAirSpeed;
Var() float OnlineWaterSpeed;
Var() Float OnlineProjectileSpeed;
Var() Class<Actor> OnlineProjectileClass;
Var() Byte
	OnlineLungeDamage,
	OnlineClawDamage,
	OnlineSpinDamage;

function PostBeginPlay()
{
	Super.PostBeginPlay();
	if(Level.Netmode!=NM_Standalone);
	{
			If(OnlineHealth>0);
				Health = OnlineHealth;
			If(OnlineGroundSpeed>0);
				GroundSpeed = OnlineGroundSpeed;
			If(OnlineAirSpeed>0);
				Airspeed = OnlineAirSpeed;
			If(OnlineWaterSpeed>0);
				WaterSpeed = OnlineWaterSpeed;
			If(OnlineProjectileSpeed>0);
				ProjectileSpeed = OnlineProjectileSpeed;
			If(OnlineProjectileClass!=None);
				ProjectileClass = OnlineProjectileClass;
			If(OnlineLungeDamage>0);
				LungeDamage = OnlineLungeDamage
			If(OnlineClawDamage>0);
				ClawDamage = OnlineClawDamage
			If(OnlineSpinDamage>0);
				SpinDamage = OnlineSpinDamage
	}
}
Unfortunately it won't compile, (Line 21: '{' Bad command or expression)
Anyone know whats wrong with it?
Image[url=steam://friends/add/76561198048595886]Image[/url]
User avatar
Feralidragon
Godlike
Posts: 5502
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Netfix Code Problem....

Post by Feralidragon »

Basically, inform yourself where exactly you should place ";" in this kind of coding language, since that's the very bottom basics of coding in this language. Whitout knowing what you're doing, your code will always have lots of bugs or not even compile.

Dedicate a bit more time in actually learn the basics of coding, so this kind of errors don't happen. Btw, besides that one, you had 14 more mistakes.

I won't explain exactly where, I will just give you the code already corrected, just see where I took ";" away and where I added them (those were the actual corrections):

Code: Select all

//=============================================================================
// ZMNSkaarjWarrior.
//=============================================================================
class ZMNSkaarjWarrior expands SkaarjWarrior;

var() int OnlineHealth;
var() float OnlineGroundSpeed;
var() float OnlineAirSpeed;
var() float OnlineWaterSpeed;
var() float OnlineProjectileSpeed;
var() class<Actor> OnlineProjectileClass;
var() byte
   OnlineLungeDamage,
   OnlineClawDamage,
   OnlineSpinDamage;

function PostBeginPlay()
{
   Super.PostBeginPlay();
   if(Level.Netmode!=NM_Standalone)
   {
         if(OnlineHealth > 0)
            Health = OnlineHealth;
         if(OnlineGroundSpeed > 0)
            GroundSpeed = OnlineGroundSpeed;
         if(OnlineAirSpeed > 0)
            Airspeed = OnlineAirSpeed;
         if(OnlineWaterSpeed > 0)
            WaterSpeed = OnlineWaterSpeed;
         if(OnlineProjectileSpeed > 0)
            ProjectileSpeed = OnlineProjectileSpeed;
         if(OnlineProjectileClass != None)
            ProjectileClass = OnlineProjectileClass;
         if(OnlineLungeDamage > 0)
            LungeDamage = OnlineLungeDamage;
         if(OnlineClawDamage > 0)
            ClawDamage = OnlineClawDamage;
         if(OnlineSpinDamage > 0)
            SpinDamage = OnlineSpinDamage;
   }
}
User avatar
zacman
Adept
Posts: 412
Joined: Wed Apr 15, 2009 5:36 am
Personal rank: M-M-M-MONSTER KILL

Re: Netfix Code Problem....

Post by zacman »

Thanks Ferali :tu:
I learn by doing, so Im learning to code by basicly jumping in and doing it, then asking wut I did wrong when it comes to pieces :P (This is only the 3rd (iirc) script I've done that isn't just a modified Epic script, N00b I am :lol: )
Image[url=steam://friends/add/76561198048595886]Image[/url]