drzovil
01-12-2010, 05:08 AM
Studying MasteringUnrealScriptDelegates in UDK Documentation, I think I came across some typos. Maybe they are not typos but just results of my lack of understanding on Unreal Script, haha~:cool:. Anyway I spent several hours in dealing with the seeming typos and it just worked fine when I corrected them.
If they are not typos but just another way of scripting, do not hesitate to point them out.
#1. 12.1 - OVERVIEW
delegate Bar();
function Foo(float value)
{
switch (value)
{
case 0:
Bar = DoThis();
break;
case 1:
Bar = DoThat();
break;
default:
Bar = DoDefault();
break;
}
Bar();
}
The braces are redundancy.
delegate Bar();
function Foo(float value)
{
switch (value)
{
case 0:
Bar = DoThis;
break;
case 1:
Bar = DoThat;
break;
default:
Bar = DoDefault;
break;
}
Bar();
}
#2. TUTORIAL 12.5.1
function GiveRedeemerToAll()
{
locale UTPawn P;
foreach WorldInfo.AllPawns(class'UTPawn', P)
{
}
}
Update
#3. TUTORIAL 12.6.1
class UTMutator_RandomEvent extends UTMutator;
private var array<UTPickupFactory> PickupFactories;
Update
#4. TUTORIAL 12.4.3
Well, the following code leads to errors, that are unresolved references.
It is because the classes aren't included in UDK. Probably they'll be shipped with the book. If you'd like to see how this tutorial goes by yourself before publication, you could try with other alternatives.
P.ThighpadArmor = Max(class'UTArmorPickup_Thighpads'.default.ShieldA mount, P.ThighpadArmor);
if (P.Health >= 80)
P.VestArmor = Max(class'UTArmorPickup_Vest'.default.ShieldAmount , P.VestArmor);
if (P.Health >= 90)
P.HelmetArmor = Max(class'UTArmorPickup_Helmet'.default.ShieldAmou nt, P.HelmetArmor);
One alternative could be
P.ThighpadArmor = Max(class'UTArmorPickup_Thighpad'.default.ShieldAm ount, P.ThighpadArmor);
S = class'UTArmorPickup_Thighpad'.default.PickupSound;
if (P.Health >= 80)
P.VestArmor = Max(class'UTArmorPickup_BaseArmor'.default.ShieldA mount, P.VestArmor);
S = class'UTArmorPickup_BaseArmor'.default.PickupSound ;
if (P.Health >= 90)
P.HelmetArmor = Max(class'UTArmorPickup_ShieldBelt'.default.Shield Amount, P.HelmetArmor);
S = class'UTArmorPickup_ShieldBelt'.default.PickupSoun d;
If they are not typos but just another way of scripting, do not hesitate to point them out.
#1. 12.1 - OVERVIEW
delegate Bar();
function Foo(float value)
{
switch (value)
{
case 0:
Bar = DoThis();
break;
case 1:
Bar = DoThat();
break;
default:
Bar = DoDefault();
break;
}
Bar();
}
The braces are redundancy.
delegate Bar();
function Foo(float value)
{
switch (value)
{
case 0:
Bar = DoThis;
break;
case 1:
Bar = DoThat;
break;
default:
Bar = DoDefault;
break;
}
Bar();
}
#2. TUTORIAL 12.5.1
function GiveRedeemerToAll()
{
locale UTPawn P;
foreach WorldInfo.AllPawns(class'UTPawn', P)
{
}
}
Update
#3. TUTORIAL 12.6.1
class UTMutator_RandomEvent extends UTMutator;
private var array<UTPickupFactory> PickupFactories;
Update
#4. TUTORIAL 12.4.3
Well, the following code leads to errors, that are unresolved references.
It is because the classes aren't included in UDK. Probably they'll be shipped with the book. If you'd like to see how this tutorial goes by yourself before publication, you could try with other alternatives.
P.ThighpadArmor = Max(class'UTArmorPickup_Thighpads'.default.ShieldA mount, P.ThighpadArmor);
if (P.Health >= 80)
P.VestArmor = Max(class'UTArmorPickup_Vest'.default.ShieldAmount , P.VestArmor);
if (P.Health >= 90)
P.HelmetArmor = Max(class'UTArmorPickup_Helmet'.default.ShieldAmou nt, P.HelmetArmor);
One alternative could be
P.ThighpadArmor = Max(class'UTArmorPickup_Thighpad'.default.ShieldAm ount, P.ThighpadArmor);
S = class'UTArmorPickup_Thighpad'.default.PickupSound;
if (P.Health >= 80)
P.VestArmor = Max(class'UTArmorPickup_BaseArmor'.default.ShieldA mount, P.VestArmor);
S = class'UTArmorPickup_BaseArmor'.default.PickupSound ;
if (P.Health >= 90)
P.HelmetArmor = Max(class'UTArmorPickup_ShieldBelt'.default.Shield Amount, P.HelmetArmor);
S = class'UTArmorPickup_ShieldBelt'.default.PickupSoun d;