Adding include files?
Adding include files?
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? 
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.
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 :/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.
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
endfunctionBut 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");
Code: Select all
If (Dmount)
SetObjProperty(animal,"killme",1);
endif
What you guys think bout that?