Jump to content
  • 0

Shield Slot determines projectile?


Smallio_Pro

Question

Hey there, first post and I hate it being a question. I've been doing pretty well with figuring out everything by my self so far.

I was wondering how I can take the projectile property off the weapon slot and move it to the shield slot? 

1bf83e2deb1536592b3cba8f179884ec.png

And then I would obviously need to re-create the projectile drop box in the item editor and move it in the shield properties. I have been working on this for hours and have been so lost in the code I am not sure where to start.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • -2

Changing the projectile to be based off of the shield slot instead of the weapon slot can be accomplished by, as of v0.7.2-beta.7 changing the AttackPacket handler

public void HandlePacket(Client client, AttackPacket packet)
{
    ...
(L1186)     if (player.TryGetEquippedItem(Options.WeaponIndex, out var equippedWeapon))
    ...

to reference the shield slot index

public void HandlePacket(Client client, AttackPacket packet)
{
    ...
(L1186)     if (player.TryGetEquippedItem(Options.ShieldIndex, out var equippedWeapon))
    ...

 

Edited by panda
Cleaned up post and provided specific method and line number details for future-proofing
Link to comment
Share on other sites

  • -1

I have added my own working combo box to the Shield properties that changes "mEditorItem.Projectile" so pressing save should send a value but nothing happens ingame.a727b9d8dc8e056acfb8fe73323d19e8.png

        public FrmItem()
        {
            ApplyHooks();
            InitializeComponent();
            Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location);

            cmbEquipmentSlot.Items.Clear();
            cmbEquipmentSlot.Items.AddRange(Options.EquipmentSlots.ToArray());
            cmbToolType.Items.Clear();
            cmbToolType.Items.Add(Strings.General.None);
            cmbToolType.Items.AddRange(Options.ToolTypes.ToArray());

            cmbProjectile.Items.Clear();
            cmbProjectile.Items.Add(Strings.General.None);
            cmbProjectile.Items.AddRange(ProjectileBase.Names);

            cmbProjectileShield.Items.Clear();
            cmbProjectileShield.Items.Add(Strings.General.None);
            cmbProjectileShield.Items.AddRange(ProjectileBase.Names);

            lstGameObjects.Init(UpdateToolStripItems, AssignEditorItem, toolStripItemNew_Click, toolStripItemCopy_Click, toolStripItemUndo_Click, toolStripItemPaste_Click, toolStripItemDelete_Click);
        }

        cmbProjectileShield.SelectedIndex = ProjectileBase.ListIndex(mEditorItem.ProjectileId) + 1;

        private void cmbProjectileShield_SelectedIndexChanged(object sender, EventArgs e)
        {
            mEditorItem.Projectile = ProjectileBase.Get(ProjectileBase.IdFromList(cmbProjectile.SelectedIndex - 1));
        }

I'm hoping it's just the case of changing the Shield slot properties now (maybe in ItemBase). If anyone could point me in the right direction you don't know how happy I will be 

Link to comment
Share on other sites

  • -1

Right looks like I've been looking at the wrong parts of the code all this time. I still need some help. It looks like the Combo Box I made is actually assigning the projectile. I thought it wasn't storing it at all but it may be a "OnCombat" sort of code stopping it

 

d8b647d84122eb0b71483d2e36b59eaf.png

 

Honestly if someone can help me then please do. I have spent a silly amount of hours on this small feature that is crucial for my game to work

Link to comment
Share on other sites

  • -1

3 Days working on this, still can't find where in the code it decides the weapon slot determines the projectile

 

467b624dc9d3a18e52344f1ebcf7155a.png

The amount of times I have read these cs files line by line has driven me insane. There has to be 1 person on this website that can point me to the if statement I have to change surely...

Link to comment
Share on other sites

×
×
  • Create New...