Need a few scripts made

Discussion in 'Scripting' started by jmess33, Apr 17, 2011.

  1. jmess33

    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
     
  2. krum

    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:
     
  3. TheCord

    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.
     
  4. jmess33

    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
     
  5. Mycal

    Mycal Staff Member

    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
     
  6. TheCord

    TheCord New Member

    Oh darn, my bad, I remembered the main = continue but I forgot the main = stop. I was in a rush.
     
  7. jmess33

    jmess33 New Member

    that worked thanks alot!! you guys got any spells for use obj?
     
  8. Mycal

    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.
     
  9. jmess33

    jmess33 New Member

    1er lol
     
  10. TheCord

    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
     
  11. krum

    krum New Member

    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
     
  12. Mycal

    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.
     
  13. jmess33

    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
     
  14. steven

    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.
     
  15. Alpha

    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 ] [​IMG]
     
  16. jmess33

    jmess33 New Member

    anyone got the player house script
     
  17. jmess33

    jmess33 New Member

    nevermind made it myself :)
     
  18. jmess33

    jmess33 New Member

    happen to find those scripts?!
     
  19. Mycal

    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.
     

Share This Page