It is currently Mon Dec 01, 2008 11:03 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: I need help with something POL95 script
PostPosted: Sat Aug 19, 2006 12:52 pm 
Offline

Joined: Sat Aug 19, 2006 12:47 pm
Posts: 33
I have donator horses people can get however when they dismount it produces a horse I would want it to not to do this.here is a script

Use uo;

Program Horse_Mount( who, item )

If( !ReserveItem( item ) )
Return;
Endif

var mounttype := 0x3ea0;

var alreadymounted := GetEquipmentByLayer( who, 25 );
if( alreadymounted )
SendSysMessage( who , "You are already mounted." );
return 0;
endif
if( mounttype )
var mount := CreateItemAtLocation( who.x, who.y, who.z, 0xF021, 1 );
mount.movable := 1;
mount.color := item.color;
mount.graphic := mounttype;
EquipItem( who, mount );
mount.movable := 0;
SendSysMessage( who, "You mounted the horse." );
SetObjProperty( who, "DMount", 1 );
endif

EndProgram
please tell me how to fix it so when they dismount the mount disappears.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 1:10 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
It looks to me as if you would have to add
DestroyItem( mounttype);

somewhere, but im not sure where..


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 1:37 pm 
Offline

Joined: Sat Aug 19, 2006 12:47 pm
Posts: 33
and do i have to put like sphinxmount where it says mounttype?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 1:40 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
In your script you set the variable "mounttype" to what im assuming is the mount type, so it should delete the mount, but dont take my word im a noobie scriptor


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 1:43 pm 
Offline

Joined: Sat Aug 19, 2006 12:47 pm
Posts: 33
That didnt work thanks tho for trying.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 19, 2006 2:38 pm 
Offline

Joined: Sat Aug 19, 2006 12:47 pm
Posts: 33
Someone told me i have to look at the dismount script I did and Its all confusing I am not sure where to tweek this at.




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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 6:40 am 
Offline

Joined: Thu Aug 10, 2006 9:59 am
Posts: 32
Hi, Im trying to solve the same problem, I was the one who thought the dismount include was probobly what he should edit. Right now I've made this change to the include file. My thought was that this would stop it from even being created, although this was wrong :P can anyone point my in any direction on how I should do this?

Code:

var donatormount := GetObjProperty( me, "DMount");

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



I also tried the solution of setting like

Code:
if(donatormount==1)
DestroyItem(animal);


should I use something else than destroy item for animals?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 6:51 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
In your first code terryl, could you post the entire thing because i don't see where you actually dismount in just that small script... But i would find the part where it sees if its dismounted or not, and if it is then do
if ( mounttype )
destroyitem(mounttype);
endif


And i would think thats all you would have to do


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 7:01 am 
Offline

Joined: Thu Aug 10, 2006 9:59 am
Posts: 32
Poi wrote:
In your first code terryl, could you post the entire thing because i don't see where you actually dismount in just that small script... But i would find the part where it sees if its dismounted or not, and if it is then do
if ( mounttype )
destroyitem(mounttype);
endif


And i would think thats all you would have to do


The whole script is the one that Avenging Angel posted, the problem with what you said is that only way you can accually tell its a donatormount is by the color or the prop that the player has while sitting on it. Thats why I want to try to use the var donatormount. It is a good idea you have, I can look into the colors different mounts get and if its a special one I could just set something like mountcolor

Code:
var mountcolor := GetObjectProp (animal, "color");
if (mountcolor > 0)
destroyitem(animal);
endif


couldn't I? Or am I completely wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 20, 2006 7:24 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 147
Location: Illinois, USA
You can use the color of the mount to check for this special mount. I would recommend making a new object number for this mount though and use that. Then regardless of the color, say someone gets one that is a different color at some point :) , the objtype number stays the same.

You do not need to add a new graphic for this either. Just define it with the existing graphic you want to use and away you go.

Here is an example of something I did to set up a new steed in my scripts.


Code:
NpcTemplate praetoriansteed
{
   Name         Ibn'Najm
   script      :domestic_animals:ai_animal_barker
   ObjType      0xe4
   Color      0
   TrueColor      0
   RandomColor   6
   Gender      0
   STR         90
   INT         25
   DEX         80
   HITS         90
   MANA         0
   STAM         50

   AttackSpeed      38
   AttackDamage      1d6+3
   AttackAttribute   Wrestling
   AttackHitScript   :hitscripts:npc_melee
   AttackHitSound      0xAB
   AttackMissSound   0x239
   DeathSound      0xad
   AR            6
   msPerAttack      2100
   hitSound      0xa9
   hitSound      0xaa
   hitSound      0xab
   hitSound      0xac
   missSound      0x239
   missSound      0x23a
   missSound      0x23b
   attackAnim      0x5
   attackAnim      0x6
   attackAnim      0x7

   MagicResistance   30
   Tactics         50
   Wrestling         60

   npc_helper      horse2
   npc_helper      horse3
   npc_helper      horse4
   npc_helper      horse5

   tameskill         50
   food            veggie
   guardignore      1
   provoke         40
}


The objtype is the same as the one for a normal horse. This allows me to do some different things with the animal should I want to, such as you are wanting to so. This is just one option of course and I am sure there are others out there.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl