Author Topic: Item for Multiplayer  (Read 362 times)

Legacy_grostilzirelman

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Item for Multiplayer
« on: April 12, 2012, 10:48:29 am »


                I'm running a small multiplayer server over my LAN. The problem I'm having is that I have a particular PC who has a scripted item that summons a set of armor to him. It's cheesy, I know, but the player REALLY wanted it.

  • void main()
  • {
  •     object oBoundArmor;
  •     effect eFX;
  •     object oPC = GetItemActivator();
  •     if ( GetLocalInt(oPC, "BoundArmorOn") == 1 )
  •     {
  •     FloatingTextStringOnCreature("Your Bound Armor is already active.", oPC);
  •     return;
  •     }
  •     else
  •     {
  •         CreateItemOnObject("boundarmor_s", oPC);
  •         ClearAllActions(TRUE);
  •         DelayCommand(0.1f,AssignCommand(oPC, ActionEquipItem(GetItemPossessedBy(OBJECT_SELF, "boundarmor_s"), INVENTORY_SLOT_CHEST)));
  •         SetLocalInt(oPC, "BoundArmorOn", 1);
  • //Get rid of the armor
  •         eFX = EffectVisualEffect(VFX_IMP_EVIL_HELP);
  •         oBoundArmor = GetItemPossessedBy(oPC, "boundarmor_s");
  •         DelayCommand(900.0, ApplyEffectToObject(DURATION_TYPE_INSTANT, eFX, oBoundArmor));
  •         DelayCommand(900.0, DestroyObject(oBoundArmor));
  •         DelayCommand(900.0, SetLocalInt(oPC, "BoundArmorOn", 0));
  •         DelayCommand(900.0, AssignCommand(oPC,ClearAllActions()));
  •         DelayCommand(900.2, AssignCommand(oPC,ActionEquipMostEffectiveArmor()));
  •     }
  • }
This is basically what I have going. Works great. Item is activated... is set on him, and then 900 seconds later is gotten rid of. Problem... every PC in the multiplayer has their armor destroyed along with him. Everyone is pretty pissed off at that PC, and I can't figure out how it happened. It's also a reoccuring problem. 

Anyone have any ideas that might help?
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Item for Multiplayer
« Reply #1 on: April 12, 2012, 01:33:19 pm »


               Assigning the armour to an object at creation would likely help sort things out, as well as reduce the number of gets used.

object oBoundArmor =  CreateItemOnObject("boundarmor_s", oPC);
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Item for Multiplayer
« Reply #2 on: April 12, 2012, 04:52:21 pm »


               A couple things I see:

First, if this is an activated item script are you doing this as a tag based type script? Tag of item matches name of script? How are you implementing tag scripting in your module?

You most likely need a check in your script to make sure it is only firing if a person is activating the item. Not picking it up or dropping it etc.

Second, same thing FB already mentioned above.

But really I don't see anything in this particular script that would make it so that all the players armor would be destroyed at the same time which is why I'm curious about how you are implementing tag/item scripts.

On a side note, what happens if the player logs out durring that 900 seconds and logs back in after? Does he get to keep the armor?
               
               

               
            

Legacy_grostilzirelman

  • Newbie
  • *
  • Posts: 42
  • Karma: +0/-0
Item for Multiplayer
« Reply #3 on: April 13, 2012, 04:02:27 am »


               GhostOfGod - Like I said it's just a private game. I'm not too worried about the exploit possibility because the player is literally sitting right next to me. I just want it to work properly. And thanks for the hint... there was an issue of it binding when the item was dropped. Now that you mentioned that I can fix it.

I'll give assigning it a object, thanks. Let's see what happens tonight '<img'>