Getting function variables in States???

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
In my FatGun projectile I want the Actor it hits to fatten up slowly so was planning on using some latent code.

In the ProcessTouch function the actor it hits is called Other, is there anyway of getting that info when in a seperate state that is called from the Process Touch?
 

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
In the ProcessTouch function the actor it hit is stored as Other, In that particular function I've been editing the sctors default properties like.
Other.Fatness

But I wanted to edit the same actor but in a differant state.
How do I get that variable?
 

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
declare a global variable something like var actor Victim. Then let the code go to a state which has a timer function that slowly raises the fat of the person and once the person is too fat let him explode :D
 

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
Can someone tell me why the code attached doesn't work please? :)

Supposidly. when ProcessTouch is called it sets the variables and it goes to State Fattenup.
Then there is a tick in there that handles the fattening up of the actor. But it doesn't work. :( They just do not fatten up at all.
 

2COOL4-U

New Member
Mar 17, 2001
505
0
0
37
dot NL
2cool.free.fr
this is your code
Code:
State fattenup
{

	simulated function Tick(float TimeDelta)
	{
  		if (Fatty.Fatness < 200)
		{
			Fatty.Fatness = Fatty.Fatness + 2;
		}
		if (Fatty.Fatness > 199)
		{
			Fatty.fatness = Fatty.default.fatness; 
			Fatty.TakeDamage(damage, instigator,HL,
				(MomentumTransfer * Normal(Velocity)), 'shredded' ); 
		}
  	}

}

Remove the simulated, Clients are not allowed to change the fatness of a player only servers are :)
 

Mychaeel

New Member
You should somehow include TimeDelta in your calculations, or the fattening speed will be totally dependent on the server tick speed (or the server's framerate if it happens to be a non-dedicated one).

By the way: Of course clients can set the fatness, but neither the server nor other clients will ever know of it (and any fatness change done by the server will override it). However, using a simulated function to change the fatness on client side too helps to simulate [sic!] the fatness change on clients between server updates, so (after implementing the change I suggested above) you might even want to leave it in.