Post by '¿!N!¿'Lepro$Y on Apr 27, 2004 6:38:26 GMT -5
Next is to set the physics of the Keg using the SetPhysics function command, otherwise it will be Phys_none which means it will just be stuck in the air;
Lepskeg.SetPhysics(Phys_falling);
You could also use projectile physics, which means the Keg would travel in a straight line instead of falling.
Lepskeg.SetPhysics(Phys_projectile);
Now to set the velocity of the Keg.
Notice above the MutateString function there are these two lines;
var () float kegvel;
var () float kegvelZ;
These Var variable lines make it so the velocity of the Keg can be altered as a default property of the mutator with an in-game command. You would type;
Set PackageName.MutatorName kegvel 5000
This will change the default velocity of the Keg.
After you successfully compile your mutator, highlight your mutator in the class list, then click on "default properties". You will see a property heading with the same name as your mutator, when you expand it you will see the variables "kegvel" and "kegvelZ". Make kegvel about 1500 and make kegvelZ about 500. Then save your mutator.
The lines that actually set velocity of the Keg are these lines;
Lepskeg.Velocity = X*kegvel;
Lepskeg.Velocity.z += kegvelZ;
This is where you refer to the GetAxes vector X
X is multiplied by the kegvel using the * symbol to multiply these two numbers. This makes sure that the Keg will always move in the direction the player is facing when summoned.
The velocity.z variable is the vertical velocity of the keg, the line adds and applies the number that you put into the KegvelZ default property to the Keg’s current vertical velocity. The higher the KegvelZ number the higher the Keg will Arc into the air before falling. Do not worry about velocity.z if you are using Phys_projectile.
I will add one more mutate command to demonstrate how the following symbols work, &&, !=, ==
var () float kegvel;
var () float kegvelZ;
function Mutate(string MutateString, PlayerPawn Sender)
{
local Keg Lepskeg;
local vector X,Y,Z;
if(mutatestring ~= "morefat")
{
Sender.desiredfatness += 10;
}
if(mutatestring ~= "lessfat")
{
Sender.desiredfatness -= 10;
}
if(mutatestring ~= "bang")
{
Lepskeg = Spawn(class'keg',,,Sender.Location,Sender.Rotation);
GetAxes(Sender.Rotation, X,Y,Z);
Lepskeg.SetPhysics(Phys_falling);
Lepskeg.Velocity = X*kegvel;
Lepskeg.Velocity.z += kegvelZ;
}
if(mutatestring ~= "makehighjump" && Sender.Physics != Phys_falling)
{
Sender.velocity.z += 500;
}
Super.Mutate(MutateString, Sender);
}
This last mutatestring basically says, if mutate makejumphigh is typed and the Sender's physics is other than falling, then add and apply 500 to Sender's vertical velocity.
The && symbol means "and", it is used to link together if conditionals, the action will only happen if all the conditionals linked by the && are satisfied. This is used in this case to make the Player jump only if they are on the ground.
The second conditional Sender.Physics != Phys_falling makes use of the != symbol, which basically means "other than" or "is not". So they Player will only jump if they are not falling.
You could use the == symbol to do the same thing, except you would have to put it as; if(mutatestring ~= "makejumphigh" && Sender.Physics == Phys_walking) because the == symbol means "equal to" or "is".
This then would be saying, if mutate makejumphigh is typed and the players physics "is" Phys_walking then the jump will happen.
This is all based on the principle that when a player is in the air their physics is phys_falling and when they are on the ground their physics is phys_walking.
So now to compile the mutator, click on "Scripts" in the top menu and select "compile changed scripts".
This will takes a few minutes. If there is a compile error it will stop and tell you what the error is so you can fix it and try again.
Make sure that all the { and } are in the right places and make sure that there are the same number of } as there are {
Sometimes it is hard to understand what the error might be, just try changing stuff until it compiles. The error message usually at least gives you a clue.
After your mutator compiles successfully, don’t forget to put some numbers into the kegvel and kegvelZ in your mutator’s "default properties".
After you do that, click on "save" in the class menu under the class list. This will take a few minutes.
Quit out of the Editor, now you have to make an .int file so your mutator will appear in the mutator list.
Open any text editing program, on a fresh page, put this line;
[public]
Object=(Name=MutatorPackage.MutatorName,Class=Class,MetaClass=Engine.Mutator,Description="MyMutator")
Obviously put the name of your package and mutator in place of MutatorPackage.MutatorName.
Save the text file as MutatorPackage.int, the same name as the .u file.
Put the .int file in your Rune/System folder with your mutator .u file(the mutator package).
Open your Rune.ini file with a text editor and find the ServerPackages lines near the top and add a line for your mutator, like this;
ServerPackages=MutatorPackage
Obviously put the name of the .u file where MutatorPackage is. Save the Rune.ini
Now other people can use the mutator on your server
Now you can fire up and Rune select your mutator from the muator list and give it a test.
I have given some specific examples here but you there is endless stuff you can do by changing and replacing bits here and there. Look at how other mutators and other things in Rune are coded to get an idea of how to do different stuff.
Good Luck Viking Cobbers
:=]
Lepskeg.SetPhysics(Phys_falling);
You could also use projectile physics, which means the Keg would travel in a straight line instead of falling.
Lepskeg.SetPhysics(Phys_projectile);
Now to set the velocity of the Keg.
Notice above the MutateString function there are these two lines;
var () float kegvel;
var () float kegvelZ;
These Var variable lines make it so the velocity of the Keg can be altered as a default property of the mutator with an in-game command. You would type;
Set PackageName.MutatorName kegvel 5000
This will change the default velocity of the Keg.
After you successfully compile your mutator, highlight your mutator in the class list, then click on "default properties". You will see a property heading with the same name as your mutator, when you expand it you will see the variables "kegvel" and "kegvelZ". Make kegvel about 1500 and make kegvelZ about 500. Then save your mutator.
The lines that actually set velocity of the Keg are these lines;
Lepskeg.Velocity = X*kegvel;
Lepskeg.Velocity.z += kegvelZ;
This is where you refer to the GetAxes vector X
X is multiplied by the kegvel using the * symbol to multiply these two numbers. This makes sure that the Keg will always move in the direction the player is facing when summoned.
The velocity.z variable is the vertical velocity of the keg, the line adds and applies the number that you put into the KegvelZ default property to the Keg’s current vertical velocity. The higher the KegvelZ number the higher the Keg will Arc into the air before falling. Do not worry about velocity.z if you are using Phys_projectile.
I will add one more mutate command to demonstrate how the following symbols work, &&, !=, ==
var () float kegvel;
var () float kegvelZ;
function Mutate(string MutateString, PlayerPawn Sender)
{
local Keg Lepskeg;
local vector X,Y,Z;
if(mutatestring ~= "morefat")
{
Sender.desiredfatness += 10;
}
if(mutatestring ~= "lessfat")
{
Sender.desiredfatness -= 10;
}
if(mutatestring ~= "bang")
{
Lepskeg = Spawn(class'keg',,,Sender.Location,Sender.Rotation);
GetAxes(Sender.Rotation, X,Y,Z);
Lepskeg.SetPhysics(Phys_falling);
Lepskeg.Velocity = X*kegvel;
Lepskeg.Velocity.z += kegvelZ;
}
if(mutatestring ~= "makehighjump" && Sender.Physics != Phys_falling)
{
Sender.velocity.z += 500;
}
Super.Mutate(MutateString, Sender);
}
This last mutatestring basically says, if mutate makejumphigh is typed and the Sender's physics is other than falling, then add and apply 500 to Sender's vertical velocity.
The && symbol means "and", it is used to link together if conditionals, the action will only happen if all the conditionals linked by the && are satisfied. This is used in this case to make the Player jump only if they are on the ground.
The second conditional Sender.Physics != Phys_falling makes use of the != symbol, which basically means "other than" or "is not". So they Player will only jump if they are not falling.
You could use the == symbol to do the same thing, except you would have to put it as; if(mutatestring ~= "makejumphigh" && Sender.Physics == Phys_walking) because the == symbol means "equal to" or "is".
This then would be saying, if mutate makejumphigh is typed and the players physics "is" Phys_walking then the jump will happen.
This is all based on the principle that when a player is in the air their physics is phys_falling and when they are on the ground their physics is phys_walking.
So now to compile the mutator, click on "Scripts" in the top menu and select "compile changed scripts".
This will takes a few minutes. If there is a compile error it will stop and tell you what the error is so you can fix it and try again.
Make sure that all the { and } are in the right places and make sure that there are the same number of } as there are {
Sometimes it is hard to understand what the error might be, just try changing stuff until it compiles. The error message usually at least gives you a clue.
After your mutator compiles successfully, don’t forget to put some numbers into the kegvel and kegvelZ in your mutator’s "default properties".
After you do that, click on "save" in the class menu under the class list. This will take a few minutes.
Quit out of the Editor, now you have to make an .int file so your mutator will appear in the mutator list.
Open any text editing program, on a fresh page, put this line;
[public]
Object=(Name=MutatorPackage.MutatorName,Class=Class,MetaClass=Engine.Mutator,Description="MyMutator")
Obviously put the name of your package and mutator in place of MutatorPackage.MutatorName.
Save the text file as MutatorPackage.int, the same name as the .u file.
Put the .int file in your Rune/System folder with your mutator .u file(the mutator package).
Open your Rune.ini file with a text editor and find the ServerPackages lines near the top and add a line for your mutator, like this;
ServerPackages=MutatorPackage
Obviously put the name of the .u file where MutatorPackage is. Save the Rune.ini
Now other people can use the mutator on your server
Now you can fire up and Rune select your mutator from the muator list and give it a test.
I have given some specific examples here but you there is endless stuff you can do by changing and replacing bits here and there. Look at how other mutators and other things in Rune are coded to get an idea of how to do different stuff.
Good Luck Viking Cobbers
:=]