ok, here's some pseudo code for a script i'm working on-
attribute- meter=0
for each second passed, meter= meter+1
if meter = 500
attribute able= 1
if key g is pressed, and able - 1,
change act material, remove weapons and give melee attacks.
stay in this form for 300 seconds, then revert and set meter- 0!
someone wanna help me convert this to a script?
Transformation?
- vrageprogrammer
- Posts: 566
- Joined: Wed Oct 31, 2007 2:59 pm
- Location: On top of a tree
- Contact:
Transformation?
It was not Possible to determine the dimensions of the image....
- vrageprogrammer
- Posts: 566
- Joined: Wed Oct 31, 2007 2:59 pm
- Location: On top of a tree
- Contact:
Re: Transformation?
Ok, i understand what your trying to achieve, just a little confused with how you wrote it, so bear with me. There's a couple of ways this can be achieved, but since my understanding of scripting is more or less intermediate as opposed to advanced, I will try and give you a way that makes sense to both of us. First off, you could use the AddTimerOrder command to time your attribute, "meter", value increase. But the way I would go about it is this:
I will use the GenericPlayer script as a point of reference. First set your atrribute "meter" to low=0, initial=0, high= 500 and your attribute "able" to low=0, initial=0, high=300 in your Attribute.ini file. Then, start your code like this:
The above portion of code will change your material if the key G is pressed if 500 seconds have passed, and then change back to your initial material once 300 seconds have passed. It will not change your fighting mode though. In order to change to "melee mode", I would add this into the "RunPlayer" section of code:
Now for the melee attack order:
This modification of the code will force a melee attack when you press your "attack button", if you are still within your time frame of transformation. Bare in mind that everything I have added (except the, "MeleeAttack1" command) is a modification of the RunPlayer command in the GenericPlayer script that comes with RF, so don't delete anything from RunPlayer or it won't work anymore. I must admit, I'm sure there are lots of cleaner ways of achieving this effect, but this should work none the less. Good luck and let me know if it worked....
I will use the GenericPlayer script as a point of reference. First set your atrribute "meter" to low=0, initial=0, high= 500 and your attribute "able" to low=0, initial=0, high=300 in your Attribute.ini file. Then, start your code like this:
Code: Select all
GROUP [Good] // Pawn Group - must be targetted by enemies
PLAYERSPEED [96] // Walk Speed
HEALTHATTRIB [health] // health attribute given to pawn
HEALTHAMOUNT [100] // amount of health given to pawn
DAMAGEATTRIB [healthenemy] // Atribute damaged by pawn
BOX [0] // Box width
IDLEANIM [Idle] // Idle AnimationSpeed
WALKANIM [Run] // Walk anim
BACKANIM [RunBack] // walk back anim
STRAFELEFT [StrafeLeft] // Strafe left anim
STRAFERIGHT [StrafeRight] // Strafe right anim
DEATHANIM [Die] // Death Anim
ANIM [string] // Do Not Edit
ANC [0] // Do Not Edit
LASTANC [0] // Do Not Edit
DIR [0] // Do Not Edit
AT [0.5] // Do Not Edit
INTER [string] // Do Not Edit
TM [0] // Do Not Edit
SPEED [0] //Do Not Edit
run_time [0]
Spawn[()
{
Console(false);
BoxWidth(BOX);
SetGroup(GROUP);
AttributeOrder(HEALTHATTRIB, HEALTHAMOUNT, "Die");
SetWeapon(WEAPONMODEL);
LowLevel("Setup");
}]
Setup[()
{
AttachCamera();
self.yaw_speed=256;
AnimateHold(IDLEANIM);
ANIM=StringCopy(IDLEANIM);
ANC=0;
LASTANC=0;
TM=self.time;
self.think="RunPlayer";
}]
RunPlayer[()
{
//debug(self.key_pressed);
PlayerRender(false);
self.ideal_yaw=self.player_yaw;
ChangeYaw();
DIR=0; // Default straight
SPEED=0; // Default - no motion
AT=0.1; // Default
ANC=0; // Default
AnimationSpeed(1); // Default
// handle health status
if(self.health < 1)
{
HighLevel("Die");
return 0;
}
if(run_time < time)
{
if(random(1,10)>7)
{
run_time = time + 1;
ModifyAttribute("meter",1,"Player");
}
}
if(IsKeyDown(30))
{
if(GetAttribute("meter","Player")=500)
{
ChangeMaterial([i]YourMaterialInMaterialSection[/i]);
ModifyAttribute("able",300,"Player");
}
}
if(GetAttribute("meter","Player")=500)
{
if(run_time < time)
{
if(random(1,10)>7)
{
run_time = time + 1;
ModifyAttribute("able",-1,"Player");
}
}
}
if(GetAttribute("meter","Player")=500)
{
if(GetAttribute("able","Player")<1)
{
ModifyAttribute("meter",-500,"Player");
ChangeMaterial([i]OriginalMaterialInMaterialSection[/i]);
}
}
Code: Select all
if(GetAttribute("meter","Player")=500)
{
if(IsKeyDown([i]YourAttackButton[/i]))
{
AnimateHold([i]YourMeleeAttackAnimation[/i]);
self.think="MeleeAttack1";
}
}
Code: Select all
MeleeAttack1[()
{
DamageAtBone(20,18,DAMAGEATTRIB,[i]YourDamageBoneName[/i]);
if(self.animate_at_end)
{
self.think="RunPlayer";
}
}
if(run_time < time)
{
if(random(1,10)>7)
{
run_time = time + 1;
ModifyAttribute("able",-1,"Player");
}
}
}]
A good warrior knows his limits, but a great warrior finds his way around them.