Untitled
By: a guest | Mar 18th, 2010 | Syntax:
None | Size: 1.36 KB | Hits: 40 | Expires: Never
//! zinc
library Footman {
struct Footman {
unit u;
real x;
real y;
static method create (unit u) -> thistype {
thistype f = Footman.allocate();
f.u = u;
f.x = GetUnitX();
f.y = GetUnitY();
return f;
}
method Kill() {
KillUnit(this.u);
}
method ScrambleLocation() {
SetUnitX( this.u, this.x + GetRandomReal(0,100) );
SetUnitY( this.u, this.y + GetRandomReal(0,100) );
}
}
Footman foot;
function ChatHandlerAction() {
foot.Kill();
}
function SChatHandlerAction(){
foot.ScrambleLocation();
}
function onInit() {
trigger chatHandler = CreateTrigger();
trigger scramblerChatHandler = CreateTrigger();
TriggerRegisterPlayerChatEvent( chatHandler, Player( 0 ), "kill", true );
TriggerRegisterPlayerChatEvent( scramblerChatHandler, Player( 0 ), "scramble", true );
TriggerAddAction( chatHandler, function ChatHandlerAction );
TriggerAddAction( scramblerChatHandler, function SChatHandlerAction );
foot = Footman.create( gg_unit_hfoo_0001 );
}
}
//! endzinc