Aller au contenu

Photo

just learning to script, but I need a script that does this for my mod


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

#1
harjoblog

harjoblog
  • Members
  • 19 messages
 I am at the very beginning of learning to script. So I do not know much about it. The script I need will do this once a PC enters a trigger

if pc has armor1 or armor2 or armor3 or armor4 or armor5 equipped do nothing
otherwise 1 point of damage is dealt to PC

so if the pc isn't wearing one of the 5 armors listed, they are damaged 1 point everytime they enter the trigger

I have this working with only one item, but I do not know how to make the script check for one of the five armors equiped.
This is my script for one item working from the script generator, but again, I don't know enough about scripting to be able to have the generator have or conditions nor do I know about scripting to write it out by hand.
any help is appreciated.

[       
/*  *  Script generated by LS Script Generator, v.TK.0 * *  For download info, please visit: *  http://nwvault.ign.c...il&id=1502 */// Put this script OnEnter.

void main(){    effect eVFX;    effect eDamage;
    // Get the creature who triggered this event.    object oPC = GetEnteringObject();
    // Only fire for (real) PCs.    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )        return;
    // If the PC does not have the item "coldprotectarmorlight" equipped.    if ( "coldprotectarmorlight" != GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC)) )    {        // Cause damage.        eDamage = EffectDamage(1, DAMAGE_TYPE_COLD);        eVFX = EffectVisualEffect(VFX_COM_HIT_FROST);        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC)        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC)    }} ]

Modifié par harjoblog, 10 juillet 2012 - 09:47 .


#2
harjoblog

harjoblog
  • Members
  • 19 messages

Modifié par harjoblog, 10 juillet 2012 - 09:46 .


#3
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Could do something like so:


void main()
{
    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();
    effect eVFX;
    effect eDamage;
    string sTag = GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC));
    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) ) return;
    // If the PC does not have the item "coldprotectarmorlight" equipped.
    if ( sTag != "coldprotectarmorlight" ||
         sTag != "" ||
         sTag != "" ||
         sTag != "" ||
         sTag != "")
    {
        // Cause damage.
        eDamage = EffectDamage(1, DAMAGE_TYPE_COLD);
        eVFX = EffectVisualEffect(VFX_COM_HIT_FROST);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
        ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX   , oPC);
    }
}

Just fill in your other tags.
Hope that helps.

Modifié par GhostOfGod, 10 juillet 2012 - 09:48 .


#4
harjoblog

harjoblog
  • Members
  • 19 messages
I tried it and it does damage but it ignores the tags of the armor if they're worn

#5
Failed.Bard

Failed.Bard
  • Members
  • 774 messages

GhostOfGod wrote...


    if ( sTag != "coldprotectarmorlight" ||
         sTag != "" ||
         sTag != "" ||
         sTag != "" ||
         sTag != "")
 


  Those should be ands, not ors:

     if ( sTag != "coldprotectarmorlight" &&
         sTag != "" &&
         sTag != "" &&
         sTag != "" &&
         sTag != "")

Modifié par Failed.Bard, 10 juillet 2012 - 10:58 .


#6
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Oh jeez sorry bout that. Thanks FB. Done "||" so much with "==" I wasn't paying attention to the backwards thinking. :whistle:

#7
harjoblog

harjoblog
  • Members
  • 19 messages
Thanks guys, It's still not working so I'm not sure what I'm doing wrong. I've triple checked all the tags to make sure they're right. I'm putting this script on enter of the generic trigger.

[void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
effect eVFX;
effect eDamage;
string sTag = GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC));
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) ) return;
// If the PC does not have the item "coldprotectarmorlight" equipped.
if ( sTag != "coldprotectarmorlight"&&
sTag != "coldprotectionarmorcloth01"&&
sTag != "coldprotectionarmorcloth02"&&
sTag != "coldprotectionarmormedium"&&
sTag != "coldprotectionarmorheavy")
{
// Cause damage.
eDamage = EffectDamage(1, DAMAGE_TYPE_COLD);
eVFX = EffectVisualEffect(VFX_COM_HIT_FROST);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oPC);
}
}]

but I still can't get it to not fire the damage when wearing one of the listed armors.

#8
ShadowM

ShadowM
  • Members
  • 768 messages
void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
effect eVFX = EffectVisualEffect(VFX_COM_HIT_FROST);
effect eDamage = EffectDamage(1, DAMAGE_TYPE_COLD,DAMAGE_POWER_NORMAL);
string sTag = GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oPC));
// Only fire for (real) PCs.
if (!GetIsPC(oPC) || GetIsDMPossessed(oPC) ) return;
// If the PC does not have the item "coldprotectarmorlight" equipped.
if ( sTag == "coldprotectarmorlight"||
sTag == "coldprotectionarmorcloth01"||
sTag == "coldprotectionarmorcloth02"||
sTag == "coldprotectionarmormedium"||
sTag == "coldprotectionarmorheavy")return;

// Cause damage.
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX , oPC);
}

#9
harjoblog

harjoblog
  • Members
  • 19 messages
I still couldn't get it to not damage when pc enter the trigger, so I had to make one item that canceled the trigger damage instead of multiple ones. Thanks for all you guys help.

#10
ShadowM

ShadowM
  • Members
  • 768 messages
That means your tags are wrong , I tested it in game and worked fine. And this is only for chest piece not other equped items

#11
harjoblog

harjoblog
  • Members
  • 19 messages
It is working, I remade the items with the proper tags, (my eyes must have been wearing when I kept testing it out, since one tag was right, but the character I was using couldn't wear that armor) I thank you guys for your help and I'm glad to see people are still doing this kind of help for such an old game.
Thanks again.