View Full Version : Getting function variables in States???

Euphoric Beaver
10th Nov 2001, 12:36 PM
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?

10th Nov 2001, 01:44 PM
what exactly do you mean?

Euphoric Beaver
10th Nov 2001, 01:52 PM
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.

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

10th Nov 2001, 02:07 PM
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
10th Nov 2001, 03:33 PM
Yep tried that but when I put the damage code in.

Fatty.TakeDamage(damage, instigator,HitLocation,
(MomentumTransfer * Normal(Velocity)), 'shredded' );

I got an error. :(
Is there another way of damaging a pawn?

10th Nov 2001, 04:58 PM
Keep in mind that HitLocation must be declared, too.
Also make sure, Fatty is not None, because this would cause an 'Accessed None' in the log file.

Euphoric Beaver
11th Nov 2001, 07:15 AM
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.

11th Nov 2001, 08:27 AM
this is your 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 :)

Euphoric Beaver
11th Nov 2001, 08:49 AM

11th Nov 2001, 09:37 AM
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.