With a little time here, and a little more knowledgeable of this method of script, here I was trying to customize and make more attractive the script Ettin throw stones...
Well, I made this script bellow, still not quite ready, but due to my lack of knowledge, tests is stopped because "myPlayer is not defined / line 54 is null...". I tried several ways are my little knowledge to make it work, but I could not this.
If you're not too busy and can help, follows the order:
1-In function OnTimer says myPlayer is not defined. How fix this error in the current script (write what?), and how to fix it when appear some these phrases?
2-I do not still understand very good the utility of terms "return true" and "return false"; After all, what are its uses and when should I put them?
That is, if you're not too busy and can resolve these questions for me, I thank.
var EfeitoMovimentoRochaID2 = 0x1362;
var AcertoRochaSom = 0x145;
var GritoHomemSom = 0x540;
var GritoMulherSom = 0x14e;
function onCombatStart( myNPC, myPlayer )
{
var iNum = RandomNumber( 0, 10 );
if( iNum > 7 )
{
var dice;
dice = RollDice( 1,3,0 );
if( dice == 1 )
{
myNPC.TurnToward( myPlayer );
myNPC.frozen = 0;
myNPC.StartTimer( 500, 0, true );
}
if (dice == 2)
{
myNPC.TurnToward( myPlayer );
myNPC.frozen = 0;
myNPC.StartTimer( 500, 1, true );
}
}
}
function onTimer( myNPC, timerID )
{
if( timerID == 0 )
{
myNPC.DoAction ( 11 );
myNPC.EmoteMessage( "*"+myNPC.name+" pega uma rocha no chao*" );
myNPC.StartTimer( 2000, 2, true );
}
if( timerID == 1 )
{
myNPC.DoAction ( 11 );
myNPC.EmoteMessage( "*"+myNPC.name+" pega uma gigantesca rocha no chao*" );
myNPC.StartTimer( 2000, 3, true );
}
if( timerID == 2 )
{
DoMovingEffect( myNPC, myPlayer, EfeitoMovimentoRochaID1, 0x10, 0x00, false );
myNPC.frozen = 0;
myPlayer.SoundEffect( AcertoRochaSom, true );
if( myPlayer.gender == 0 )
{
myPlayer.SoundEffect( GritoHomemSom, true );
}
else if( myPlayer.gender == 0 )
{
myPlayer.SoundEffect( GritoMulherSom, true );
}
if( myPlayer.isonhorse )
{
var iNum = RandomNumber( 0, 10 );
if( iNum > 5 )
{
myPlayer.Dismount();
myPlayer.EmoteMessage( "*Voce foi atingido em cheio por uma rocha!!*", false );
myPlayer.health = ( myPlayer.health -15 );
myPlayer.stamina = ( pDefender.myPlayer -1 );
}
else
{
myPlayer.EmoteMessage( "*Voce foi atingido de raspao por uma rocha!*", false );
myPlayer.health = ( myPlayer.health -10 );
myPlayer.stamina = ( myPlayer.stamina -1 );
}
}
else
{
if( iNum > 5 )
{
myPlayer.EmoteMessage( "*Voce foi atingido em cheio por uma rocha!!*", false );
myPlayer.health = ( myPlayer.health -15 );
myPlayer.stamina = ( pDefender.myPlayer -1 );
}
else
{
myPlayer.EmoteMessage( "*Voce foi atingido de raspao por uma rocha!*", false );
myPlayer.health = ( myPlayer.health -10 );
myPlayer.stamina = ( myPlayer.stamina -1 );
}
}
}
if( timerID == 3 )
{
DoMovingEffect( myNPC, myPlayer, EfeitoMovimentoRochaID2, 0x10, 0x00, false );
myNPC.frozen = 0;
myPlayer.SoundEffect( AcertoRochaSom, true );
if( myPlayer.gender == 0 )
{
myPlayer.SoundEffect( GritoHomemSom, true );
}
else if( myPlayer.gender == 0 )
{
myPlayer.SoundEffect( GritoMulherSom, true );
}
if( myPlayer.isonhorse )
{
var iNum = RandomNumber( 0, 10 );
if( iNum > 5 )
{
myPlayer.Dismount();
myPlayer.EmoteMessage( "*Voce foi atingido em cheio por uma gigantesca rocha!!*", false );
myPlayer.health = ( myPlayer.health -20 );
myPlayer.stamina = ( pDefender.myPlayer -1 );
}
else
{
myPlayer.EmoteMessage( "*Voce foi atingido de raspao por uma gigantesca rocha!*", false );
myPlayer.health = ( myPlayer.health -15 );
myPlayer.stamina = ( myPlayer.stamina -1 );
}
}
else
{
if( iNum > 5 )
{
myPlayer.EmoteMessage( "*Voce foi atingido em cheio por uma gigantesca rocha!!*", false );
myPlayer.health = ( myPlayer.health -20 );
myPlayer.stamina = ( pDefender.myPlayer -1 );
}
else
{
myPlayer.EmoteMessage( "*Voce foi atingido de raspao por uma gigantesca rocha!!*", false );
myPlayer.health = ( myPlayer.health -15 );
myPlayer.stamina = ( myPlayer.stamina -1 );
}
}
}
}