Need a few scripts made

jmess33

New Member
i need a few scripts made...i started my server and need
some scripts..i want a level requirement script for items
and also a class requirement would also be great..and one
more thing would be spells for items the useobj# script and
have it do say 3x3 squares used to have the scripts but lost
them..any of the scripts above would be awesome you can
reply on here or send an email to
 

krum

New Member
man, it's been so long since I have scripted in odyssey!

I can't be of much help, although it's not hard how about you start making some scripts, and I will be glad to guide you to what you want to do :lol:
 

TheCord

New Member
The level and class requirements are quite simple.
In the script USEOBJ#, # being the number of the object you would like to have the requirements just put:
Code:
Function Main(Player AS LONG) As Long
If GetPlayerLevel(Player) > 4 AND GetPlayerClass(Player) = 3 Then
     Main = Continue
Else
     PlayerMessage(Player, "You must be a Knight over level four to use this object.", grey)
End If
End Function

Something like that should work. The message can be changed. The chance the level requirements just change the 4, and to change the class requirements just change the class number. The message for not meeting the requirements can be edited as well.

I'm a little rusty so there are better ways this could be written.
 

jmess33

New Member
script didnt work tried yours and it still lets
any class or any level equip the item?

Function Main(Player AS LONG) As Long
If GetPlayerLevel(Player) > 4 Then
Main = Continue
Else
PlayerMessage(Player, "You must be a Knight over level four to use this object.", grey)
End If
End Function
 

Mycal

Staff member
jmess33 said:
script didnt work tried yours and it still lets any class or any level equip the item?

He forgot one thing. Since most events are functions, you can stop many of their returns by simply doing Main = Stop.

Code:
Function Main(Player AS LONG) As Long
If GetPlayerLevel(Player) > 4 AND GetPlayerClass(Player) = 3 Then
     Main = Continue
Else
     PlayerMessage(Player, "You must be a Knight over level four to use this object.", grey)
     Main = Stop
End If
End Function
 

Mycal

Staff member
I'll have to dig through an old harddrive to find them, but I do have a ton of spells. They would probably need to be edited for item usage since mine were all command based, but that shouldn't be too hard if you understand the last script.

Gimme some time, I am not sure which drive I have those on.
 

TheCord

New Member
I just wrote this real quick so it's kinda sloppy.

Code:
Sub Main(Player AS LONG)
If GetPlayerClass(Player) = 1 Then
   If GetPlayerMana(Player) => 5 Then
   SetPlayerMana(Player, GetPlayerMana(Player)-5)
   SetPlayerHP(Player, GetPlayerHP(Player)+10)
   CreatePlayerEffect(GetPlayerMap(Player), Player, Player, 5, 0, 7, 0)
      If GetPlayerHP(Player) > GetPlayerMaxHP(Player) Then
      SetPlayerHP(Player, GetPlayerMaxHP(Player))
      End If
   Else
   PlayerMessage(Player, "You must have at least 5 mana to cast this spell!", brightred)
   End If
Else
PlayerMessage(Player, "You must be a cleric to cast this spell!", brightred)
End If
End Sub

The only problem is this can be casted continuously until the player runs out of mana. If you'd like I can make a cool down timer real quick.

I probably messed something up as well, I always seem to. lol
 

krum

New Member
TheCord said:
I just wrote this real quick so it's kinda sloppy.

Code:
Sub Main(Player AS LONG)
If GetPlayerClass(Player) = 1 Then
   If GetPlayerMana(Player) => 5 Then
   SetPlayerMana(Player, GetPlayerMana(Player)-5)
   SetPlayerHP(Player, GetPlayerHP(Player)+10)
   CreatePlayerEffect(GetPlayerMap(Player), Player, Player, 5, 0, 7, 0)
      If GetPlayerHP(Player) > GetPlayerMaxHP(Player) Then
      SetPlayerHP(Player, GetPlayerMaxHP(Player))
      End If
   Else
   PlayerMessage(Player, "You must have at least 5 mana to cast this spell!", brightred)
   End If
Else
PlayerMessage(Player, "You must be a cleric to cast this spell!", brightred)
End If
End Sub

The only problem is this can be casted continuously until the player runs out of mana. If you'd like I can make a cool down timer real quick.

I probably messed something up as well, I always seem to. lol

the only error I see is "=>" should be ">=", can't remember if that matters in ody syntax, but I am pretty sure it does. (ADHD Thought) Someone should create a syntax highlighter for Notepad++ to edit these scripts in, intellisense on functions would be nice too, just a little XML to make life easier :p
 

Mycal

Staff member
Ody script is roughly equivalent to VB. So just choosing VB in Notepad++ is good enough. Besides, in future versions, it will be changed to Lua, so there is no real point in putting in the effort now.
 

jmess33

New Member
thanks that worked how about another one i want a spell for a mage
and be able to do like 3-4 squares infront of him and also have another
one do a 3x3 area and also have it loop so the effect stays longer can you
do that off the top of your head?! :cool: :D thanks by the way! and maybe
throw a cool down script for the spells on the side not in the actual script
though
 

steven

Administrator
When you edit a post it shows to members as a new topic, so no need to double up on posts. Just a useful tid bit.
 

Alpha

New Member
Code:
Function Main(Player as Long) As Long
Dim Map as Long, X as Long, Y as Long, Mana as Long, HP as Long, MaxHP as Long, Sprite as Long, Status as Long

Map = GetPlayerMap(Player)
X = GetPlayerX(Player)
Y = GetPlayerY(Player)
Mana = GetPlayerMana(Player)
HP = GetPlayerHP(Player)
MaxHP = GetPlayerMaxHP(Player)
Sprite = GetPlayerSprite(Player)
Status = GetPlayerStatus(Player)

If GetPlayerFlag(Player, 5) = 0 Then
If GetPlayerClass(Player) = #1 Then
    If Mana >= 10 Then
         If HP = MaxHP Then
             SetPlayerFlag(Player, 5, 1)
             SetPlayerFlag(Player, 10, Sprite)
             SetPlayerFlag(Player, 11, Status)
             SetPlayerSprite(Player, 255)
             SetPlayerStatus(Player, 9)
             SetPlayerMana(Player, Mana - 10)
             Timer(Player, 5, "VANISH_TIMER")
             Timer(Player, 25, "VANISH_COOL")
     Else
             PlayerMessage(Player, "You need full HP to Vanish!", Yellow)
     End If
  Else
     PlayerMessage(Player, "You do not have enough mana to cast this spell.", Grey)
  End If
Else
   Playermessage(Player, "You must be a thief to cast this spell.", Yellow)
End If
Else
   PlayerMessage(Player, "Vanish is still cooling down...", Grey)
End If
End Function

In /god editscript VANISH_TIMER :
Code:
Function Main(Player as Long) As Long
SetPlayerSprite(Player, GetPlayerFlag(Player, 10))
SetPlayerStatus(Player, GetPlayerFlag(Player, 11))
End Function

In /god editscript VANISH_COOL :
Code:
Function Main(Player as Long) As Long
SetPlayerFlag(Player, 5, 0)
End Function

Alright, that basically wraps this up. Change #1 in the first part of the script to the class number of the thief(or rogue). This should work. Its supposed to make your character invisible for 5 seconds, and after 5 seconds, it sets your sprite and status back to what they were(25 second cooldown timer). There may be a few very minor mistakes, and i didnt even bother guessing the character effect parameters as I wrote this entire code and this post from my mobile device lol. You can add it in if you want. Anyways, enjoy.

- Alpha

[ Post made via iPod ]
iPod.png
 

jmess33

New Member
Mycal said:
I'll have to dig through an old harddrive to find them, but I do have a ton of spells. They would probably need to be edited for item usage since mine were all command based, but that shouldn't be too hard if you understand the last script.

Gimme some time, I am not sure which drive I have those on.

happen to find those scripts?!
 

Mycal

Staff member
Sorry no I haven't, I may have lost them, the HDD I thought they were on is dead, so unless I have a backup somewhere else, they are gone.
 
Top