Full Version : Hiding information
xmlspawner >>Scripting Support >>Hiding information
<< Prev | Next >>
ozzy- 01-12-2007
I was wonder how to go about moding an item or wep script so that it only shows the name of it. The item would just not call up its attribute and stuff like that. I dont want these items to ever show anything but its name even if ided. I know there are some super scripters out there that know how to add code lines to do this, can you help me out.
ArteGordon- 01-12-2007
if you override the GetProperties method in the script for the item, you can control exactly what is included in the properties list.
If you wanted the list to only show the name, do something like this.

CODE
public override void GetProperties(ObjectPropertyList list) { list.Add(Name); }

ozzy- 01-12-2007
Thanks that worked great. I know you are a very very good scripter thanks for having time for the little guys. I have seen alot of your scripts, and heard about you from many ppl. Its nice to know that someone of your stature is there to help.
ArteGordon- 01-12-2007
glad to help.
ozzy- 01-12-2007
I have a few good ones for you. If i wanted to add use hiding skill targeting yourself automaticly, into the on double click method, how would i do that. Something like this?
SkillInfo.Table[21].Callback = new SkillUseCallback( OnUse );
m.Target - self;
Also i was wanting to add speach command of change hue, and have it go threw all the hue's 1 by one, one for each time you say change hue. That i know is in a script i have been looking for but cant seem to find anymore.
ozzy- 01-12-2007
Almost forgot When double clicked a second time makes you unhide or reveal.
ArteGordon- 01-12-2007
To hide using the Hiding skill, just call the Hiding.OnUse method, like
Hiding.OnUse(m);
to unhide you can call the RevealingAction method on the player like
m.RevealingAction();
ozzy- 01-12-2007
Thanks again for all your help. That didnt work i guess im missing something. I added alot of the using things that go at the top of the script but, i havent found the right one i guess. Here is what that part of my script looks like so far.

CODE
public override void OnDoubleClick( Mobile m ) { if( Parent != m ) { m.SendMessage( "You must be wearing the robe to use it!" );
}
else
{
if ( ItemID == 0x2683 )
{
m.SendMessage( "You lower the hood." );
m.PlaySound( 0x57 );
ItemID = 0x1F03;
m.RevealingAction();
m.NameMod = null;
m.DisplayGuildTitle = true;
}
else if ( ItemID == 0x1F03 )
{
m.SendMessage( "You pull the hood over your head." );
m.PlaySound( 0x57 );
ItemID = 0x2683;
Hiding.OnUse(m);
m.NameMod = "A Shrouded Figure";
m.DisplayGuildTitle = false;
}
}
}
public override bool OnEquip( Mobile from )
{
from.Skills[SkillName.Hiding].Base += 100.0;
from.Skills[SkillName.Stealth].Base += 100.0;
return base.OnEquip(from);
}
public override void OnRemoved( object parent )
{
if ( parent is Mobile )
{
Mobile m = (Mobile)parent;
m.Skills[SkillName.Hiding].Base -= 100.0;
m.Skills[SkillName.Stealth].Base -= 100.0;
if(ItemID == 0x2683)
{
ItemID = 0x1F03;
m.RevealingAction();
m.NameMod = null;
m.DisplayGuildTitle = true;
}
}
base.OnRemoved( parent );
}

I gave it a try and got this error.

CODE
- Error: Scripts\New Stuff\Ozz Armor\OzzysMysteryRobeOfPower.cs: CS0246: (line 94, column 7) The type or namespace name 'Hiding' could not be found (are you mi ssing a using directive or an assembly reference?)

ArteGordon- 01-12-2007
you need to include this at the beginning of the script since that is the namespace in which the Hiding class is defined.

CODE
using Server.SkillHandlers;

ozzy- 01-12-2007
Ah HA!! I thought it had to do with using directives but didnt know whith one im not sure if there is a list of all them or not. Thanks again you are my god lol. Know all i have to do is figure out the whole hue change thing and im set. I mentioned that above incase your wondering lol. and thanks again
ozzy- 01-12-2007
I found the code i was looking for, it was on a pet script. Here is the code, or at least the part im having trouble with.

CODE
public override void OnSpeech(SpeechEventArgs e) { if ( parent is Mobile )//Edit/add what ever color you want below:

The if ( parent is Mobile ) is the part that is messing up on me what else could i put in there?
ArteGordon- 01-12-2007
that is called after the speech is already generated. You want to change this override in your playermobile.cs

CODE
public override void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { // change the hue to whatever you want at the beginning of the method ... }

ozzy- 01-12-2007
so if i just wanted to say ( change hue ) and have it to change to a random hue would the code still look the same?
ozzy- 01-12-2007
This is what i have so far. I added thid code to my playermobile.cs

CODE
public override void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { this.Hue = Utility.Random(2, 1200); }

That does not bring up any errors. This is what i have in my robe script.

CODE
public override void OnSpeech(SpeechEventArgs e) { if ( parent is Mobile ) { if (e.Speech == "change hue")
{
this.Hue = Utility.Random(2, 1200);//Edit which colors you want him to cycle through here.
}
}
}

That brings up this error.

CODE
- Error: Scripts\New Stuff\Ozz Armor\OzzysMysteryRobeOfPower.cs: CS0103: (line 115, column 18) The name 'parent' does not exist in the class or namespace 'Serv er.Items.OzzysMysteryRobeOfPower'

ArteGordon- 01-12-2007
this is wrong

CODE
public override void DoSpeech( string text, int[] keywords, MessageType type, int hue ) { this.Hue = Utility.Random(2, 1200); }

you need to ADD a line like this

CODE
hue = Utility.Random(2, 1200);

to the beginning of the existing DoSpeech override in playermobile.cs
If you replace it like you did, you will effectively block the display of all speech since all your method is now doing is just changing the Hue of the player.
If you want your robe to control this behavior, you are going to have to add a new property to your playermobile and have your robe set that property.
Then in your DoSpeech method, you will have to check for that property and set the hue of the speech.
(edit)
Are you trying to change the hue of the speech, or the Hue of the robe when they speak?