Chojiros Blog

June 09, 2006

Autoclasschange / tilesteplvlup

These [i]all[/i] work!

'This goes under the SubPlayerMove(Index)
'I added an optional class requirement in there, just remove the 's if you want them.
'Note the character is teleported away upon walking upon the tile and gaining a level.
'TILESTEP LVLUP

Select Case GetPlayerMap(index)
Case [MapNum]:
If GetPlayerX(Index) = [X] And GetPlayerY(Index) = [Y] Then
'If GetPlayerClass(index) = [Class] Then
Call PlayerWarp(Index,[MapNum],[X],[Y])
Call SetPlayerExp(Index, GetPlayerExp(Index) + GetPlayerNextLevel(Index))
Call CheckPlayerLevelUp(Index)
End If
'End If
End Select


'Yep, this is for all you uninventive people who can't make a quest for a class change.
'Note this is only for 3 classes. These are actually very basic and simple to understand.
'This goes under the SubCheckPlayerLevelUp(Index)
'AUTOCLASSADVANCEMENT

Select Case GetPlayerLevel(Index)
Case [Level]:
If GetPlayerClass(index) = [Class] Then
Call Playermsg(index, "Congratulations!! You are now an ____!!", 12)
Call Globalmsg("Congratulations!! " & GetPlayerName(Index) & " is now an ____!!", 10)
Call SetPlayerClass(Index, [NewClass])
End If
End If

Case [Level]:
If GetPlayerClass(index) = [Class] Then
Call Playermsg(index, "Congratulations!! You are now an _____!!", 12)
Call Globalmsg("Congratulations!! " & GetPlayerName(Index) & " is now an ______!!", 10)
Call SetPlayerClass(Index, [NewClass])
End If
End If

Case [Level]:
If GetPlayerClass(index) = [Class] Then
Call Playermsg(index, "Congratulations!! You are now an _____!!", 12)
Call Globalmsg("Congratulations!! " & GetPlayerName(Index) & " is now an _____!!", 10)
Call SetPlayerClass(Index, [NewClass])
End If
End If
End Select

June 06, 2006

Class/LvLWarp + ClassAdvancement.

Be careful not to take out )s and "s in these scripts =)
The PlayerWarps are for warping to another area another area...If you don't want different classes or levels to be warped away, remove all PlayerWarps after the first "ElseIf"
These do work!


'LEVELWARP

Select Case GetPlayerMap(index)
Case [Map]:
If GetPlayerX(Index) = [X] And GetPlayerY(Index) = [Y] Then
If GetPlayerLevel(index) = [LvL] Then
Call PlayerWarp(Index,[Map],[X],[Y])
Call PlayerMsg(index, "You have been warped...",12)
ElseIf GetPlayerClass(index) <> [Class] Then
Call PlayerMsg(index, "You must be level _ or higher to enter this area!", 4)
Call PlayerWarp(Index,[Map],[X],[Y])
End If
End If
End Select


'CLASSWARP.

Select Case GetPlayerMap(index)
Case [Map]:
If GetPlayerX(Index) = [X] And GetPlayerY(Index) = [Y] Then
If GetPlayerClass(index) = [Class] Then
Call PlayerWarp(Index,[Map],[X],[Y])
Call PlayerMsg(index, "You have been warped...",12)
ElseIf GetPlayerClass(index) <> [Class] Then
Call PlayerMsg(index, "Only _____s can enter this area!", 4)
Call PlayerWarp(Index,[Map],[X],[Y])
End If
End If
End Select


'If you want to remove points upon class change, remove the CallSetPlayerPoints line.
'CLASSADVANCEMENT

Select Case GetPlayerMap(index)
Case [Map]:
If GetPlayerX(Index) = [X] And GetPlayerY(Index) = [Y] Then
If GetPlayerClass(index) = [Class] Then
If GetPlayerLevel(Index) = [LvL] Then
Call PlayerWarp(Index,[Map],[X],[Y])
Call PlayerMsg(index, "Congratulations!! You are now an ______!!", 12)
Call PlayerMsg(Index, "You have gained __ stat points!!", 12)
Call GlobalMsg("Congratulations!! " & GetPlayerName & " is now an ______!!", 10)
Call SetPlayerClass(Index, [Class])
Call SetPlayerPoints(Index, GetPlayerPoints(Index) + [PointIncrease])
Call SetPlayerSprite(Index, [Sprite])
ElseIf GetPlayerClass(index) <> [Class] Then
Call PlayerMsg(index, "Only ______ can advance to ______!", 4)
Call PlayerWarp(Index,[Map],[X],[Y])
ElseIf GetPlayerLevel(Index) < [LvL] Then
Call PlayerMsg(Index, "You must be level _ or higher in order to advance!", 4)
Call PlayerWarp(Index,[Map],[X],[Y])
End If
End If
End If
End Select

XR Script - Pickpocketing...

This is a skill which can be used to steal money from other people!! (Literally) You have to be facing the person, and success depends on the players speed, level and a little randomness...I also added the exp script in here...
Note, this script does not currently work, hopefully it will with v1.5



'PICKPOCKETING!!

If LCase(Mid(GetPlayerStringCommand(Index), 1, 11)) = "/pickpocket" Then
If Len(GetPlayerStringCommand(Index)) < name =" Mid(GetPlayerStringCommand(Index)," index2 =" FindPlayer(Name)"> 0 Then
If GetPlayerMap(Index) <> GetPlayerMap(Index2) Then
Call PlayerMsg(Index, "You are not close enough to this player!!", 15)
ExitSub
End If

Select Case
GetPlayerDir(Index)
Case [ClassNum]
If GetPlayerX(Index2) <> GetPlayerX(Index) Then
Exit Sub
End If
If GetPlayerY(Index2) <> GetPlayerY(Index) - 1 Then
Call PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
Case [ClassNum]
If GetPlayerX(Index2) <> GetPlayerX(Index) Then
Call PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
If GetPlayerY(Index2) <> GetPlayerY(Index) + 1 ThenCall PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
Case [ClassNum]
If GetPlayerX(Index2) <> GetPlayerX(Index) - 1
ThenCall PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
If GetPlayerY(Index2) <> GetPlayerY(Index) Then
Call PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
Case [ClassNum]
If GetPlayerX(Index2) <> GetPlayerX(Index) + 1 Then
Call PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
If GetPlayerY(Index2) <> GetPlayerY(Index) Then
Call PlayerMsg(Index, "You have to get a little closer...", 15)
Exit Sub
End If
End Select

'These are success chances based on speed, change these at will, these will be the thiefs skill
T = Int(GetPlayerSpeed(Index) / 5)
T2 = Int(Rnd * GetPlayerLevel(Index)) + T

'And this will be the victims dodge chance
V = Int(GetPlayerSpeed(Index2) / 5)
V2 = Int(Rnd * GetPlayerLevel(Index2)) + VIf V2 > GetPlayerLevel(Index2) * 2 Then
V2 = GetPlayerLevel(Index2) * 2
If T2 > GetPlayerLevel(Index) * 2 Then
T2 = GetPlayerLevel(Index) * 2

'This will measure how much gold to take, change this to fit your game
G = Int(Rnd * 100) * Int(GetPlayerLevel(Index2) / 5)

'Just a few numeric triggers
S = slot, N = numberS = 10N = 10
'This finds the slot with the gold
DoS = S + 1
If GetPlayerInvItemNum(Index2, S) = 1 Then
N = 1
Loop Until N = 1 or S = 101

'If the player doesnt have gold, then you cant steal it!
If S <> 1 Then Call PlayerMsg(Index, "This player does not have any money to steal!!", 15)
Exit Sub
End If

'If the Victim is better than the thief...
If V2 > T2 Then
Call PlayerMsg(Index, "You have failed!! Don't get caught!!", 12)
Call PlayerMsg(Index2, GetPlayerName(Index) & " has just attempted to steal your money!!", 14)
Exit Sub
End If

'If it was a close one?
If T2 = V2 Then
Call PlayerMsg(Index, "Pickpocketing has failed. The player has not noticed!", 14)
Exit Sub
End If

'If the thief Succeeds!
If T2 > V2 Then
If HasItem(Index2, 10) Then
If GetPlayerInvItemValue(Index2, S) < G Then
G = GetPlayerInvItemValue(Index2, S) - 1
Call SetPlayerInvItemValue(Index2, S, GetPlayerInvItemValue(Index2, S) - G)
Call GiveItem(Index, 10, G)
Call TakeItem(Index2, 10, G)
Call PlayerMsg(Index, "Your skills have triumphmed!!", 11)
'------------------
Call SetPlayerEXP(Index, GetPlayerEXP(Index) + [ExpNum])
Call CheckPlayerLevelUp(Index)
'------------------
End If
End If
ElseCall PlayerMsg(Index, "There is nobody here...", 15)
Exit Sub
End If
ElseCall PlayerMsg(Index, "You cannot pickpocket!!", 14)
End If
End If

June 05, 2006

Mining Script!!

Post this under the SubCommand(Index). This is for mining ore, using 4 different picks, which have different chances as you go down, you can copy it and edit the numbers in...
DropChance = Int(Rnd * 20)
If DropChance > 15 Then

This [i]does[/i] work!


'MINING

Dim DropChance
If Mid(GetPlayerStringCommand(Index), 1, 4) = "/dig" Then
If GetPlayerMap(Index) = [Map] Then
Select Case GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))

Case [LowestPickNum]:
DropChance = Int(Rnd * 100)
If DropChance > 70 Then
Call GiveItem(Index, [OreItemNum], 1)
Call PlayerMsg(Index, "You have gained 400 experience!", 6)
Call SetPlayerEXP(Index, GetPlayerEXP(Index) + 400)
Call CheckPlayerLevelUp(Index)
Call PlayerMsg(Index, "Excavation was successful. You gained one ____", 6)
Else
Call PlayerMsg(Index, "Excavation has failed.", 12)
End If
Call SetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index), GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) - 1)
If GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) <= 0 Then
Call PlayerMsg(Index, "Your pickaxe has broken!!", 14)
Call TakeItem(Index, GetPlayerWeaponSlot(Index), 1)
Call SetPlayerWeaponSlot(Index, 0)
End If

Case [LowPickNum]:
DropChance = Int(Rnd * 100)
If DropChance > 58 Then
Call GiveItem(Index, [OreItemNum], 1)
Call PlayerMsg(Index, "You have gained 700 experience!", 6)
Call SetPlayerEXP(Index, GetPlayerEXP(Index) + 700)
Call CheckPlayerLevelUp(Index)
Call PlayerMsg(Index, "Excavation was successful. You gained one ____", 6)
Else
Call PlayerMsg(Index, "Excavation has failed.", 12)
End If
Call SetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index), GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) - 1)
If GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) <= 0 Then
Call PlayerMsg(Index, "Your pickaxe has broken!!", 14)
Call TakeItem(Index, GetPlayerWeaponSlot(Index), 1)
Call SetPlayerWeaponSlot(Index, 0)
End If

Case [HighPickNum]:
DropChance = Int(Rnd * 100)
If DropChance > 46 Then
Call GiveItem(Index, [OreItemNum], 1)
Call PlayerMsg(Index, "You have gained 1200 experience!", 6)
Call SetPlayerEXP(Index, GetPlayerEXP(Index) + 1200)
Call CheckPlayerLevelUp(Index)
Call PlayerMsg(Index, "Excavation was successful. You gained one ____", 6)
Else
Call PlayerMsg(Index, "Excavation has failed.", 12)
End If
Call SetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index), GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) - 1)
If GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) <= 0 Then
Call PlayerMsg(Index, "Your pickaxe has broken!!", 14)
Call TakeItem(Index, GetPlayerWeaponSlot(Index), 1)
Call SetPlayerWeaponSlot(Index, 0)
End If

Case [HighestPickNum]:
DropChance = Int(Rnd * 100)
If DropChance > 34 Then
Call GiveItem(Index, [OreItemNum], 1)
Call PlayerMsg(Index, "You have gained 2000 experience!", 6)
Call SetPlayerEXP(Index, GetPlayerEXP(Index) + 2000)
Call CheckPlayerLevelUp(Index)
Call PlayerMsg(Index, "Excavation was successful. You gained one ____", 6)
Else
Call PlayerMsg(Index, "Excavation has failed.", 12)
End If
Call SetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index), GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) - 1)
If GetPlayerInvItemDur(Index, GetPlayerWeaponSlot(Index)) <= 0 Then
Call PlayerMsg(Index, "Your pickaxe has broken!!", 14)
Call TakeItem(Index, GetPlayerWeaponSlot(Index), 1)
Call SetPlayerWeaponSlot(Index, 0)
End If

End Select
End If
End If