PDA

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


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

2COOL4-U
10th Nov 2001, 12:44 PM
what exactly do you mean?

Euphoric Beaver
10th Nov 2001, 12: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.
Other.Fatness

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

2COOL4-U
10th Nov 2001, 01: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, 02: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?

Wormbo
10th Nov 2001, 03: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, 06: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.

2COOL4-U
11th Nov 2001, 07: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, 07:49 AM
Doh!

Mychaeel
11th Nov 2001, 08: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.