pulling my hair out here.

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 098.

Moderator: POL Developer

Post Reply
Salinaksm
New User
Posts: 8
Joined: Mon Apr 27, 2009 5:42 am
Location: Salina, KS

pulling my hair out here.

Post by Salinaksm » Sun May 03, 2009 5:19 pm

I am currently working on converting the Ack Raw scripts, we are using for a shard called Asgard, from 95 to 98. well to say the least I have run into a bit of a snag in our spawn system i just can't seem to get around.
I'm really not a proficient scripter but i try.
On too the problem. compiler out put shows a few local variables not used warnings such as these aren't being used. var x1; var y1; var x2; var y2; these represent the coords used in the regions.cfg file.
log output example for the error is when the region spawner is running follows.

Script Error in 'pkg/world/spawners/regionspawner/dospawn.ecl' PC=448:
Call to function MoveObjectToLocation:
Parameter 4: Expected datatype String, got datatype Integer

and the actual script code is:

Code: Select all

use uo;
use os;
use cfgfile;
use util;
use vitals;

include "include/myutil";

var regspawn;
var totalnumspawned := 0;

program SpawnThatStuff( me )

	set_critical(0);

	if (GetGlobalProperty("#regionalspawnerwipe"))
		gmreport("regional spawner is disabled");
		return;
	endif

	if (GetGlobalProperty("#spawnerisrunning"))
		gmreport("regional spawner is still running from last invocation");
		return;
	endif

	SetGlobalProperty("#spawnerisrunning",1 );
	gmreport("regional spawner is running");

	UnloadConfigFile( "regionspawn" );

	regspawn := ReadConfigFile( "regionspawn" );

	var numregions := GetConfigMaxIntKey( regspawn );
	var coords;
	var x1;
	var y1;
	var x2;
	var y2;

	var i;
	for( i := 1; i <= numregions; i := i + 1 )
        	var spawnregion := regspawn[ i ];

		var spawngroups := GetConfigStringArray( spawnregion, "group" );

		foreach spawngroup in spawngroups
			var groupstring := splitwords(spawngroup);
			var groupname := groupstring[1];
			var groupdensity := cint(groupstring[2]);

			if (GetGlobalProperty("regionalspawnerwipe"))
				gmreport("regional spawner is disabled");
				EraseGlobalProperty("#spawnerisrunning");
				return;
			endif
			SpawnThisGroup(i, spawnregion, groupname, groupdensity);
			sleep(30);
		endforeach
    	endfor

	UnloadConfigFile( "regionspawn" );
	EraseGlobalProperty("#spawnerisrunning");
	gmreport("Total mobs respawned: "+ totalnumspawned);

endprogram

function SpawnThisGroup(regionnum, spawnregion, groupname, groupdensity)

	var coords := splitwords(spawnregion.rect);
	var x1 := cint(coords[1]);
	var y1 := cint(coords[2]);
	var x2 := cint(coords[3]);
	var y2 := cint(coords[4]);

	var spawngroup := FindConfigElem( regspawn, groupname );
	if (!spawngroup)
		gmreport("Could not find: "+groupname);
	endif

	var critterlist := GetConfigStringArray( spawngroup, "npc" );

	var sizeofregion := (x2 - x1) * (y2 - y1);
	var numtospawn := cint((sizeofregion * groupdensity)/10000);

	if (!numtospawn)
		numtospawn := 1;
	endif

	var SpawnName := "r"+regionnum+"g"+groupname;

	if (groupdensity == 0)
		gmreport("Erasing: "+SpawnName);
		EraseGlobalProperty(SpawnName);
		return;
	endif

	if ( (RandomInt(1000) == 1) )
		NukeThisGroup(regionnum,spawnregion,groupname);
	endif

	set_critical(1);
	var currentspawn := 0;
	if (GetGlobalProperty(SpawnName))
		currentspawn := Cint(GetGlobalProperty(SpawnName));
	else
		SetGlobalProperty(SpawnName,0);
	endif

	if ( (currentspawn < 1) or (!currentspawn) )
		currentspawn := 0;
		SetGlobalProperty(SpawnName,0);
	endif

	set_critical(0);
	if ( currentspawn <= numtospawn )
		numtospawn := numtospawn - currentspawn;
	else
		NukeThisGroup(regionnum,spawnregion,groupname);
		currentspawn := 0;
	endif		

	if (numtospawn < 1)
		return;
	endif

	var critnum;
	var thecritter;
	var x;
	var y;
	var z;	
	var i;
	var tries;
	var sh;
	var info;

	for( i := 1; i <= numtospawn; i := i + 1 )
		critnum := RandomInt(len(critterlist))+1;

		thecritter := 0;
		tries := 0;
		repeat

			x := RandomInt (x2-x1)+x1;
			y := RandomInt (y2-y1)+y1;
			z := GetMapInfo(x,y).z;
			tries := tries +1;

			sh := GetStandingHeight( x, y, z );
			if (sh.multi or sh.multi.serial)
				thecritter := 0;
			else
				info := hex(GetMapInfo( x , y ).landtile);
				if ((info < 0x406) or (info > 0x455))
					thecritter := createnpcfromtemplate(critterlist[critnum],x,y,z);
					if (thecritter)
						if (!MoveObjectToLocation(thecritter, thecritter.x,
							 thecritter.y, z,0) )
							KillIt(thecritter);
						else
							set_critical(1);
							SetObjProperty(thecritter,"regspawn",SpawnName);
							currentspawn := Cint(GetGlobalProperty(SpawnName))+1;
							SetGlobalProperty(SpawnName,currentspawn);
							totalnumspawned := totalnumspawned +1;
							set_critical(0);
							sleep(1);
						endif
					endif
				endif
			endif

		until (thecritter) or (tries > 50);

		if (tries > 50)
			gmreport ("Error - could not spawn "+ critterlist[critnum] + " in " + SpawnName);
		endif

	endfor

endfunction

function gmreport(text)

	syslog(text);
	
       			ALertGM( "Regionspawner: " + text);
		

endfunction

function KillIt(me)

	var hostiles := ListHostiles(me, 9 );
	if (hostiles.size() or me.warmode)
		EraseObjProperty( me, "regspawn" );
		return;
	endif

	foreach item in ListRootItemsInContainer( me.backpack );
		MoveObjectToLocation(item, me.x, me.y, me.z, 0 );
	endforeach

	MoveObjectToLocation(me, 4550, 3687  , 0,flags := MOVEOBJECT_NORMAL );
	SetObjProperty(me,"guardkill",1);
	ApplyRawDamage (me, GetVital (me, "Life") + 3 );

endfunction

function NukeThisGroup(regionnum, spawnregion, groupname)

	var coords := splitwords(spawnregion.rect);
	var x1 := cint(coords[1]);
	var y1 := cint(coords[2]);
	var x2 := cint(coords[3]);
	var y2 := cint(coords[4]);
	var kills := 0;

	var SpawnName := "r"+regionnum+"g"+groupname;
	gmreport("Resetting : "+SpawnName);

	set_critical(0);
	var x, y, z;
	for( x := x2 ; x > x1 ; x := x  - 16)
    	  for( y := y1; y < y2; y := y + 16 )
	    for( z := -60; z <= 60; z := z + 16 )
		foreach npc in ListMobilesNearLocationEx( x, y, z, 16,0x02+0x01)
			if ( GetObjProperty( npc, "regspawn" ) == SpawnName )
				set_critical(1);
				EraseObjProperty(npc,"regspawn");
				KillIt(npc);
				kills := kills + 1;
				set_critical(0);
			endif
		endforeach
	    endfor
	    sleepms(250);
	  endfor
	endfor
	set_critical(0);
	gmreport("kills: "+kills);
	SetGlobalProperty(SpawnName,0);

endfunction
Any help on sorting this out will be greatly appreciated. I might note that at this point we only intend to use map0 for now. The intention is to add the other realms over time but right now just want to get a functioning conversion.

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Sun May 03, 2009 5:43 pm

On all the script conversions for moving items to locations need to have a "default realm"

example
old way MoveCharacterToLocation(who, x, y, z, MOVECHAR_FORCELOCATION);

new way MoveObjectToLocation( object, x, y, z, realm := _DEFAULT_REALM, flags := MOVEOBJECT_NORMAL );

notice moving items, characters, etc all use the same new command . move obj to location

if you are unable to convert. zip your scripts up and send them to me ill convert them and send them back to you.... if u want .... i understand if u dont ...

just tryin to help...

Salinaksm
New User
Posts: 8
Joined: Mon Apr 27, 2009 5:42 am
Location: Salina, KS

Re: pulling my hair out here.

Post by Salinaksm » Sun May 03, 2009 6:00 pm

Hi there JaceAce. I know you used to play on WOD as did I for several years. Even got to be a seer there for awhile. Character was Randell and was aka Seer Ronson.
At any rate. I know what you mean about the realms flag. Actually did have that in there but removed it just too see if that would change anything. Give me a bit and i'll zip up the src files I have converted and let you see what you might be able to figure out. Do already have a base conversion done and fully compiled. Just trying to sort out the broken scripts and get them working now. There won't be a data file in the zip folder as I am converting off of a full server back up.

Anyone can feel free too grab this conversion and use if they wish. Sharing the use of these scripts is one thing i am wanting to continue as those that came before have done.
Note: As the reason for the initial post, this conversion is far from finished and is not any where near ready for actual shard use.
Last edited by Salinaksm on Fri May 29, 2009 6:18 pm, edited 1 time in total.

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Mon May 04, 2009 2:51 pm

I downloaded the script set. I will look into it in the next couple of days and see what i can do to help you.

I'll keep ya posted...

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 1:06 pm

pkg/items/magicmill

The magicmill package is incomplete. the .src file missing is : containerhack.src

Does anyone have this pkg magicmill that is complete?

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 1:10 pm

pkg/apandapion

missing file: dcnetherblight.src

appears the package is incomplete. Does anyone have a complete package of this?

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 1:18 pm

there is a drocket arena package...

missing some files:

ArenaRegistry.src
ArenaScoreBoard.src

does anyone have a complete package with these 2 source files?

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 1:39 pm

Someone help with those 3 packages so I can get them running right. Anyone who has those scripts please send to me jaceace01@sbcglobal.net

Also, I have already fixed the spawner.... will post how to fix .... soon.... want to get a complete script set working as a whole so i can upload it to ya.... if no one is able to find those files. ill just remove the package apandapion, place a different arena package into it ... and remove the magic mill pkg...

and continue on with the fix...

but it would be REAL nice to get it back to an original state!

:)

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 1:59 pm

(Side Note to anyone curious)
Ive been working out alot of bugs on the original World of Dreams Script Set for 098 as a completed server script set. It has come along way ( oh i run a very private shard ).

My ultimate plans: Once I have gotten all the "minor" bugs worked out of the original script set, I will "rewrite" completely all the scripts to a modern standard. So in the future we will have a complete World of Dreams 098 script set. Then i plan on keeping them up to date with pol as it progressess...

Thats my plans anyway....

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 2:00 pm

I ran into the same spawn problem in the Original World of Dreams script set and have already fixed it.. so no big deal on this script set fix ...

its alot of manual typing but its fixable...

Salinaksm
New User
Posts: 8
Joined: Mon Apr 27, 2009 5:42 am
Location: Salina, KS

Re: pulling my hair out here.

Post by Salinaksm » Tue May 05, 2009 2:50 pm

Ok down the list.
Magicmill seemed like it was never fully completed. I have actually combined the magicmill and the magic_dealer. Was a quick hack so I could introduce the magic_dealer into the shard. The magic_dealer himself will be getting a small re-write to the takeitems script and the mill is going to die. The mill is entirely too buggy right now. Such as the GM control switch breaks the mill if used.

dcnetherblight.src not sure about this, but i believe that it was removed from the script base on purpose. During a point in the life of Ack Raw this new blight system was created and actually brought the server too it's knees, so too speak, the entire blight spawn went haywire. In the end, they ended up re-setting the server because of it and forbid the use of those particular blights.

There is an arenascoreboard.src there just look for arenascoreboad.src.bak the scoreboard is as of yet incomplete and non functioning.

On a side note. I had for awhile considered bringing WOD back to life. I even have a copy of one of the last world saves in existence, thanks too Aardwolf. But for personal reasons my wife told me no way. I'll send you an email why she didn't and still doesn't want me to bring the Dream back on line.

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Tue May 05, 2009 3:20 pm

Salinaksm wrote:Magicmill seemed like it was never fully completed
Salinaksm wrote:dcnetherblight.src not sure about this, but i believe that it was removed from the script base on purpose
Salinaksm wrote:There is an arenascoreboard.src
Ok, i will remove them from the start up etc. So we will get a working copy going...

JaceAce
Expert Poster
Posts: 74
Joined: Fri Feb 29, 2008 10:56 pm

Re: pulling my hair out here.

Post by JaceAce » Wed May 06, 2009 7:52 am

Note: I have finished helping with the region spawner... Salinaksm has approved of allowing others to download the version I have modified so check out the custom scripts area for the newer version that i have modified...

Post Reply