Ah! I've got it! I found some much simpler scripts in the credits.gsc
What I did was place a chair, and named it prison_chair. Then I made 2 actors (spawners) and named them price and prison_guard.
And here is the script that I modified (I named it beat.gsc)
Code:
#include maps\_utility;
#include maps\_anim;
#include animscripts\utility;
#include animscripts\shared;
#using_animtree("generic_human");
main()
{
maps\_load::main();
maps\beat_anim::main();
level.player takeallweapons();
level.player giveweapon("m1carbine");
level.player giveweapon("colt");
level.player giveweapon("fraggrenade");
level.player switchtoweapon("colt");
flag_init ("spit");
thread beating();
}
beating()
{
chair = getent("prison_chair", "targetname");
guard = getent("prison_guard", "targetname")stalingradspawn();
price = getent("price", "targetname")stalingradspawn();
level.price = price;
level.chair = chair;
level.guard = guard;
spawn_failed(guard);
spawn_failed(price);
guard.ignoreme = true;
price.ignoreme = true;
guard.pacifist = true;
price.pacifist = true;
price.animname = "price";
guard.animname = "guard";
guys[0] = price;
guys[1] = guard;
//To stop the animation if guard is killed
thread stop_beating();
//To loop the beating animation
for (;;)
{
guard endon ("death");
if (flag ("spit"))
{
flag_clear ("spit");
level notify ("startSpit");
chair melee_anim (guys, "spit");
}
else
chair melee_anim (guys, "double");
}
}
melee_anim (guys, anime)
{
self notify ("stopIdle");
guys[1] endon ("death");
thread anim_single (guys, anime);
array_thread(guys, ::loopStarter, self);
self waittill (anime);
}
loopStarter(chair)
{
chair endon ("stopIdle");
self waittillmatch ("single anim","end");
chair anim_loop_solo(self, "idle", undefined, "stopIdle");
}
stop_beating()
{
price = level.price;
level.guard.ignoreme = false;
level.guard.health = 1;
level.guard.allowdeath = true;
level.guard waittill ("death");
flag_set("price_rescued");
price stopanimscripted();
level.chair notify ("stopIdle");
//level.chair thread anim_loop_solo (price, "idle", undefined, "stopIdle");
}
And in the beat_anim.gsc:
Code:
#include maps\_utility;
#include maps\_anim;
#include animscripts\utility;
#using_animtree("generic_human");
main()
{
level.scr_anim["price"]["idle"][0] = %german_idle;
level.scr_anim["price"]["double"] = %german_doublepunch;
level.scr_anim["price"]["spit"] = %german_gethit3;
level.scr_anim["guard"]["idle"][0] = %guard_idle;
level.scr_anim["guard"]["double"] = %guard_doublepunch;
level.scr_anim["guard"]["spit"] = %guard_wipeface;
addNotetrack_sound("guard", "punch", "double", "moscow_fistfist");
addNotetrack_sound("guard", "punch", "double", "melee_hit");
}
The last line in beat.gsc is quoted so that once the guard is killed, Price immediately gets up. If you unquote the line, Price will remain in the chair, just sitting there.
For instance if you want to free Price after killing the guard unquote the last line, create a trigger_use over Price, deactivate it in the main() thread, and put
Code:
thread free_Price();
after the line you just unquoted. Then add the following to your script:
Code:
free_price()
{
free_trig=getent("free_price_trigger", "targetname");
//To activate the trigger again
free_trig triggeron();
free_trig waittill("trigger");
level.chair notify ("stopIdle");
}
In other words, your script would look like this now:
Code:
#include maps\_utility;
#include maps\_anim;
#include animscripts\utility;
#include animscripts\shared;
#using_animtree("generic_human");
main()
{
maps\_load::main();
maps\beat_anim::main();
level.player takeallweapons();
level.player giveweapon("m1carbine");
level.player giveweapon("colt");
level.player giveweapon("fraggrenade");
level.player switchtoweapon("colt");
flag_init ("spit");
free_trig=getent("free_price_trigger", "targetname");
free_trig triggeroff();
thread beating();
}
beating()
{
chair = getent("prison_chair","targetname");
guard = getent("prison_guard","targetname")stalingradspawn();
price = getent("price","targetname")stalingradspawn();
level.price = price;
level.chair = chair;
level.guard = guard;
spawn_failed(guard);
spawn_failed(price);
guard.ignoreme = true;
price.ignoreme = true;
guard.pacifist = true;
price.pacifist = true;
price.animname = "price";
guard.animname = "guard";
guys[0] = price;
guys[1] = guard;
thread stop_beating();
for (;;)
{
guard endon ("death");
if (flag ("spit"))
{
flag_clear ("spit");
level notify ("startSpit");
chair melee_anim (guys, "spit");
}
else
chair melee_anim (guys, "double");
}
}
melee_anim (guys, anime)
{
self notify ("stopIdle");
guys[1] endon ("death");
thread anim_single (guys, anime);
array_thread(guys, ::loopStarter, self);
self waittill (anime);
}
loopStarter(chair)
{
chair endon ("stopIdle");
self waittillmatch ("single anim","end");
chair anim_loop_solo(self, "idle", undefined, "stopIdle");
}
stop_beating()
{
price = level.price;
level.guard.ignoreme = false;
level.guard.health = 1;
level.guard.allowdeath = true;
level.guard waittill ("death");
flag_set("price_rescued");
price stopanimscripted();
level.chair notify ("stopIdle");
level.chair thread anim_loop_solo (price, "idle", undefined, "stopIdle");
thread free_price();
}
free_price()
{
free_trig=getent("free_price_trigger", "targetname");
free_trig triggeron();
free_trig waittill("trigger");
level.chair notify ("stopIdle");
}