Page 2 of 2

Re: AllWeaponsFullyLoaded mutator

Posted: Sun Aug 13, 2017 1:07 pm
by OjitroC
Aldebaran wrote:@OjitroC
Mutator Toolbox V2.0 seem not to have an ini file to store the values, so I think it will not work fine on a server.
Mutator Toolbox's ini is MTB.ini - sektor2111's LoadWeapon is great and works well.

Re: AllWeaponsFullyLoaded mutator

Posted: Sun Aug 13, 2017 1:46 pm
by Aldebaran
OjitroC wrote:Mutator Toolbox's ini is MTB.ini
Ok sorry, I have overlooked it. It does not exists in the Installationpackage.

Re: AllWeaponsFullyLoaded mutator

Posted: Sun Aug 13, 2017 1:59 pm
by OjitroC
Aldebaran wrote: Ok sorry, I have overlooked it. It does not exists in the Installationpackage.
I was looking for ages for something like MutatorToolbox.ini then suddently thought it might be abbreviated - I think the ini is created when the mutator is first run/configured.

Re: AllWeaponsFullyLoaded mutator

Posted: Sun Aug 13, 2017 2:29 pm
by papercoffee
Thanks sektor2111 for this awesome little tool.
Can I add more weapons into the ini?

Re: AllWeaponsFullyLoaded mutator

Posted: Sun Aug 13, 2017 5:04 pm
by sektor2111
papercoffee wrote:Can I add more weapons into the ini?
Will not going to work - this is for 1 weapon as quoted in request. If such things are needed in community I'll think at let's say 16 weapons and ammo - so to speak a small array...

Edit:
Or not a small array. Maybe admins wants to load... a crash. I think a dynamic array should be cute enough. Of course I don't know if loooong strings deals are healthy but... ini file might go like this:

Code: Select all

[LoadWeaponM.LoadWeapon]
AWeapon=BotPack.PulseGun
AWeapon=BotPack.UT_Eightball
AWeapon=
AnAmmo=BotPack.PAmmo
AnAmmo=BotPack.RocketPack
AnAmmo=
AmmoScale=3.000000
It does need an empty position for preventing array referring to a default property which is not available - out of bounds, else it should load in theory a bunch of weapons and ammo... without being limited. I gotta check in detail how do works (dying respawning) because at first load it's operational. Else limit will be probably Player class related to a maximum number of weapons held, anyway mutator modified for multiple loads doesn't have too many restrictions...

Re: AllWeaponsFullyLoaded mutator

Posted: Mon Aug 14, 2017 3:19 pm
by sektor2111
All right, I think is time for more than "AllWeapons". I went to an evening walk through Wiki and probably it did not help, a half of things there are... FALSE somehow.
https://wiki.beyondunreal.com/Dynamic_arrays
Wiki wrote: ... The type declaration syntax was available (almost) from the start, but Unreal Engine 1 never provided any way to actually access or modify them at the UnrealScript level.
The truth (I love it) is that you can ACCESS such an array not really to modify it - I'm speaking about an INI file as above looking as default INI containing "ServerPackages" "ServerActors" dynamic arrays that can be edited from preferences and read using natives. The mutator which I want to show is capable of reading these from INI using UnrealScript - read again - UnrealScript if array is being written a bit "nice" - as in above sample and that can be written from Game's Menu using power of natives. Problem comes at end of array - condition to stop reading. When array is copied in a string value you can scan how many commas are there. But how long is this string and how well does this work ? I don't know, so I prefer a simple format making a cute INI. Array limit is unknown by me right now because I'm not gonna write all weaponry from UT in there and ModifyPlayer probably will take ages and crashing. In exchange we can set 2 or 6 or 12 weapons or more, that can be loaded by player at once with some initial scaled ammo accordingly.
If you need a loader like that I'll share it. For the moment you can run into a compiling spree with this code - and which you can change in a different way and I'm curious about results:

Code: Select all

class LoadWeapon expands Mutator config (LoadWeapon);

var() config array<string> AWeapon;
var() config array<string> AnAmmo;
var() config float AmmoScale;
var bool bEnabled;
var int i, k;

const version="1.00";

event PostBeginPlay()
{
	i = 0;
	log ("LoadWeapon version"@version@attempt initialization process...,'LoadWeapon');
	if ( AmmoScale <= 0.2)
		AmmoScale = 0.2;
	DoInit();
Done:
	if ( bEnabled )
		log (Self.Name@has been Initialized.,'LoadWeapon');
	else
		log (Self.Name@has encountered a bad configuration, it will not load anything...,'LoadWeapon');
}

final function DoInit()
{
	local bool bKeepGoing;
	local class<Weapon> W;
	local class<Ammo> A;

Top:
	W = class<Weapon>( DynamicLoadObject(AWeapon[i], class'Class', True) );
	if ( W != None )
	{
		bKeepGoing = True;
	}
	else
	{
		bKeepGoing=False;
	}
	A = class<Ammo>( DynamicLoadObject(AnAmmo[i], class'Class', True) );
	if ( A == None )
	{
		bKeepGoing=False;
	}
	if ( bKeepGoing )
	{
		W = None;
		A = None;
		i++;
		bEnabled = True;
	}
	else
		GoTo Initialized;
GoTo Top;
Initialized:
	k = i;
}

function ModifyPlayer (Pawn Other)
{
	local class<Ammo> Am;
	local class<Weapon> Wp;
	local Ammo A;
	local Weapon W;

	if ( Other.PlayerReplicationInfo == None && Other.bIsPlayer )
		GoTo FagitronSet;
	if ( bEnabled )
	{
		for ( i = 0; i < k+1; i++ )
		if ( !Other.bHidden )
		{
			Am = class<Ammo>( DynamicLoadObject(AnAmmo[i], class'Class', True) );
			if ( Am != None )
			{
				A = Spawn (Am,,,Other.Location,Other.Rotation);
				if ( A != None )
				{
					A.RespawnTime = 0.00;
					A.AmmoAmount *= AmmoScale;
					A.Touch(Other);
				}
			}
			Wp = class<Weapon>( DynamicLoadObject(AWeapon[i], class'Class', True) );
			if ( Wp != None )
			{
				W = Spawn(Wp,,,Other.Location,Other.Rotation);
				if ( W != None )
				{
					W.RespawnTime = 0.00;
					W.Touch(Other);
				}
			}
			Am = None; A = None; Wp = None; W = None;
		}
	}
	Super.ModifyPlayer(Other);
FagitronSet:
//Ruin chain for shite
}

defaultproperties
{
	AmmoScale=2.000000
}
This thing is called by me LoadWeaponM - M comes from "Multiple". And this is my test INI file:

Code: Select all

[LoadWeaponM.LoadWeapon]
AWeapon=BotPack.PulseGun
AWeapon=BotPack.UT_Eightball
AWeapon=BotPack.UT_FlakCannon
AWeapon=
AnAmmo=BotPack.PAmmo
AnAmmo=BotPack.RocketPack
AnAmmo=BotPack.FlakAmmo
AnAmmo=
AmmoScale=20.000000
Empty spaces are helping game-log for no errors, else there can be 2 warnings about passing over array boundaries.
@Papercoffee
In this "M" version you can add a lot of weapons...

Edit: In other topic I'll show another confusing information from Wiki which I found while I was looking around.

Re: AllWeaponsFullyLoaded mutator

Posted: Mon Aug 14, 2017 4:22 pm
by papercoffee
So it is possible ...nice!

Re: AllWeaponsFullyLoaded mutator

Posted: Mon Aug 14, 2017 10:13 pm
by sektor2111
papercoffee wrote:So it is possible ...nice!
Yeah, here is the evidence...
[attachment=0]LoadWeaponM.7z[/attachment]

Edit: What I was reading there was describing that dynamic arrays cannot be used in replication. Perhaps another incomplete answer. I think I can read them in a slower state code, copying values to another string variable non-array and... happily sending it to clients... but it's a work which I don't see useful for wasting time, unless some "unlimited" MapVote will be a goal for coders... not 1023, not 2048 but... 20000 should be enough for player playing 20 minutes in a server... and reading maps for 30 minutes... :lol2:

Re: AllWeaponsFullyLoaded mutator

Posted: Wed Dec 02, 2020 9:29 am
by Ubir4
Thank's.

Re: AllWeaponsFullyLoaded mutator

Posted: Wed Dec 02, 2020 9:56 am
by sektor2111
Not all UT versions are supporting this method, I'm currently using another method for dynamic arrays supported properly by XC_Engine - no crashes.