Core Party System

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 098.
Post Reply
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Core Party System

Post by OldnGrey »

Hi,
I am trying to wipe out TekProxy's party hook and just use the core one. Thanks for the hook Tekproxy, but it's time to leave it :)

My problem is that I need to run a script when a party has just been formed. I know this isn't OSI, but I don't really want to rescript all the party system just to cover this. When a party is first formed I need a gump to open for the leader to offer some options.

Is there any way I can achieve this?
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Re: Core Party System

Post by ncrsn »

There seems to be no syshook for that, so the short answer is no.

However, you can work your way around this. E.g. add a is-there-yet-a-party check in the CanAddToParty hook and launch a control script if there isn't - run it for DeclineTimeout seconds and if leader gets his party, run the party created stuff.

Maybe a lot cleaner method to achieve this is to do the checks in packet hook(s). Even easier ways may exist but I can't think of any right now.

Until a new syshook is added, this, in my opinion, is not an easy operation.
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Re: Core Party System

Post by MuadDib »

Sounds like a good time for a "OnPartyCreation" syshook request :)
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: Core Party System

Post by OldnGrey »

Added to feature requests - and it's being worked on!! woot.

As far as getting 098 to work, ncrsn's idea works just fine. In case anyone else wants to run some test code when a party is formed, try this:

party.cfg

Code: Select all

	CanAddToParty	:party:syshook_CanAddToParty
:party:syshook_CanAddToParty.src

Code: Select all

use uo;
use os;
use util;

exported function CanAddToParty(leader, member)
	if ( leader.party )
		print("Party exists. exiting");
	else
		print("Starting partygump script");
		Start_Script(":character:partygump", leader);
	endif

	return 1;

	// paramters not used
	member := member;
endfunction


program SysHookCanAddToPaty()
	Print("Adding in CanAddToParty hook");
	return 1;
endprogram
:character:partygump.src

Code: Select all

use cfgfile;
use uo;

include ":gumps:yesno";
include ":gumps:gumps";
include ":gumps:gumps_ex";


program partygump(character)
	for i := 1 to 15 // yeah I know, I should read party.cfg and look for DeclineTimeout
		var party := character.party;
		if ( party )
			var members := party.members;
			if ( members.Size() > 1 )
				dogump(character);
				return 1;
			endif
		endif
		sleep(1);
	endfor
endprogram


function dogump(character)
	var party := character.party;
	var result := YesNo(character, "Group share looted gold?", "Yes, share gold automatically", "No, every player keeps looted gold");
	if ( result )
		party.setprop("shareloot", 1);
	else
		party.eraseprop("shareloot");
	endif
	return 1;
endfunction
That way I can test for "shareloot" with

Code: Select all

	var party := character.party;
	var share_loot := party.getprop("shareloot");
In my looting and selling scripts.
Post Reply