Feralidragon wrote:Just... why?
Not that I haven't written a few lengthy function declarations in the past, but that was only when I didn't know any better...
Nowadays if a function has anything over 6 arguments, I personally already consider to be a lot. But 32? Damn.
Cough... Here was about setting up some... added stuff addressing a random particular map problem (or just simple stuff added).
As direct application if map is poorly loaded in some spot, I might spawn things/creatures/items in patch modules mapped as packages and loaded in run-time. These being actors, I might want to setup whatever properties immediately after spawn - as in above case, I set Skin(s), some event, whatever name held by Pawn, even an animation used, not "Fighter" crap. I can keep going with various things (SkaarjTrooper stuff, movement properties, net things without writing a new Pawn for a few properties) just using default Pawns. Even default crapped Pupae might go better with another Pivot and a fresh carcass if goes skinned like a rainbow, orders, alarms, etc, etc.
When I have a function set I can duplicate line changing only location vector without copying blocks and writing long codes for each creature added. But... I think I can combine 2 functions for other completions preventing X pages of scripts written, so I can complete the rest of needs... because I'm not a fan of long scripts writing codes for ages. Probably even 3 functions will help, I'll think about...
This week-end I was a bit out and I did not have a bunch of free time but I'll do some stuff next days if free time won't be eaten by other things (stupid IoT-s devices are triggering me...).
Here I'm sampling incomplete stuff because of this limitation...
Code: Select all
final function SetNewMonster( Pawn aPawn, optional int HP,
optional float DS,
optional bool bRandProj,
optional name MstEvent,
optional string AMenu,
optional Texture aSkin,
optional float ZPivotAdj,
optional Texture MultiSkin0,
optional Texture MultiSkin1,
optional Texture MultiSkin2,
optional Texture MultiSkin3,
optional Texture MultiSkin4,
optional Texture MultiSkin5,
optional Texture MultiSkin6,
optional Texture MultiSkin7 )
// optional name Anim )
{
local int I;
local class<Projectile> ProjType;
if (aPawn == None || aPawn.bDeleteMe)
{
GoTo NothingToDo;
}
else
{
if ( HP != 0 )
aPawn.Health = int(RandRange(aPawn.class.Default.Health*2+(HP/2),
aPawn.class.Default.Health*2+HP));
if (bRandProj)
if ( ScriptedPawn(aPawn) != None && ScriptedPawn(aPawn).default.RangedProjectile != None )
{
I = Rand(5);
if ( I > 4 ) I = 4;
switch(I)
{
case 0: ProjType = Class'RocketMk2';
break;
case 1: ProjType = Class'CannonShot';
break;
case 2: ProjType = Class'Razor2Alt';
break;
case 3: ProjType = Class'UT_Grenade';
break;
case 4: ProjType = Class'flakslug';
break;
}
ScriptedPawn(aPawn).RangedProjectile = ProjType;
}
if ( DS != 0 )
{
aPawn.DrawScale = DS;
aPawn.Health = aPawn.Health * aPawn.DrawScale/aPawn.Default.DrawScale;
aPawn.SetCollisionSize(aPawn.CollisionRadius*aPawn.DrawScale/aPawn.Default.DrawScale
,aPawn.CollisionHeight*aPawn.DrawScale/aPawn.Default.DrawScale);
}
if ( MstEvent != '')
{
aPawn.Event = MstEvent;
log("WK Mechanic has set as Event for"@aPawn.Name@aPawn.Event);
}
if ( AMenu != "")
{
aPawn.MenuName = AMenu;
if ( ( Caps(Left((aPawn.MenuName),1)) == "A"
|| Caps(Left((aPawn.MenuName),1)) == "E"
|| Caps(Left((aPawn.MenuName),1)) == "I"
|| Caps(Left((aPawn.MenuName),1)) == "O"
|| Caps(Left((aPawn.MenuName),1)) == "U"
|| Caps(Left((aPawn.MenuName),1)) == "Y")
&& (Caps(Left((aPawn.NameArticle),3)) == " A "
|| Caps(Left((aPawn.NameArticle),2)) == "A "
|| Caps(Left((aPawn.NameArticle),2)) == " A"
|| Caps(Left((aPawn.NameArticle),1)) == "A") )
aPawn.NameArticle = " an ";
log("WK Mechanic has set as Name for"@aPawn.Name@aPawn.MenuName);
}
if ( ZPivotAdj != 0 )
aPawn.PrePivot.Z = ZPivotAdj;
if ( aSkin != None )
aPawn.Skin = aSkin;
if ( MultiSkin0 != None )
aPawn.Multiskins[0] = MultiSkin0;
if ( MultiSkin1 != None )
aPawn.Multiskins[1] = MultiSkin1;
if ( MultiSkin2 != None )
aPawn.Multiskins[2] = MultiSkin3;
if ( MultiSkin3 != None )
aPawn.Multiskins[3] = MultiSkin3;
if ( MultiSkin4 != None )
aPawn.Multiskins[4] = MultiSkin4;
if ( MultiSkin5 != None )
aPawn.Multiskins[5] = MultiSkin5;
if ( MultiSkin6 != None )
aPawn.Multiskins[6] = MultiSkin6;
if ( MultiSkin7 != None )
aPawn.Multiskins[7] = MultiSkin7;
/*
if ( Anim != '' )
aPawn.AnimSequence = Anim;
*/
}
NothingToDo:
}
As you can see I don't have any new Carcass, no animation for start, no alarm, no orders, no weaponry for Trooper types, no better Jump, so this is not that entertaining as I was expecting, but it will be done in other way.
And let's see a call (or multiple calls)
Code: Select all
NewRot.Yaw=-15480;
SetNewMonster(Spawn(class'SkaarjAssassin',,,vect(1202,12560,-3089),NewRot),1600,RandRange(0.7,0.98),True,,"BloodyWarrior",Texture'Skaarjw5_1');
SetNewMonster(Spawn(class'SkaarjAssassin',,,vect(1306,12616,-3089),NewRot),1900,RandRange(0.7,0.98),True,,"InfectedWarrior",Texture'Skaarjw5_2');
In just 3 lines I did some changes at 2 monsters.