Script for "great fairy"

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
Blue Dragon
UOX3 Apprentice
Posts: 159
Joined: Mon Jan 09, 2012 1:43 am
Has thanked: 0
Been thanked: 0

Script for "great fairy"

Post by Blue Dragon »

Script:
var TecnicaBrilhoID = 0x3754; // Effect of brightness before the npc multiply
var TecnicaSom = 0x0fd;  // Sound effect before the npc multiply
var AjudaSom = 0x55f; // Sound effect of a female voice asking for help

var SpawnMonstro1 = "clonematriarcafadas"; // NPC's "clones" of the great fairy
var SpawnMonstro2 = "fadinha"; // pixies 1 that will help the great fairy when it is almost dying (HP / life <1000)
var SpawnMonstro3 = "fadaborboleta"; // pixies 2 that will help the great fairy when it is almost dying (HP / life <1000)

var VidaMatriarcaFadasQuantidade = 1000; // amount of life which the great fairy starts asking for help (the total life of the NPC is currently in 4000)


function onDefense( pAttacker, pDefender )
{
    var iNum = RandomNumber( 0, 1000 );
    if( iNum >= 700 )
    {
        var dice;
        dice = RollDice( 1,5,0 );

        if ( dice == 1 )
        {
        pDefender.StaticEffect( TecnicaBrilhoID, 0, 100 );
        pDefender.SoundEffect( TecnicaSom, true );
        var nSpawned = SpawnNPC( SpawnMonstro1, pDefender.x-1, pDefender.y, pDefender.z, pDefender.worldnumber );
        nSpawned.owner = pDefender;
        var nSpawned = SpawnNPC( SpawnMonstro1, pDefender.x+1, pDefender.y, pDefender.z, pDefender.worldnumber );
        nSpawned.owner = pDefender;
        var nSpawned = SpawnNPC( SpawnMonstro1, pDefender.x, pDefender.y-1, pDefender.z, pDefender.worldnumber );
        nSpawned.owner = pDefender;
        var nSpawned = SpawnNPC( SpawnMonstro1, pDefender.x, pDefender.y+1, pDefender.z, pDefender.worldnumber );
        nSpawned.owner = pDefender;
        pDefender.EmoteMessage( "*"+pDefender.name+" uses a technique to multiply*" );
        }
            if( pDefender.health < VidaMatriarcaFadasQuantidade )
            {
                if ( dice == 2 )
                {
                pDefender.SoundEffect( AjudaSom, true );
                pDefender.EmoteMessage( "Help, help me. Helllllllllllllllp!" );
                var nSpawned = SpawnNPC( SpawnMonstro2, pDefender.x-8, pDefender.y+8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro3, pDefender.x+8, pDefender.y-8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro2, pDefender.x-8, pDefender.y-8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro3, pDefender.x+8, pDefender.y+8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro2, pDefender.x, pDefender.y-4, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                pAttacker.SysMessage( "Small fairies appear to protect "+pDefender.name+"." );
                }
                if ( dice == 3 )
                {
                pDefender.SoundEffect( AjudaSom, true );
                pDefender.EmoteMessage( "Help, help me. Helllllllllllllllp!" );
                var nSpawned = SpawnNPC( SpawnMonstro3, pDefender.x-8, pDefender.y+8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro2, pDefender.x+8, pDefender.y-8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro3, pDefender.x-8, pDefender.y-8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro2, pDefender.x+8, pDefender.y+8, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;
                var nSpawned = SpawnNPC( SpawnMonstro3, pDefender.x, pDefender.y-4, pDefender.z, pDefender.worldnumber );
                nSpawned.owner = pDefender;            
                pAttacker.SysMessage( "Small fairies appear to protect "+pDefender.name+"." );
                }
            }
    }
}

NPC's:

Great Fairy
[matriarcafadas]
{
NAME=Matriarch of the Fairies
ID=176
SKIN=0
DIRECTION=e
BACKPACK
GOLD=20000 25000
PACKITEM=esmeraldalapidada,1
//LOOT=0

HPMAX=4000
MANAMAX=1000
STAMINAMAX=100

STRENGTH=290
DEXTERITY=350
INTELLIGENCE=500

FAME=24000
KARMA=24000

WRESTLING=1000
TACTICS=1000
ANATOMY=1000
MAGICRESISTANCE=950
MAGERY=1000
EVALUATINGINTEL=3000
INSCRIPTION=2000
MEDITATION=1500

SPATTACK=6
SPADELAY=5

DAMAGE=20 30
DEF=40

TOPROV=1000
TOPEACE=1000
//TOTAME=1100
//TAMEDHUNGER=600 30

FX1=-10
FY1=-10
FX2=10
FY2=10

RUNS
NPCWANDER=3
WALKINGSPEED=2.0
RUNNINGSPEED=0.2
FLEEINGSPEED=0.4

FLAG=innocent
//CARVE=0
//FOOD=0
//RACE=0
NPCAI=0
SCRIPT=3605
}

Clone of Great Fairy
[clonematriarcafadas]
{
NAME=Clone of Matriarch of the Fairies
ID=176
SKIN=0
DIRECTION=e
BACKPACK

HPMAX=50
MANAMAX=1000
STAMINAMAX=100

STRENGTH=290
DEXTERITY=350
INTELLIGENCE=500

FAME=10
KARMA=10

WRESTLING=1000
TACTICS=1000
ANATOMY=1000
MAGICRESISTANCE=950
MAGERY=1000
EVALUATINGINTEL=3000
INSCRIPTION=2000
MEDITATION=1500

SPATTACK=6
SPADELAY=5

DAMAGE=20 30
DEF=40

TOPROV=1000
TOPEACE=1000
//TOTAME=1100
//TAMEDHUNGER=600 30

FX1=-10
FY1=-10
FX2=10
FY2=10

RUNS
NPCWANDER=3
WALKINGSPEED=2.0
RUNNINGSPEED=0.2
FLEEINGSPEED=0.4

FLAG=innocent
//CARVE=0
//FOOD=0
//RACE=0
NPCAI=32
//SCRIPT=0
}
Small fairies / pixies
[fadinha]
{
NAME=Pixies
ID=128
SKIN=0
DIRECTION=e
BACKPACK
GOLD=100

HPMAX=100
MANAMAX=100
STAMINAMAX=100

STRENGTH=50
DEXTERITY=600
INTELLIGENCE=250

FAME=600
KARMA=600

WRESTLING=4500
TACTICS=1000
ANATOMY=1000
MAGICRESISTANCE=400
MAGERY=800
EVALUATINGINTEL=600
INSCRIPTION=1000
MEDITATION=1000

SPATTACK=5
SPADELAY=5

DAMAGE=10 20
DEF=40

TOPROV=500
TOPEACE=500
//TOTAME=1100
//TAMEDHUNGER=600 30

FX1=-10
FY1=-10
FX2=10
FY2=10

RUNS
NPCWANDER=3
WALKINGSPEED=2.0
RUNNINGSPEED=0.1
FLEEINGSPEED=0.3

FLAG=innocent
//CARVE=0
//FOOD=0
//RACE=0
NPCAI=32
//SCRIPT=0
}
butterfly fairy
[fadaborboleta]
{
NAME=Butterfly Fairy
ID=264
SKIN=0
DIRECTION=e
BACKPACK
GOLD=100

HPMAX=100
MANAMAX=100
STAMINAMAX=100

STRENGTH=60
DEXTERITY=500
INTELLIGENCE=250

FAME=700
KARMA=700

WRESTLING=4000
TACTICS=1000
ANATOMY=1000
MAGICRESISTANCE=500
MAGERY=1000
EVALUATINGINTEL=800
INSCRIPTION=1000
MEDITATION=1000

SPATTACK=6
SPADELAY=5

DAMAGE=10 20
DEF=40

TOPROV=600
TOPEACE=600
//TOTAME=1100
//TAMEDHUNGER=600 30

FX1=-10
FY1=-10
FX2=10
FY2=10

RUNS
NPCWANDER=3
WALKINGSPEED=2.0
RUNNINGSPEED=0.1
FLEEINGSPEED=0.3

FLAG=innocent
//CARVE=0
//FOOD=0
//RACE=0
NPCAI=32
//SCRIPT=0
}
This item will be sold to npc jeweller for 10,000 gold coins. Simply just edit the jeweler in "shoplist.dfn".

Item drop on corpse of Great Fairy
[esmeraldalapidada]
{
NAME=Perfect Emerald
ID=0x3194
PILEABLE=1
DECAY=1
RESTOCK=100
VALUE= 10000 10000
}
Note: The fairies can not cast spells of level 7 or 8, because unfortunately they cast area spells like earthquake or chain lighting, and hitting each other and turning confusion.

If someone wants to edit or perhaps better, feel free. It's just a simple script.

A good idea would be that the clones disappear when the Great Fairy died, and that they do not leave bodies on the floor when they die because they are only part of a technique of propagation, but unfortunately can not do these things = /
Last edited by Blue Dragon on Mon Feb 20, 2012 1:55 pm, edited 7 times in total.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Looks great :) For having the clones die with the main npc... save the serials of all the clones on the main NPC as you spawn them, as custom JS tags, then Delete() those clones (calculate npc JS objects using calcCharFromSerial) in the main NPC's onDeath event.
-= Ho Eyo He Hum =-
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

Omg i love this script. great job man :)

ypu tought me something new ":)
Blue Dragon
UOX3 Apprentice
Posts: 159
Joined: Mon Jan 09, 2012 1:43 am
Has thanked: 0
Been thanked: 0

Post by Blue Dragon »

Thank you guys.

Xuri, as I said the first time appeared on the forum, i did not know how it worked a script, hehehe. You tried to help above, but I have no idea how to do these things you said:

Until today I could not do those pauses in certain lines in the script of the dragon, hehehe.


Edit: I made two minor corrections in the script, but it was no big deal.

In "dice == 2" was to appear more "spawnmonstro2" in "dice 3 ==" more "spawnmonstro3." Before I had left both the same, i changed it. Also i modified the x and y where the fairies appear to come help.

Small details that, hehehe
Post Reply