Page 2 of 2

Re: Some questions about inventory items (pickups)

Posted: Mon Aug 07, 2017 5:40 pm
by nogardilaref
nullbyte wrote: You mentioned that if the client is asked to spawn a class it does not have, it might fall back to the parent class. Does this mean if I made my ShrinkVial extend a default class like HealthVial, it might spawn a visible HealthVial on the client?
Yes, that's what I meant, but I am not sure though, as I don't remember what exactly is the behavior of this engine on that.
It's either that, your it doesn't spawn at all leaving a null reference (None).

It's best if someone else is able to confirm that for you, or you can test it yourself through client logs to check what kind of reference you get in the end.

Re: Some questions about inventory items (pickups)

Posted: Mon Aug 07, 2017 6:16 pm
by sektor2111
Eheh, I'm gonna point you (due to my love for A.I. as a base) to some actor which has 2 components from 2 different packages - so a default sample would be explanatory. Take a look at WayBeacon class - of course has no RemoteRole but that's a pity, else that thing is visible only by Owner but this can be changed as well...

Re: Some questions about inventory items (pickups)

Posted: Tue Aug 08, 2017 2:52 am
by PrinceOfFunky
There's a formula to calculate the exact collision sizes depending on the DrawScale of the mesh, I wrote it in the CommandSystem mutator:

Code: Select all

/*
 * Calculate the right collision cylinder sizes of an actor.
 * <Has side effects>
 */
static function calculateCollisions(Actor actor, int oldDrawScale, out float CollisionR, out float CollisionH)
{
	local float collisionRPerNewDrawScale;
	local float collisionHPerNewDrawScale;
	local float collisionRPerOldDrawScale;
	local float collisionHPerOldDrawScale;
	local float collisionRPerDrawScaleLeftover;
	local float collisionHPerDrawScaleLeftover;
		
	collisionRPerNewDrawScale = (actor.DrawScale * 100) / actor.CollisionRadius;
	collisionRPerOldDrawScale = (oldDrawScale * 100) / actor.CollisionRadius;
	collisionRPerDrawScaleLeftover = collisionRPerOldDrawScale / collisionRPerNewDrawScale;
	
	collisionHPerNewDrawScale = (actor.DrawScale * 100) / actor.CollisionHeight;
	collisionHPerOldDrawScale = (oldDrawScale * 100) / actor.CollisionHeight;
	collisionHPerDrawScaleLeftover = collisionHPerOldDrawScale / collisionHPerNewDrawScale;
	
	CollisionR = actor.CollisionRadius / collisionRPerDrawScaleLeftover;
	CollisionH = actor.CollisionHeight / collisionHPerDrawScaleLeftover;
}

Code: Select all

/*
 * Resize the actor DrawScale basing on the given Percentage and call 'calculateCollisions()' from within 'CommandSystem' to calculate its
 * new collision sizes.
 */
static function Resize( Actor actor, int Percentage )
{
	local float TotalScore, ObtainedScore;
	local float OldDrawScale;
	local float NewCollisionRadius, NewCollisionHeight;
	
	TotalScore = 1.0;
	ObtainedScore = (Percentage * TotalScore) / 100;
	
	OldDrawScale = actor.DrawScale;
	actor.DrawScale = ObtainedScore;
	
	class'CommandSystem'.static.calculateCollisions(actor, OldDrawScale, NewCollisionRadius, NewCollisionHeight);
	actor.setCollisionSize(NewCollisionRadius, NewCollisionHeight);
}
Feel free to use them if you want .o.

Re: Some questions about inventory items (pickups)

Posted: Tue Aug 08, 2017 5:42 am
by nullbyte
Brilliant, thank you.

Any ideas about how to scale the player's hand-held weapon (in third-person view) when the player's drawscale changes?

Re: Some questions about inventory items (pickups)

Posted: Tue Aug 08, 2017 5:55 am
by sektor2111
Ahah, you think that resizing and collision were the only problems... Keep going, I'm listening.
Stepheight, baseeyeheight, eyeheight, Jump.Z, crouching collision, running speed. Tiny player is probably different in my logic. Excuse topic title, this is about Player already... Not gonna ask about Bot... and I wanna see double enforcer held...

Re: Some questions about inventory items (pickups)

Posted: Tue Aug 08, 2017 4:19 pm
by nullbyte
sektor2111 wrote:Stepheight, baseeyeheight, eyeheight, Jump.Z, crouching collision, running speed.
:cry:

Re: Some questions about inventory items (pickups)

Posted: Wed Aug 09, 2017 5:29 am
by SilverSound
Oh boy. Good luck you. "Spaghetti code Epic Mega games" has things set up weird as you will find out by this small simple endeavor.

But hey if you push through you might find a better way through it all.


Just know bots are not players and will be more nightmarish to effect with this than you can even begin to think. :ironic:



On a note for this topic:This information is amazing. Definitely note worthy.

Re: Some questions about inventory items (pickups)

Posted: Wed Aug 09, 2017 2:52 pm
by Barbie
@PrinceOfFunky: by doing some simple maths you can reduce your (for me confusing) formula of your function calculateCollisions()

Code: Select all

collisionRPerNewDrawScale = (actor.DrawScale * 100) / actor.CollisionRadius;
collisionRPerOldDrawScale = (oldDrawScale * 100) / actor.CollisionRadius;
collisionRPerDrawScaleLeftover = collisionRPerOldDrawScale / collisionRPerNewDrawScale;

collisionHPerNewDrawScale = (actor.DrawScale * 100) / actor.CollisionHeight;
collisionHPerOldDrawScale = (oldDrawScale * 100) / actor.CollisionHeight;
collisionHPerDrawScaleLeftover = collisionHPerOldDrawScale / collisionHPerNewDrawScale;

CollisionR = actor.CollisionRadius / collisionRPerDrawScaleLeftover;
CollisionH = actor.CollisionHeight / collisionHPerDrawScaleLeftover;
to

Code: Select all

DrawScaleRatio = actor.DrawScale / oldDrawScale;
CollisionR = actor.CollisionRadius * DrawScaleRatio;
CollisionH = actor.CollisionHeight * DrawScaleRatio;
(PS: Your comment

Code: Select all

* <Has side effects>
is not true because that function has no side effects: it does not change anything besides the given two arguments which are expected to be changeable.)

Re: Some questions about inventory items (pickups)

Posted: Wed Aug 09, 2017 11:17 pm
by EvilGrins
This may or may not help, as I don't remember how he did it.

From this · viewtopic.php?f=5&t=5031

As with any Alice In Wonderland scenario, there's things you can eat or drink that make you shrink or grow.

Haven't played the map in a REALLY long time, and even then I didn't open it up in UnrealEd, but there's a part of the map where you shrink.

Not sure if you actually shrink or get ported to a part of the map that's in giant-scale.

Re: Some questions about inventory items (pickups)

Posted: Wed Aug 09, 2017 11:23 pm
by papercoffee
EvilGrins wrote:This may or may not help, as I don't remember how he did it.

From this · viewtopic.php?f=5&t=5031

As with any Alice In Wonderland scenario, there's things you can eat or drink that make you shrink or grow.

Haven't played the map in a REALLY long time, and even then I didn't open it up in UnrealEd, but there's a part of the map where you shrink.

Not sure if you actually shrink or get ported to a part of the map that's in giant-scale.
Nope ...if you get shrunk, you just teleport into another map section which is a replica of the former room but just much bigger.
So, I'm sorry to say that, but this isn't helping OP.