|
||
|
|||||||
| New Join Forum So your new to RunUO and looking to work with people that are new, this is the place. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Novice
|
I'm trying to script my own ranger warrior thingy. Which will spawn a random peice of ranger armor upon death. But while you fight it, it wears a full set of ranger armor. How do I make it so what he's wearing disappears when you kill it (the ranger armor), so that only one peice of random ranger armor is left on the corpse after it's dead. Instead of the full suit. - hope that makes sense.
|
|
|
|
|
|
#3 (permalink) |
|
Forum Novice
|
Well, I modified the Brigand script so it worked for my ranger guy instead. Everything works like I want it to, I get no errors. My question though is how do I make the armor that the monster is wearing disappears after he dies, so that you only get one random peice of ranger armor instead of the full set off the corpse. Here is the script.
Code:
using System;
using System.Collections;
using Server.Items;
using Server.ContextMenus;
using Server.Misc;
using Server.Network;
namespace Server.Mobiles
{
public class ForestRanger : BaseCreature
{
public override bool ClickTitle{ get{ return false; } }
[Constructable]
public ForestRanger() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
{
SpeechHue = Utility.RandomDyedHue();
Title = "Forest Ranger";
Hue = Utility.RandomSkinHue();
if ( this.Female = Utility.RandomBool() )
{
Body = 0x191;
Name = NameList.RandomName( "female" );
AddItem( new Skirt( Utility.RandomNeutralHue() ) );
}
else
{
Body = 0x190;
Name = NameList.RandomName( "male" );
AddItem( new ShortPants( Utility.RandomNeutralHue() ) );
}
SetStr( 86, 100 );
SetDex( 81, 95 );
SetInt( 61, 75 );
SetDamage( 10, 23 );
SetSkill( SkillName.Archery, 85.0, 97.5 );
SetSkill( SkillName.Macing, 65.0, 87.5 );
SetSkill( SkillName.MagicResist, 25.0, 47.5 );
SetSkill( SkillName.Swords, 65.0, 87.5 );
SetSkill( SkillName.Tactics, 75.0, 90.5 );
SetSkill( SkillName.Wrestling, 15.0, 37.5 );
Fame = 1000;
Karma = -1000;
AddItem( new Boots( Utility.RandomNeutralHue() ) );
AddItem( new RangerArms());
AddItem( new RangerChest());
AddItem( new RangerGloves());
AddItem( new RangerGorget());
AddItem( new RangerLegs());
switch ( Utility.Random( 2 ))
{
case 0: AddItem( new CompositeBow() ); break;
case 1: AddItem( new Bow() ); break;
}
AddItem( Server.Items.Hair.GetRandomHair( Female ) );
}
public override void GenerateLoot()
{
PackGold( 150, 225 );
}
public override bool AlwaysMurderer{ get{ return true; } }
public ForestRanger( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
|
|
|
|
|
|
#5 (permalink) |
|
Forum Novice
|
I'm not experienced enough to write code on my own, so I take from other scripts and add modify scripts. So, after some searching I found a newbie loot thingy on a dummy sword dude.
I applied the code to my script using ranger armor instead of normal leather in the dummysword script. And it worked fine for the arms, but when I applied the code to all the peices of armor, I get these errors on start up. RunUO - [www.runuo.com] Version 1.0.0, Build 36918 Scripts: Compiling C# scripts...failed (4 errors, 0 warnings) - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line 54, column 16) A local variable named 'glv' is already defined in this scope - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line 57, column 17) A local variable named 'glv' is already defined in this scope - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line 60, column 17) A local variable named 'glv' is already defined in this scope - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0128: (line 63, column 15) A local variable named 'glv' is already defined in this scope Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. This is the section of script I believe it is referring to. Code:
AddItem( new Boots( Utility.RandomNeutralHue() ) ); RangerArms glv = new RangerArms(); glv.LootType = LootType.Newbied; AddItem(glv); RangerChest glv = new RangerChest(); glv.LootType = LootType.Newbied; AddItem(glv); RangerGloves glv = new RangerGloves(); glv.LootType = LootType.Newbied; AddItem(glv); RangerGorget glv = new RangerGorget(); glv.LootType = LootType.Newbied; AddItem(glv); RangerLegs glv = new RangerLegs(); glv.LootType = LootType.Newbied; AddItem(glv); |
|
|
|
|
|
#6 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
Code:
RangerArms glv = new RangerArms(); <--------- declared here glv.LootType = LootType.Newbied; AddItem(glv); RangerChest glv = new RangerChest(); <---- and here You want something like this instead Code:
RangerArms glv = new RangerArms(); <------ declare once glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerChest(); <-- then just reassign after that
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
|
|
#7 (permalink) |
|
Forum Novice
|
Code:
RangerArms glv = new RangerArms(); glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerChest(); glv = new RangerGloves(); glv = new RangerGorget(); glv = new RangerLegs(); RunUO - [www.runuo.com] Version 1.0.0, Build 36918 Scripts: Compiling C# scripts...failed (4 errors, 0 warnings) - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line 55, column 10) Cannot implicitly convert type 'Server.Items.RangerChest' to 'Se rver.Items.RangerArms' - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line 56, column 10) Cannot implicitly convert type 'Server.Items.RangerGloves' to 'S erver.Items.RangerArms' - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line 57, column 10) Cannot implicitly convert type 'Server.Items.RangerGorget' to 'S erver.Items.RangerArms' - Error: Scripts\Mobiles\Monsters\Humanoid\Melee\ForestRang er.cs: CS0029: (line 58, column 10) Cannot implicitly convert type 'Server.Items.RangerLegs' to 'Ser ver.Items.RangerArms' Scripts: One or more scripts failed to compile or no script files were found. - Press return to exit, or R to try again. |
|
|
|
|
|
#8 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
your other items are not of the RangerArms type. Since you arent accessing any properties or methods that are specific to the RangerArms type, and your RangerArms and all of the other things you are adding are derived from the Item class, just declare the glv variable as an Item and then it can be used to refer to all of your other items as well.
Code:
Item glv = new RangerArms(); glv.LootType = LootType.Newbied; AddItem(glv);
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
|
|
#10 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
Code:
AddItem( new Boots( Utility.RandomNeutralHue() ) ); Item glv = new RangerArms(); glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerChest(); glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerGloves(); glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerGorget(); glv.LootType = LootType.Newbied; AddItem(glv); glv = new RangerLegs(); glv.LootType = LootType.Newbied; AddItem(glv); Code:
AddItem( new Boots( Utility.RandomNeutralHue() ) ); RangerArms glv = new RangerArms(); glv.LootType = LootType.Newbied; AddItem(glv); RangerChest glchest = new RangerChest(); glchest.LootType = LootType.Newbied; AddItem(glchest); etc.
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
|
|
#13 (permalink) |
|
Master of the Internet
Join Date: Aug 2003
Posts: 5,688
|
yep
__________________
The first line of the first rule in the forum rules and guidelines "Be respectful of others. " For questions, information, and support for XmlSpawner and its addons, visit the XmlSpawner Support Forum |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|