PDA

View Full Version : Script Help


Big_Ziggy
1st April 2006, 20:12
Hello DM team and scripters, during my long amounts of just waitng for Neverwinter Nights 2 to come out I decided to just make a small Local Server but I have run into Problems with scripting. And was wondering if anyone could aid me?

1).

I am trying to make a script for players when they enter for the server to give them the following:

Arena Gem - Tag: ArenaScarab
Emotion Disc - Tag: SifligeItemReptileEye

Have the script remove their gold and give them 100 GP

Have it Ban the following Items:

- Removal of Regen from Unofficial items

- Have it lower item propeties if the itemshave them to this +12 AC Bonus MAX, +40 DMGResist MAX

- Removal of STACKED Properties (i.e Regen +3 & Regen +4, Regen +4 is removed)

- Removal of Magical, Divine, Negative and Positive Energy as Damage and Resistance

- Removal of any Slay OnHit Property

- Removal of Immunity Item Properties / Spell Casting Items / Holy Avenger / True Seeing Properties from Unofficial Items

- Removal of any Feats Group: Hide in Plain Sight / Sneak Attack Properties on Items

- Rod of Resurrection, Scroll of Raise Dead/Resurrection/Vampiric Touch, Silvermane's Axe, Saintsblood Pearl, Scabbard of Blessing, The Avatar, Gem of Seeing, Rod of Reversal, Cloak of Greater Sanctuary, Deck of Hazards, Rod of Wonder, Ring of Universal Elemental Immunity, Greater Robe of Eyes, Potion of Heal

I would assume the script when made is placed in the OnClientEnter

2). Is it possible to make a script when a player dies the options of reserection is removed and they lay their until a DM or player with the reserection spell brings them back.

If they have no god in their Deity Section is it possible to make player casted reserection impossible to bring them back?

I would also be interested if you can make blood appear under them with a script when they die using this.

Name: Death Mark
Tag: DeathMark

Anyone able to help me I would be most thankful

palmer_eldritch
1st April 2006, 23:09
First of all, this is the wrong forum and I suspect someone will move it:)

It's been a while since I did any scripting so you'll have to test this stuff out and see if it actually works.

The hardest stuff is the itemproperty stuff. You'll want to use the on client entering event in the module properties as you said. Obviously start with something like

object oPC = GetEnteringObject();


if (!GetIsPC(oPC))
{
return;
}

if(GetIsDM(oPC))
{

return;
}

Then I personally would create a function rather than do this all in the main function, just to make it easier to follow.

The function would be something like this:


void RemoveBadProperties (object oPC)
{

int nIdx;
object oItem;
int nSlot;

for(nIdx=0;nIdx<11;nIdx++)
{
switch(nIdx)
{
case 0:
nSlot =INVENTORY_SLOT_ARMS;
break;
case 1:
nSlot =INVENTORY_SLOT_BELT;
break;
case 2:
nSlot =INVENTORY_SLOT_BOOTS;
break;
case 3:
nSlot =INVENTORY_SLOT_CHEST;
break;
case 4:
nSlot =INVENTORY_SLOT_CLOAK;
break;
case 5:
nSlot =INVENTORY_SLOT_HEAD;
break;
case 6:
nSlot =INVENTORY_SLOT_LEFTHAND;
break;
case 7:
nSlot =INVENTORY_SLOT_LEFTRING;
break;
case 8:
nSlot =INVENTORY_SLOT_NECK;
break;
case 9:
nSlot =INVENTORY_SLOT_RIGHTHAND;
break;
case 10:
nSlot =INVENTORY_SLOT_RIGHTRING;
break;
}

oItem = GetItemInSlot(nSlot, oPC);

{
CheckItem(oItem);
}
}

oItem=GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oItem))
{

{
CheckItem(oItem);
}
oItem=GetNextItemInInventory(oPC);
}

}

Then you have the function CheckItem(oItem), which actually needs to go above RemoveBadProperties in your script, unless you define the functions at the top.

This would be something like:

void CheckItem(object oItem)
{
itemproperty ip = GetFirstItemProperty(oItem);
int ItemPropertyType;
// valid ip?
while (GetIsItemPropertyValid(ip))
{
ItemPropertyType=GetItemPropertyType(ip);
// is banned?
if (GetIsPropertyBanned(ip))
{
RemoveItemProperty(oItem, ip);
}
ip = GetNextItemProperty(oItem);
}
}

And finally you have the function listing your banned properties. Something like:

int GetIsPropertyBanned (ip)
{
if (ip==ITEM_PROPERTY_REGENERATION||ip==ITEM_PROPERTY _TRUE_SEEING||ip==ITEM_PROPERTY_IMMUNITY_MISCELLAN EOUS
etc etc etc - listing all the stuff you don't want)
return TRUE;
else
return FALSE;
}

To have it leave official items alone, you'll have to get the tag of those items and have the script ignore those. To have it remove certain official items, you'll have to get the tag of those and have the script delete those.

To have it lower the item properties in some cases - well this is a pain. You'll have to have the script check for certain item properties such as ITEM_PROPERTY_AC_BONUS and then - if the property does indeed equal that - have it check the item property subtype using int GetItemPropertySubType(itemproperty iProperty). Then you'll need to check if it is a banned subtype, such as IP_CONST_DAMAGERESIST_45, and if so remove the property and replace it with one you like better. This is a lot of scripting and I'm not going to do it right now, but it can be done.

Giving them the items you want is easy - just something like

object oGem=GetItemPossessedBy(oPC,"ArenaScarab");
if (!GetIsObjectValid(oGem))
{
CreateItemOnObject("ArenaScarab",oPC);
}

Stopping them respawning is easy.

In the on player death event put something like:

object oPlayer = GetLastPlayerDied();

PopUpDeathGUIPanel(oPlayer,FALSE,TRUE,0,"You must wait for a player or DM to help you.");

You might also want to put something in like:

SendMessageToAllDMs("Player "+GetName(oPlayer)+" has died in "+GetName(GetArea(oPlayer)));

So that a friendly DM knows they have died.

No ressing without a deity:

You can alter the ressurection and raise dead spell scripts (they are nw_s0_resserec and nw_s0_raisdead) so they read something like:

If (GetDeity(object OBJECT_SELF)=="")
{
FloatingTextStringOnCreature("You cannot ressurect another as you do not worship any deity",OBJECT_SELF,TRUE);
return;
}

Put that near the top, and the "return" will stop the rest of the script firing and no rezzing will take place.

Note that object self is the caster in all spell scripts.

Creating blood under a dead player is easy. Put in the onplayerdeath script something like:

object oBlood=CreateObject(OBJECT_TYPE_PLACEABLE,"DeathMark",GetLocation(oPlayer ),TRUE);

This isn't stuff you can just copy and paste into your scripts I know, but it should give you a rough idea. The item stuff in particular is going to be a pain.

Big_Ziggy
1st April 2006, 23:54
I love you:D lol thanks:)