Page 1 of 1

doubleclick event

Posted: Mon Jan 30, 2012 9:55 pm
by gundamwing84
hey guys, sorry to say but i cant figure this one out. in game i cannot double click a horse to mount it, and ive been looking through the DoDoubleClickEvent() function on my shard scripts and i cant get it to work. ive added realm into move object to location, etc, but i just cant figure this one out :(

here is the function:

Code: Select all

function DoDoubleClickEvent ();
	if (distance (me, mymaster) > 1)
		return 0;
	endif

	case (me.graphic)
		CID_PACK_HORSE:
		CID_PACK_LLAMA:
			if (!me.backpack)
				var newbackpack := CreateItemAtLocation (5288, 1176, 0, UOBJ_BACKPACK, 1);
				if (!EquipItem (me, newbackpack))
					DestroyItem (newbackpack);
				endif
			endif
			SendOpenSpecialContainer (mymaster, me.backpack);
			return 0;
	endcase

	//make sure they aren't already mounted
	if (GetEquipmentByLayer (mymaster, LAYER_MOUNT))
		return 0;
	endif

	mymaster.hidden := 0;
	var mounttype := 0;

	case (me.graphic)
		CID_BROWN_HORSE:
			mounttype := 0x3ea2;
		CID_TAN_HORSE:
			mounttype := 0x3e9f;
		CID_LIGHT_HORSE:
			mounttype := 0x3ea0;
		CID_GREY_HORSE:
			mounttype := 0x3ea1;
		CID_LLAMA:
			mounttype := 0x3ea6;
		CID_DESERT_OSTARD:
			mounttype := 0x3ea3;
		CID_FRENZIED_OSTARD:
			mounttype := 0x3ea4;
		CID_FOREST_OSTARD:
			mounttype := 0x3ea5;
		endcase

	if (mounttype)
		if (MoveObjectToLocation (mymaster, me.x, me.y, me.z, me.realm, 0))
			drop();
			set_critical (1);
			mymaster.facing := me.facing;
			var mount := CreateItemAtLocation (5288, 1176, 0, UOBJ_MOUNT, 1);
			if (!mount)
				set_critical(0);
				return 0;
			endif
			mount.color := me.color;
			mount.graphic := mounttype;

			SetObjProperty (mount, "petname", me.name);
			SetObjProperty (mount, "npctemplate", me.npctemplate);
			SetObjProperty (mount, "pethp", CINT (GetVital (me, "Life")/100));
			SetObjProperty (mount, "petmana", CINT (GetVital (me, "Mana")/100));
			SetObjProperty (mount, "petgraphic", me.graphic);
			SetObjProperty (mount, "freetime", freetime);
			if (Getobjproperty (me, "summoned"))
				SetObjProperty (mount, "summoned", 1);
			endif
			if (GetObjProperty (me, "totem"))
				SetObjProperty (mount, "totem", GetObjProperty (me, "totem"));
			endif
			if (GetObjProperty (me, "totemcolor"))
				SetObjProperty (mount, "totemcolor", GetObjProperty (me, "totemcolor"));
			endif
			if (GetObjProperty (me, "totemdeaths"))
				SetObjProperty (mount, "totemdeaths", GetObjProperty (me, "totemdeaths"));
			endif

			if (GetObjProperty (me, "ownerserial"))
				SetObjProperty (mount, "ownerserial", GetObjProperty (me, "ownerserial"));
				SetObjProperty (mount, "ownername", GetObjProperty (me, "ownername"));
				SetObjProperty (mount, "oldname", GetObjProperty (me, "oldname"));
			endif

			if (!EquipItem (mymaster, mount))
				DestroyItem (mount);
				set_critical(0);
				return 0;
			endif
			MoveObjectToLocation (me, 4550, 3687, 0, realm := _DEFAULT_REALM, flags := MOVEOBJECT_FORCELOCATION );
			SetObjProperty (me, "guardkill", 1);
			ApplyRawDamage (me, GetVital (me, "Life") + 3);
			set_critical(0);
		endif
	endif
endfunction
as u can see moveobjecttolocation() has the appropriate flags and what not, and its the only thing that i think could be the error in mounting =\

does anyone have any ideas?

Re: doubleclick event

Posted: Mon Mar 19, 2012 7:23 pm
by Agata
Are you sure this function is being called from the horse's AI script? Please verify the horse's script name and make sure it's the intended one. That would be the first step in verifying.

Re: doubleclick event

Posted: Wed Mar 21, 2012 4:35 am
by Yukiko
That doubleclick function is probably in the tamedAI script. Gundam, you didn't mention this so I have to ask, is the horse tamed? If not that would be the problem. One other question, does double-clicking a tamed pack horse or pack llama open its pack?