Samurai Challenge

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

Samurai Challenge

Post by Blue Dragon »

Below is a prototype of a script combat challenge.

I only know the part that teleport up the player into the arena. I can not do he return to the "npc's challenge" if he wins or loses the challenge. I do not know also kill all npcs of the arena if the player dies, or even give him a reward if you win. But it was fun ... if someone wants to take the base or end, is the will. Just until i can go here. :(
function onSpeech( strSaid, myPlayer, myNPC )
{
    if( strSaid == "hi" )
    {
    myNPC.TurnToward( myPlayer );
    myNPC.EmoteMessage( "Hello!" );
    }

    if( strSaid == "hello" )
    {
    myNPC.TurnToward( myPlayer );
    myNPC.EmoteMessage( "hi!" );
    }

    if( strSaid == "challenge" )
    {
    myNPC.TurnToward( myPlayer );
    myNPC.EmoteMessage( "The challenge is to defeat all the enemies before time limit ends." );
    }

    if( strSaid == "time" )
    {
    myNPC.TurnToward( myPlayer );
    myNPC.EmoteMessage( "A yes, the time limit in the arena is 5 minutes." );
    }

    if( strSaid == "samurais challenge" )
    {
    myNPC.TurnToward( myPlayer );
    myNPC.SoundEffect( 0x433, true );
    myNPC.EmoteMessage( "Oh, hohoho. Would you like to participate in the challenge of the samurai?" );
    }
        if( strSaid == "yes" )
        {
        myNPC.TurnToward( myPlayer );
        myPlayer.frozen = 1;
        myNPC.EmoteMessage( "Excellent!" );
        myNPC.SoundEffect( 0x543, true );
        myNPC.StartTimer( 3000, 1, true );
        myNPC.StartTimer( 9000, 2, true );
        myPlayer.StartTimer( 13000, 3, true );
//      myNPC.StartTimer( 325000, 4, true );
        }

        if( strSaid == "no" )
        {
        myNPC.EmoteMessage( "Oh, here we have a coward. Go away and come back only if you dare!" );
        }
}

function onTimer( myPlayer, timerID )
{
    if( timerID == 1 )
    {
    myPlayer.TextMessage( "*"+myPlayer.name+" rings the gong*" );
    }
    if( timerID == 2 )
    {
    myPlayer.EmoteMessage( "Good luck in arena! You will need it!" );
    myPlayer.SoundEffect( 0x431, true );
    }
    if( timerID == 3 )
    {
    myPlayer.Teleport( 1398, 3742, -21, 0 );
    myPlayer.frozen = 0;
    var nSpawned = SpawnNPC( "samurai", 1387, 3731, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1387, 3755, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1411, 3755, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1411, 3731, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1391, 3749, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1394, 3739, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1403, 3747, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1408, 3734, -21, 0 );
    var nSpawned = SpawnNPC( "samurai", 1398, 3744, -21, 0 );
    }
//  if( timerID == 4 )
//      {
//  myPlayer.SysMessage( "You are not able to defeat the samurai in the stipulated time! Better luck next time!" );
//  myPlayer.Teleport( myPlayer.x, myPlayer.y, myPlayer.z, myPlayer.worldnumber );
//      }
}
This is the npc  of challenge
[samurai]
{
NAME=Samurai
ID=766
SKIN=0
DIRECTION=e
BACKPACK
GOLD=900 1100
EQUIPITEM=katana

HPMAX=100
MANAMAX=0
STAMINAMAX=100

STRENGTH=100
DEXTERITY=100
INTELLIGENCE=25

FAME=600
KARMA=600

SWORDSMANSHIP=1000
WRESTLING=2000
TACTICS=1000
ANATOMY=1000
PARRYING=1000
MAGICRESISTANCE=500

DAMAGE=30 55
DEF=50

TOPROV=750
TOPEACE=750
//TOTAME=850
//TAMEDHUNGER=600 30

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

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

FLAG=neutral
//CARVE=0
//FOOD=0
//RACE=0
NPCAI=2
//SCRIPT=0
}

=============================================================================================================
This is the npc that promotes the challenge!
[desafiante]
{
//NAME
NAMELIST=1
ID=689
SKIN=0
DIR=e
BACKPACK

EMOTECOLOUR=51
SAYCOLOUR=201

STRENGTH=100
DEXTERITY=100
INTELLIGENCE=100

WRESTLING=1000

DAMAGE=10 20
DEF=20

FX1=-1
FY1=-1
FX2=1
FY2=1

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

FLAG=innocent
PRIV=4
SCRIPT=3901
}
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 »

what you do is make a finaly bosss npc and once he is killed char teleports back to npc that gave him the challenge.

basicly using ondeath function for that boss.

WOW has it where you fight one guy kill him go back cliam prize, fight a nother go back cliam prize, ect untell last guy.
Blue Dragon
UOX3 Apprentice
Posts: 159
Joined: Mon Jan 09, 2012 1:43 am
Has thanked: 0
Been thanked: 0

Post by Blue Dragon »

His boss is a good idea, but I think that although it is more practical and easy I could not do it the same way, LOL. I'm a noob: (
Post Reply