Adding include files?

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
Terryl
Neophyte Poster
Posts: 32
Joined: Thu Aug 10, 2006 9:59 am

Adding include files?

Post by Terryl »

Is there any way to add include files? Because I want to have two different kinds of dismount script and use one for a special kind of mounts. I want that kind to get deleted upon dismounting. But in the script I cannot see anywhere the dismount include is being called. If I include my own dismount script with a few lines at the top will that over-ride using the normal one? Or how can I do that? ;)
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

An include file usually is a collection of constants and functions that you want shared, so many scripts can use them. To "add" an include file you simply create it and include it in a script.

Could you post some relevant code?

If you wanted some mounts to disappear when dismounted, you could probably just do it with a cprop and a few lines in the code that handles dismounts.
Terryl
Neophyte Poster
Posts: 32
Joined: Thu Aug 10, 2006 9:59 am

Post by Terryl »

tekproxy wrote:An include file usually is a collection of constants and functions that you want shared, so many scripts can use them. To "add" an include file you simply create it and include it in a script.

Could you post some relevant code?

If you wanted some mounts to disappear when dismounted, you could probably just do it with a cprop and a few lines in the code that handles dismounts.
Yeah, probobly, but somehow that fucked up death.ecl and chrdeath.ecl :/


My dismount.inc looks like this:

Code: Select all

use uo;
use os;
use basic;


include "include/myutil";
//include "include/attributes";
include "include/client";

//function returns 0 if the animal couldn't be created and/or
//if the mount wasn't destroyed

function dismount( me, mount := 0 )

	set_critical(1);

	if( !mount )
		if( !me )
			set_critical(0);
			return 0;
		else
			if( !me.corpseType )
				mount := GetEquipmentByLayer( me, LAYER_MOUNT );
			else
				foreach item in ListRootItemsInContainerOfObjtype(me, 0xf021)
					mount := item;
				endforeach
			endif
		endif
	endif

	if( !mount )
		set_critical(0);
		return 0;
	endif

	var critter := GetObjProperty( mount, "npctemplate" );
	if( !critter )
		critter := "horse";
	endif

	var animal := CreateNpcFromTemplate(critter, me.x, me.y, me.z);
	if( !animal )
		set_critical(0);
		return 0;
	endif

	animal.color := mount.color;
	SetObjProperty( animal, "color", mount.color );

	if (GetObjProperty(mount, "petname"))
		animal.name := GetObjProperty(mount, "petname");
	endif

	if (GetObjProperty(mount,"pethp"))
		SetHp(animal, GetObjProperty(mount,"pethp"));
	endif

	if (GetObjProperty(mount,"petmana"))
		SetMana(animal, GetObjProperty(mount,"petmana"));
	endif

	if( me )
		if( me.corpseType )
			SetObjProperty(animal, "master", me.serial );
			var master := SystemFindObjectBySerial( CInt(GetObjProperty( me, "whose" )) );
			if( master )
				animal.script := "tamed";
				animal.setmaster( master );
			endif
			animal.facing := me.facing;
			RestartScript(animal);
		elseif( !me.npctemplate )
			SetObjProperty( animal, "master", me.serial );
			animal.setmaster( me );
			animal.script := "tamed";
			animal.facing := me.facing;
			RestartScript(animal);
		endif
	else
		SetObjProperty(animal,"killme",1);
	endif

	if (DestroyItem( mount ))
		set_critical(0);
		return 1;
	else
		set_critical(0);
		return 0;
	endif

endfunction

But where is a dismountscript, because the dismount is just handeled like any mount. When riding on the special mount the rider gets a prop CProp "DMount" 1

I think a simple thing like giving a var the property

Code: Select all

var Dmount := GetObjProperty (me, "Dmount");
then when the horse or whatever is created add

Code: Select all

If (Dmount)
SetObjProperty(animal,"killme",1);
endif

What you guys think bout that?
dr_bliss
New User
Posts: 20
Joined: Mon Aug 07, 2006 2:02 am

Post by dr_bliss »

But where is a dismountscript
If you have distro based shard you should check your dblclickself.src (this script dismounts characters in general - except death and some other events). So if you want add custom dismount function you should modify dblclickself.src, death.src and chrdeath.src.
Post Reply