Aller au contenu

Photo

Jail wand script help


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
This is a script for a DM wand .It teleports oPC to a waypoint in the jail.

Problem:

1. The message is not sending ..it supposed to send to all players ..


2. Not in the script yet ..but I would also like it to place prison outfit on the character also so it is not removable so if they login after reset it will put them back in jail..I know I will need an oclient enter script to check for this clothing also. 

All help is appreciated

void MessageAll(string sMessage)
{
    object oPlayer = GetFirstPC();
    while(GetIsObjectValid(oPlayer))
        {
        SendMessageToPC(oPlayer,sMessage);
        oPlayer = GetNextPC();
        }
}
#include "x2_inc_switches"
void main()
{
int nEvent = GetUserDefinedItemEventNumber();
if(nEvent != X2_ITEM_EVENT_ACTIVATE) return;
object oUser = GetItemActivator();
if (!GetIsDM(oUser)) return;
object oPlayer = GetItemActivatedTarget();
object oWaypoint = GetWaypointByTag("jail1");
if (GetIsPC(oPlayer))
DelayCommand(5.0, AssignCommand(oPlayer, JumpToObject(oWaypoint)));
return;
object oPC  = GetItemActivatedTarget();
string oPCname = GetName(oPC);
MessageAll( "<cÖ2¦>Jail:</c>" + GetName(oPC) + "<cÖ2¦>has been sent to jail for crimes against the land !</c>   ");

}
Image IPB

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
You have a "return;" just after the line "DelayCommand(5.0, AssignCommand(oPlayer, JumpToObject(oWaypoint)));" so it ends there. Remove that and players should get the message.

Modifié par GhostOfGod, 04 octobre 2010 - 01:57 .


#3
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
And to equip a jail outfit you might try something like this:

void MessageAll(string sMessage)
{
    object oPlayer = GetFirstPC();
    while(GetIsObjectValid(oPlayer))
    {
        SendMessageToPC(oPlayer,sMessage);
        oPlayer = GetNextPC();
    }
}
#include "x2_inc_switches"
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();
    if(nEvent != X2_ITEM_EVENT_ACTIVATE) return;
    object oUser = GetItemActivator();
    if (!GetIsDM(oUser)) return;
    object oPlayer = GetItemActivatedTarget();
    object oWaypoint = GetWaypointByTag("jail1");
    if (GetIsPC(oPlayer))
    {
        object oOutfit = CreateItemOnObject("res ref of clothes", oPlayer);
        SetItemCursedFlag(oOutfit, TRUE);
        AssignCommand(oPlayer, ActionEquipItem(oOutfit, INVENTORY_SLOT_CHEST));
        DelayCommand(5.0, AssignCommand(oPlayer, JumpToObject(oWaypoint)));
        MessageAll( "Jail: " + GetName(oPlayer) +
        " has been sent to jail for crimes against the land!");
    }
}


I added lines to create an item on the targeted player and for them to equip the item and set the cursed flag of the item to true. Setting the cursed flag only makes the item undroppable. They can still unequip the item. If you want them to NOT be able to unequip the item then you will need to make a tag based script for the clothes that if it is UnEquipped, it will just automatically reequip the clothing. Something like so:

#include "x2_inc_switches"
void main()
{
    int nEvent = GetUserDefinedItemEventNumber();
    if (nEvent != X2_ITEM_EVENT_UNEQUIP)return;
    object oItem = GetPCItemLastUnequipped();
    object oPC = GetPCItemLastUnequippedBy();
    AssignCommand(oPC, ActionEquipItem(oItem, INVENTORY_SLOT_CHEST));
}


EDIT: The color code got lost in the post. Just letting you know in case you copy/paste it. Also edited the first script to get rid of a bit of redundancy.

Modifié par GhostOfGod, 04 octobre 2010 - 03:51 .


#4
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
This is great I will get to work on putting this in and tinkering with it.

#5
ffbj

ffbj
  • Members
  • 593 messages
My character recently landed in Jail and I realised I needed a bail-out system, so I made one.
Essentially any other character can walk up to the jailer and bail someone out for 100 gold per level of the incarcerated PC. At the same time the jail int on the PC's database item is removed so they won't get put in jail again on the next reset.  The reason I made this is that a DM may not be on at the time to get someone out of jail.

Modifié par ffbj, 04 octobre 2010 - 11:31 .