Page 1 of 1

Force attack via script, problem with RequestAttack packet

Posted: Wed Jan 19, 2011 7:20 am
by timginter
Hi.

I'm trying to write a script in which one of the effects is a player going "berserk". I'm trying to force an attack, with no avail, though. I tried tinkering with packet 0x05 (RequestAttack), desperately I even tried to turn the war-mode and try sending a DoubleClick packet - both freeze the client.

Code: Select all

var trg := Target(who);
if( !trg )
	return 0;
elseif( !trg.IsA(POLCLASS_MOBILE) )
	return 0;
elseif( trg.dead )
	return 0;
endif

var hexSerial := Hex(trg.serial);
SendSysMessage(who, "serial: " + hexSerial);

SendPacket(who, "05B700");
Just for the sake of tests I put the serial manually (mob's I was testing it on was 0xB7). I've tried SendPacket(who, "05B7"), SendPacket(who, "0500B7") and SendPacket(who, "05B700"), every version ended with the client frozen. I'm lost.

Re: Force attack via script, problem with RequestAttack pack

Posted: Wed Jan 19, 2011 10:43 pm
by CWO
You can't do something like that through packets because you'll just confuse the client. This is also a function of the server so packets are entirely useless with this.

Is your server POL098 or newer? Have you tried who.attack_once(trg)?

Re: Force attack via script, problem with RequestAttack pack

Posted: Thu Jan 20, 2011 7:34 am
by timginter
Yeah, it's POL098
CWO wrote:Have you tried who.attack_once(trg)?
Yes, nothing happened. I tried both with war mode on and off

I thought about setting war-mode, trg as "Last Target" and somehow either make the character "use" last target, force double-click, send "Last Object" or "Attack Last", I'm out of any better ideas ;)