jayates

Member
I made a lever when double clicked it brings out a moongate. The only problem is it puts the moongate right on top of the lever... so, I can't enter it since its right on top of the lever. Can my script be set to put it right in front of me or somewhere else in the area? Any help is much appreciated! Here's my script:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using System.Collections;
using Server.Multis;
using Server.Mobiles;


namespace Server.Items
{

public class MoongateGearBoxLever : Item
{
[Constructable]
public MoongateGearBoxLever() : this( null )
{
}

[Constructable]
public MoongateGearBoxLever ( string name ) : base (4238)
{
Name = "a lever";
Movable = false;
}

public MoongateGearBoxLever ( Serial serial ) : base ( serial )
{
}

public override void OnDoubleClick( Mobile p )

{
Item a = p.Backpack.FindItemByType( typeof(LeverToken) );
if ( a != null )
{

a.Delete();

p.Say( "Step through the moongate!" );
p.SendMessage( "You open a moongate to the Cargo Hold!" );
p.PlaySound(0x1F7);


CargoHoldGate chg = new CargoHoldGate();
chg.Map = this.Map;
chg.Location = this.Location;
}


else
{
p.SendMessage( "nothing happens" );
}
}

public override void Serialize ( GenericWriter writer)
{
base.Serialize ( writer );

writer.Write ( (int) 0);
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize ( reader );

int version = reader.ReadInt();
}
}
}
 
I would try changing

Code:
chg.Location = this.Location;

to

Code:
chg.Location = p.Location;

to put the gate where the player is standing. You can get fancier by using x,y, and z offsets from either the player or the item but I don't know what format the CargoHoldGate script expects it to be in.
Post automatically merged:

Looks like adding this might do it:

Code:
GateSpot = new Point3D(p.Location.X - 1, p.Location.Y, p.Location.Z);
chg.Location = GateSpot;

That would put the gate one tile in front of (to the left of, or west of) the player's location. Just tweak the value(s) for exact locating of the new gate.
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back