Silly Esdesadum of sillyness

Anything and everything related to the Evolution server.
Post Reply
User avatar
Silly_Warlock
Killer in Training
Posts: 44
Joined: Tue Sep 17, 2013 8:56 am

Finally Turret Crafter is operating within acceptable parameters. Truly, it's [s]duct tape monstrosity[/s] wonderful creation. Structure of the artifact [s]is crazy[/s] can be surprising, the cost [s]is laughable[/s] should be commented ^^ . Oh, it charges you for use after a second (when turret flashes), because I worked around RPG system, which also caused me to spawn WeaponBase (I delete it the second later :p).
Requires Craft Spider Mines because that's what Craft Auto Turret extends.

Have a download and code below:

SillyRPG.u
http://www3.zippyshare.com/v/47398011/file.html

AbilityCraftAutoTurret.uc:

Code: Select all

class AbilityCraftAutoTurret extends AbilityCraftSpiderMines
	abstract;


static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
    local int i;	
    if (Data.Abilities.length > 0 && class<AbilityClassMechanic>(Data.Abilities[0]) != None)
	{
	for (i = 1; i < Data.Abilities.length; i++) //[0] class
    		if (class<AbilityCraftSpiderMines>(Data.Abilities[i]) != None)
    			break;

    	if (i >= Data.Abilities.length)
    		return 0;

    	return Super(RPGAbility).Cost(Data, CurrentLevel);
	}
   Return 0;
}

static function ModifyPawn(Pawn Other, int AbilityLevel)
{
	local ArtifactCraftAutoTurret Artifact;
	local RPGStatsInv	StatsInv;
	local InvScrapMetal InvMetal;
	
	if (Other.Role < ROLE_Authority)
		return;

	if(Monster(Other) != None)
		return;
		
	InvMetal = InvScrapMetal(Other.FindInventoryType(class'InvScrapMetal'));
	
	if (InvMetal == None)
		return;  //this should not happen if you are a mechanic
		
	StatsInv = RPGStatsInv(Other.FindInventoryType(class'RPGStatsInv'));

	Artifact = ArtifactCraftAutoTurret(Other.FindInventoryType(class'ArtifactCraftAutoTurret'));

	if (Artifact != None)
	{
		if (Artifact.AbilityLevel == AbilityLevel)
			return;
	}
	else
	{
		Artifact = Other.spawn(class'ArtifactCraftAutoTurret', Other,,, rot(0,0,0));

        if (Artifact != None)
        {
    		Artifact.giveTo(Other);
    		Other.NextItem();
        }
	}

	if (Artifact != None)
	{
		Artifact.AbilityLevel = AbilityLevel;
		Artifact.InvMetal = InvMetal;
		if (StatsInv != None)
			Artifact.AmmoBonus = StatsInv.DataObject.AmmoMax;
	}
}

defaultproperties
{
     AbilityName="Craft Auto Turret"
     Description="Using spare parts of any metal, the mechanic is able to generate auto turret.|Mana cost (per level):  40, 30, 20, 10|Turrets generated: 1|Metal cost:  1|Max level:  4"
     StartingCost=4
     CostAddPerLevel=-1
     BotChance=0
     MaxLevel=4
     PackageName="SillyRPG"
     ClassFilterName="Mechanic Class"
     RequiredRanking(0)=1
     RequiredRanking(1)=1
     RequiredRanking(2)=2
     RequiredRanking(3)=2
     bGivesArtifact=True
}
ArtifactCraftAutoTurret.uc (copy-pasta is strong with this one :p):

Code: Select all

class ArtifactCraftAutoTurret extends ArtifactCraftSpiderMines;

var class<Weapon> WeaponClass;
//// v  Yeah, I don't know how to let timer() acces those without making some additional var-s.
var xWeaponBaseSilly A;
var string TempParam;

function int GetCost()
{
	return Max(0, 50 - (10 * AbilityLevel));
}

//// It's actually unused as it is :p
function int GetAmmo()
{
	return 1;
}

function Activate()
{
	AltActivate();
}


function AltActivate(optional string Param)
{
	local float TimeDelta;
	local Vector StartTrace, EndTrace, SpawnLocation, HitNormal;
	////local xWeaponBaseSilly A;	
	////local int i;

	if (Instigator == None || InvMetal == None)
	{
		Destroy();
		return;
	}

    //Can't use this if you don't have enough adrenaline...
    if (Instigator.Controller.Adrenaline < GetCost())
    {
        Instigator.ReceiveLocalizedMessage(MessageClass, GetCost(), None, None, Class);
        bActive = false;
        GotoState('');
        return;
    }

    //Can't use this if we don't have scrap metal
    if (Param != "")
    {
		if (int(Param) > 5 || int(Param) <= 0)
		{
			Instigator.ReceiveLocalizedMessage(MessageClass, 4000, None, None, Class);
            bActive = false;
            GotoState('');
            return;
		}
		
		if (InvMetal.ScrapMetal[int(Param) - 1] <= 0)
		{
			Instigator.ReceiveLocalizedMessage(MessageClass, 1000 + int(Param), None, None, Class);
            bActive = false;
            GotoState('');
            return;
		}
	}
	else if (InvMetal.ScrapMetal[0] <= 0 && InvMetal.ScrapMetal[1] <= 0 && InvMetal.ScrapMetal[2] <= 0 && InvMetal.ScrapMetal[3] <= 0 && InvMetal.ScrapMetal[4] <= 0)
    {
        Instigator.ReceiveLocalizedMessage(MessageClass, 1000, None, None, Class);
        bActive = false;
        GotoState('');
        return;
    }

    //Check to see if we are allowed to use this again by time.
    TimeDelta = Level.TimeSeconds - LastUseTime;
    if (Level.TimeSeconds - LastUseTime < UseDelay)
    {
        Instigator.ReceiveLocalizedMessage(MessageClass, 5000 + UseDelay - TimeDelta, None, None, Class);
        bActive = false;
        GotoState('');
        return;
    }

    LastUseTime = Level.TimeSeconds;

	StartTrace = Instigator.Location;
	EndTrace = Instigator.Location + vector(Instigator.Rotation) * Instigator.GroundSpeed;
    if (Instigator.Trace(SpawnLocation, HitNormal, EndTrace, Instigator.Location) != None)
	{
		SpawnLocation -= vector(Instigator.Rotation) * 40;

//// That's where 'warzone' begins XD . Basically RPG system was stealing mah turret without me knowing about it :/

		A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
	}
	else
		A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);

//// However our evil RPG system has no desire for WeaponBase but engine won't let me spawn it without edit (bNoDelete = false; bStatic = false;)
		
   if (A != None)
   {	
	A.WeaponType=WeaponClass;

	A.PostBeginPlay();
	////A.Destroy();

//// Turns out RPGWeaponPickup gives Pickup back to its PickupBase (here: my WeaponBase) after a lil bit, so I decided to delay accesing it, to get around that.
	TempParam=Param;
        SetTimer(1,false);

	////if (A.bSucces == true)
	/*if (A.myPickUp != None)
	{	

	  A.myPickUp.RespawnTime = 0;
	  A.myPickUp.bDropped = true;
	  A.myPickUp.RespawnEffect();
	  ////A.AmmoAmount = GetAmmo();
	  A.myPickUp.SetTimer(120, false);
	
	  //cost
          Instigator.Controller.Adrenaline -= GetCost();
          if (Instigator.Controller.Adrenaline < 0)
    	   Instigator.Controller.Adrenaline = 0;
    	
          //Remove scrap metal
          if (Param != "")
	 	  InvMetal.RemoveMetal(int(Param) - 1);
	  else
	  {
		  i = 4;
          while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
        	  i--;
    	  InvMetal.RemoveMetal(i);
	  }
	}*/
      ////A.Destroy();
     
   }
}

function Timer()
{
	local int i;

	if (A.myPickUp != None)
	{	

	  A.myPickUp.RespawnTime = 0;
	  A.myPickUp.bDropped = true;
	  A.myPickUp.RespawnEffect();
	  ////A.AmmoAmount = GetAmmo();
	  A.myPickUp.SetTimer(120, false);
	
	  //cost
          Instigator.Controller.Adrenaline -= GetCost();
          if (Instigator.Controller.Adrenaline < 0)
    	   Instigator.Controller.Adrenaline = 0;
    	
          //Remove scrap metal
          if (TempParam != "")
	 	  InvMetal.RemoveMetal(int(TempParam) - 1);
	  else
	  {
		  i = 4;
          while (InvMetal.ScrapMetal[i] <= 0 && i >= 0)
        	  i--;
    	  InvMetal.RemoveMetal(i);
	  }
	}
     
      A.Destroy();
//// Oops :|  //// Well: kill(), no reset, auto kill wherever I put them don't do the job, eh, don't care abot it anyway.    ////A.myEmitter.Destroy();
}

defaultproperties
{
     AbilityLevel=1
     UseDelay=2
     WeaponClass=Class'DWU2Weapons.AutoTurretDeploy'
     MinActivationTime=0.000001
     ActivateSound=Sound'WeaponSounds.BaseGunTech.BReload2'
     IconMaterial=Texture'ME_RPGExpansion.Icons.CraftSpiderMines'
     ItemName="Craft Auto Turret"
}
xWeaponBaseSilly.uc (can't spawn standard one) :

Code: Select all

class xWeaponBaseSilly extends xWeaponBase;

//var bool bSucces;

// Tried to access pickup earlier here, but as I have found out later- it got 'stolen' earlier.
/*function SpawnPickup()
{
	Super(xPickUpBase).SpawnPickup();
	if (myPickUp != None)
	{	

	  myPickUp.RespawnTime = 0;
	  myPickUp.bDropped = true;
	  myPickUp.RespawnEffect();
	  //A.AmmoAmount = GetAmmo();
	  myPickUp.SetTimer(120, false);
	  bSucces = true;
	}
}*/

defaultproperties
{
	bNoDelete = false;
	bStatic = false;
	//bSucces = false;
}
I know that I left tons of commented discarded code in them but wanted to let people see my misadventures :p
[/color]
I don't even know that I know nothing.
User avatar
Silly_Warlock
Killer in Training
Posts: 44
Joined: Tue Sep 17, 2013 8:56 am

I have made some more stuff, again expect much copy-pasta, duct tape and workarounds :p

  • (Ability Craft Spider Mines ->)Ability Craft Auto Turret:
    1. Ability Craft Laser Turret
    2. Ability Craft Rocket Turret
    3. Ability Craft Weapon (<- X Is A Changeling):
      1. Ability Craft C T Weapon
      2. Ability Craft RPG Weapon Cp
  • (Ability Armor Shards ->)Ability Silly Armor Shards
  • Ability Silly Vehicle Override
  • (Ability Vehicle Vitality ->)Ability Silly Vehicle Vitality
  • (U2 Auto Turret Deploy Fire ->)Auto Turret Deploy Fire Rb
  • (U2 Auto Turret Deploy ->)Auto Turret Deploy Rb
  • (U2 Deployable Fire ->)Fire Deploy Laser Turret Rb
  • (U2 Fire Deploy Rocket Turret ->)Fire Deploy Rocket Turret Rb
  • mut Auto Turret Rb:
    1. mut Laser Turrets Rb
    2. mut Rocket Turret Rb
  • (U2 Pickup Auto Turret ->)Pickup Auto Turret Rb
  • (U2 Pickup Rocket Turret ->)Pickup Laser Turret Rb
  • (U2 Pickup Rocket Turret ->)Pickup Rocket Turret Rb
  • (Auto Turret Deploy ->)Silly Auto Turret Deploy
  • (Pickup Auto Turret ->)Silly Pickup Auto Turret
  • (Weapon Laser Turrets ->)Weapon Laser Turrets Rb
  • (U2 Weapon Rocket Turret ->)Weapon Rocket Turret Rb
Auto Turret Crafter stayed mostly the same, other turrets are trivial defaults changes.
Craft Weapon will spawn set weapon upon activation (Auto Turret by default), you can set it with altactivateitem, eg: "altactivateitem XWeapons.ShockRifle" (it will both set and spawn it, when wrong argument is used it will spawn and set Rocket Turret).
Made it as an extension of the idea for Turret Crafter, it is set to have no cost ('bIsFree') same as its child classes. 'bIsDropped' when set to true allows repeat pickup. Could probably be used in-game if modified to use allowed weapons list inside map and/or pickup.

Craft C T Weapon (Copy Type)- spawns a weapon pickup of a same type as currently held weapon but doesn't copy magic enchantment, however it can be used to 'copy' magic weapon same as normall pickup.
I suppose it could be used if modified to disallow Super weapons. Could also use this structure to make turret/mines crafter limited to what you already have (I think that version checking for inventory would need to be much more complicated).

Craft RPG Weapon Cp- upon activation spawns a weapon pickup of a same type as currently held weapon along with magic enchantment (The hax has been doubled :p).
AltActivate allows you to spawn any Magic weapon- "AltActivateItem Package.Class" , "AltActivateItem modifier" in this order (eg: "AltActivateItem MonsterAssaultRPG.RW_Protection" , "AltActivateItem 3")- to set enchantment, hold desired weapon and AltActivate without argument to spawn.
You can find Magic weapons classes in MASRPG and ME_RPGExpansion, their names start with "RW_", if using UED deselect 'Placeable classes Only' and go to Inventory -> Weapon -> RPGWeapon .
For testing only.

RPG Weapon Base Silly- for UED, based on 'Craft RPG Weapon Cp'. Same as Weapon Crafter it uses changeling class in order to be visible on dedicated server. No overlay for weapon pickup (It seems to require a Pawn). Place them over 100u apart (hack in 'RPG Weapon Pickup'). Main UED config variables:
  • Dest RPG Weapon Str Class- enchantment class, works the same way as in 'Craft RPG Weapon Cp' .
  • Dest Modifier- Desired modifier for magic weapon. Allows OverMax if max > 0 .
    Setting max+2 will result in max; min-1 -> min;
    non 0 for 0 only -> 0; 0 when 0 forbidden -> +1 (or -1 if max < 1)
  • b Normal Wep- if true, will spawn non-magic weapon (like Craft C T Weapon)
  • 'b Is Real Weapon Stay' , 'b Is Weapon Stay' and 'PickUp Respawn Time'- affect what happens when you touch the pickup, set 'Real Weapon Stay' and 'Weapon Stay' the same unless you have a reason not to.
    1. Weapon Stay = true and Respawn Time > 0 -> weapon will stay, no repeat pickup.
    2. Weapon Stay = true and Respawn Time = 0 -> weapon will NOT stay, no repeat pickup, no respawn.
    3. Weapon Stay = false and Respawn Time = 0 -> weapon will not stay, repeat pickup allowed, no respawn.
    4. Weapon Stay = false and Respawn Time > 0 -> weapon will not stay, repeat pickup allowed, respawn after set time.
  • Remember to set 'Weapon Type' in 'x Weapon Base'.
Turret rollbacks- reverted turret classes to have no limit to placed turrets and made mutators replacing new turrets with rollbacks. Modifying defaults in 'mut Auto Turret Rb' should allow replacing any weapon with any weapon.

Vehicles- Made 'Inv Vehicle Nfo' to store data about vehicle's max hp modifiers inside said vehicle.
'Ability Silly Vehicle Override' is responsible for re-modifying vehicle's max hp based on this info every time someone enters said vehicle.
Modified 'Ability Vehicle Vitality' to use Vehicle Nfo.
Modified 'Pickup Armor Shard' to allow use on vehicles and store that data in their Nfo (also Pickup Message doesn't work for vehicles).
Sadly I'm not sure about reliability of this system (varies with host), also has some questionable implementations and I believe Override place is in RPGMut not Abilities (but I'm in 'extend only' mode :p).

Download:
SillyRPGv1.7z
http://www43.zippyshare.com/v/85343755/file.html
[/color]
I don't even know that I know nothing.
User avatar
Silly_Warlock
Killer in Training
Posts: 44
Joined: Tue Sep 17, 2013 8:56 am

Took me a while to finally release this, as always half of the code is trying random things until it starts to do things 'close enough' :p.

SillyRPG
  • Ability Craft Auto Turret [1.1]
  • Ability Craft Laser Turret [1.1]
  • Ability Craft Rocket Turret [1.1]
  • Ability Craft Weapon [1.1] (<- X Is A Changeling):
    1. Ability Craft C T Weapon [1.1]
    2. Ability Craft RPG Weapon Cp [1.1]
  • (Ability Craft Spider Mines ->)Ability Silly Craft Spider Mines
Listed abilities have their way of finding artifacts changed, so that they will ignore artifacts of target's child classes. Note that the list includes MEvo ability- using original ability may prevent it from giving its artifact to player.

Artifact Craft Weapon [1.1]- modified to allow use by non-mechanics in child classes.

SillyRPGv1-1 Artifact Copy Crafter- same as C T but disallows Super weapons.

Artifact Craft Turrets- activate to generate a list of available turrets by checking your inventory. AltActivateItem to view the list. AltActivateItem [Number]: Crafts a turret of a class at specified index.

Artifact Weapon Base Placer- stores resources and can create available weapon bases from said resources.
It can get more resources and weapon types from pickups. Pickups are consumed when they give resources or new weapon types (lowering costs doesn't count). Can be tossed.
Pickups will get 'filled' using manager by default, this allows dropping from monsters and using Silly RPG Artifact Manager.
Weapon Base Placer Pickups Manager- place only one on map. Can pick setups randomly or just loop their list. Setups list is paired with max uses list- 0 or lack of entry in max uses counts as inf. In random mode remaining uses double as chance (setups with inf uses have the chance equal to highest entry in max uses or 1).

Artifact Weapon Crafter- Crafts random available weapon and breaks unless used by mechanic.
Mechanics instead of breaking it pay some scrap, they are also capable of crafting weapons marked as advanced, said weapon is then removed from list, if in hard mode the same goes for non-advanced weapons.
Designed to allow use as default inventory using Map Allowed Weapons.
Pickups consumed if added something to list (not if canceled hard mode).
Map Allowed Weapons- list of lists of allowed weapons. Place only one on map.
Weapon Crafter uses [0] for list of non-advanced weapons and [1] for advanced.

Random Teleporter Network- place only one on map. Randomly pairs teleporters from list created by checking if telepoter's URL is the same as specified URLTag. Can also specify number of teleporters (from list) not to be paired using Fakes variable.

Silly RPG Artifact Manager- simplified RPG Artifact Manager. Uses only way-points and doesn't track spawned artifacts. Can specify Chance, Max Artifacts and Life Span per artifact type.

Silly Helix ESVNew- Added pickups for dedicated servers and moved class references to default properties.
Had to work around broken replication and it's not pretty- weapon is pretty much fine, ammo is rotated by 90 degrees but shield and health are visually completely frozen (this includes being visible while recharging but still gets destroyed with vehicle).


Download:
SillyRPGv1-1.7z
http://www45.zippyshare.com/v/g7XmiDQQ/file.html
[/color]
I don't even know that I know nothing.
DW_Ant
DW Clan Member
Posts: 2679
Joined: Sat Jun 21, 2008 11:00 pm
Location: North Carolina

Code: Select all

//// That's where 'warzone' begins XD . Basically RPG system was stealing mah turret without me knowing about it :/

      A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, SpawnLocation, Instigator.Rotation);
   }
   else
      A = spawn(Class'SillyRPG.xWeaponBaseSilly',,, EndTrace, Instigator.Rotation);

//// However our evil RPG system has no desire for WeaponBase but engine won't let me spawn it without edit (bNoDelete = false; bStatic = false;)
      
   if (A != None)
   {   
   A.WeaponType=WeaponClass;

   A.PostBeginPlay();
   ////A.Destroy();

//// Turns out RPGWeaponPickup gives Pickup back to its PickupBase (here: my WeaponBase) after a lil bit, so I decided to delay accesing it, to get around that.
lol welcome to programming in UScript when you're building a mod that's built on top of 10 other mods. Hacks were built to counter assumptions in the engine, and hacks (such as yours) were built to handle other hacks.
Craft C T Weapon (Copy Type)- spawns a weapon pickup of a same type as currently held weapon but doesn't copy magic enchantment, however it can be used to 'copy' magic weapon same as normall pickup.
I suppose it could be used if modified to disallow Super weapons. Could also use this structure to make turret/mines crafter limited to what you already have (I think that version checking for inventory would need to be much more complicated).

Craft RPG Weapon Cp- upon activation spawns a weapon pickup of a same type as currently held weapon along with magic enchantment (The hax has been doubled :p).
I think this one would be neat to have since it may greatly reduce the time needed to copy weapons (ie: everyone waiting at lockers to iterate through magic weapons). This will also give the mechanic the edge to allow players to copy weapons that normally aren't available.

That aside, there are a couple concerns I have with this. This could provide infinite ammo since the player could toss their weapon to pickup a fresh pickup (much like how players toss their shock rifles in the beginning of Nocturne to get some ammo). The difference here is that this pickup is mobile. Players do not need to return to the beginning to get more shock rounds. Adding an adren cost may bypass these issues, but finding the balance may be difficult since you don't want it to make not worth spawning a weapon when you could simply wait 30 seconds for the locker.

The other concern I have is this diminishes the value of single weapon drops level designers intentionally placed.

Turret rollbacks- reverted turret classes to have no limit to placed turrets and made mutators replacing new turrets with rollbacks. Modifying defaults in 'mut Auto Turret Rb' should allow replacing any weapon with any weapon.
This one sounds like fun!
Vehicles- Made 'Inv Vehicle Nfo' to store data about vehicle's max hp modifiers inside said vehicle.
'Ability Silly Vehicle Override' is responsible for re-modifying vehicle's max hp based on this info every time someone enters said vehicle.
Modified 'Ability Vehicle Vitality' to use Vehicle Nfo.
Modified 'Pickup Armor Shard' to allow use on vehicles and store that data in their Nfo (also Pickup Message doesn't work for vehicles).
Sadly I'm not sure about reliability of this system (varies with host), also has some questionable implementations and I believe Override place is in RPGMut not Abilities (but I'm in 'extend only' mode :p).
Managers and info actors such as this one sound a little risky since it may rub against other systems. Does this work well with the vehicle factories and RPG abilities such as Vehicle Vitality?
The difference between successful people from others is
not in the lack of strength,
not in the lack of knowledge,
but rather in the lack of will.

FFE466

_________________________
{F}{AH}{CivFR}{XC}{U}{DF}{CJ}{SD}
User avatar
Silly_Warlock
Killer in Training
Posts: 44
Joined: Tue Sep 17, 2013 8:56 am

DW_Ant wrote: I think this one would be neat to have since it may greatly reduce the time needed to copy weapons (ie: everyone waiting at lockers to iterate through magic weapons). This will also give the mechanic the edge to allow players to copy weapons that normally aren't available.

That aside, there are a couple concerns I have with this. This could provide infinite ammo since the player could toss their weapon to pickup a fresh pickup (much like how players toss their shock rifles in the beginning of Nocturne to get some ammo). The difference here is that this pickup is mobile. Players do not need to return to the beginning to get more shock rounds. Adding an adren cost may bypass these issues, but finding the balance may be difficult since you don't want it to make not worth spawning a weapon when you could simply wait 30 seconds for the locker.

The other concern I have is this diminishes the value of single weapon drops level designers intentionally placed.
I would imagine it as something rather expensive in order to avoid breaking map flow too much and mostly used for getting/copying currently unavailable weapons.
Could use modified Copy Crafter which would spawn weapon pickup with weapon stay and positive re-spawn time, resulting in weapon which stays on pickup but has limited life span.

DW_Ant wrote: Managers and info actors such as this one sound a little risky since it may rub against other systems. Does this work well with the vehicle factories and RPG abilities such as Vehicle Vitality?
This info is completely passive, the point is for abilities and RPG system to use it.
Current implementation uses Override ability rather than RPG Mut edit and replacement for Vitality.
Override adds permanent additional hp stored in info upon vehicle entry, Silly Vitality just stores information about changes which is pretty much currently unused. Upon exit Silly Vitality re-sets hp to default and clears stored information, also RPG Mut re-sets hp to default anyways. Info is stored by any adapted instigator inside vehicle's inventory and lost with said vehicle.
I don't even know that I know nothing.
Post Reply