Demount

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Demount

Post by runtest »

Code: Select all

  	var mount := GetEquipmentByLayer( defender, 25 );
  	var animal := SystemFindObjectBySerial(CInt(GetObjProperty(mount,"serial")));
	if( attacker.weapon.desc == "a bardiche" )
		var animal := SystemFindObjectBySerial(CInt(GetObjProperty(mount,"serial")));
  		animal.facing := defender.facing;
  		EraseObjProperty(animal, "mounted");
  		EraseObjProperty(animal, "mounted_on");
  		MoveCharacterToLocation( animal, defender.x, defender.y, defender.z, MOVECHAR_FORCELOCATION);
  		DestroyItem(mount);
	endif
I am trying to have the player knocked of his horse if hit by a pol weapon. I will setup skill checks and dice rolls later. I am running into a problem. After being knocked off you can not remount without re-taming it.
runtest
Grandmaster Poster
Posts: 194
Joined: Sat Aug 05, 2006 11:43 am

Post by runtest »

Code: Select all

use uo;

function Dismount( who )
  	var mount := GetEquipmentByLayer( who, 25 );
	var serial := GetObjProperty(mount, "serial");
	var animal := SystemFindObjectBySerial(CInt(serial));
  	EraseObjProperty(animal,"serial");
   	EraseObjProperty(animal,"mounted");
   	EraseObjProperty(animal,"mounted_on");
	animal.facing := who.facing;
	var ev := array;
   	ev.+ type;
   	ev.+ source;
    	ev.type := EVID_WAKEUP;
    	ev.source := who;
    	SendEvent(animal, ev);
    	MoveCharacterToLocation(animal, who.x, who.y, who.z, MOVECHAR_FORCELOCATION);
    	RestartScript(animal);
	DestroyItem( mount );
endfunction
Austin brought up a good idea. I just dropped this in a mount.inc in my pol 96. Now I can Dismount(who). Works great. I stole the code from dblClickSelf.
Post Reply