Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DarkMazer

Members
  • Posts

    107
  • Joined

  • Last visited

    Never

Everything posted by DarkMazer

  1. Actually, this list is more complete, but there's fewer explanations than the other one, so you might want to keep both handy. http://www.touchofdeathforums.com/smf/index.php/topic,28153.0.html Also, if you haven't already, check out the tutorials. There's a lot to learn from them.
  2. Perhaps it's an issue with the menu itself and not with Sub MenuScripts. That might be what you're overlooking.
  3. @Bone: > I think that 'end select' needs to be there > Seeing its after the cases, so it stops selecting cases > but then theres a 'case else' > > I could be wrong > > A tip : Back up your Main.txt after every script There does need to be an End Select, but only one; otherwise the script complains. The one already there after Case Else is the one that should be kept. And yes, that's a very good tip.
  4. First, find this: > If Trim(MOTD) "" Then > Call PlayerMsg(index, "MOTD: " & MOTD, 11) > Call HighScore(Index) > End If > If GetPlayerAccess(index) = 4 Then > Call GlobalMsg(GetPlayerName(index) & " (Administrator) has joined " & GameName & "!", 12) > End If > If GetPlayerAccess(index) = 3 Then > Call GlobalMsg(GetPlayerName(index) & " (Developer) has joined " & GameName & "!", 12) > End If > If GetPlayerAccess(index) = 2 Then > Call GlobalMsg(GetPlayerName(index) & " (Mapper) has joined " & GameName & "!", 12) > End If > If GetPlayerAccess(index) = 1 Then > Call GlobalMsg(GetPlayerName(index) & " (Moderator) has joined " & GameName & "!", 12) > End If > If GetPlayerAccess(index) = 0 Then > Call GlobalMsg(GetPlayerName(index) & " has joined " & GameName & "!", 12) > End If > End Sub > End Sub Take out the two "End Sub" statements there, then cut the text out and go to Sub JoinGame(index). Once you find that, replace this segment: > If LenB(MOTD) 0 Then > Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN) > End If With the code you cut out. Next, find this: > *******Level Up Spell********* And put a ' in front of it. While you're there, find this: > If GetPlayerMP(index) >= mpneeded Then 'Check if the player has the required amount of MP > Call SetPlayerLevel(index, GetPlayerLevel(Index) +1) 'Increase the player's level by one > Call SetPlayerMP( Index, GetPlayerMP( Index) - mpneeded) 'Substract the MP thats needed > Call SendStats( Index) 'Updates the player's stats > call playerMsg(Index, "You granted a level!", WHITE) > > End If > End Select > End Sub And take out the End Select and End Sub statements. Next, find this: > case 0 > Call SetPlayerLevel( Index, GetPlayerLevel( Index) +1) > Sub TakeItem(Index, 5, 1) > Call SendInventory( Index) And change the "Sub" to "Call". Try that and see if it works. With all of those syntax errors, it's no wonder you weren't dying properly.
  5. See this? > ************************** > '*AutoUpdatingHighScoreScript* > '*******Version1.2********** > '************************* Try putting a ' in front of the top line of asterisks.
  6. I see LCase and Trim have already been covered, so I'll finish up with Mid. Mid returns a substring of, or part of the string, you put into it (presumably the middle [hence the name], but it's whatever you tell it to), and works like this: Mid(text, start, length) Text is the text you want to parse (basically, modify), start is the character that you want to start returning the substring from, and length is the length of the substring it returns. Examples: Mid("I want an apple", 11, 5) will return "apple". Mid("Example", 3, 2) will return "am". Mid(TextSay, 7, Len(TextSay) - 6) will return everything from the 9th character of TextSay to the end. If TextSay was "/jail randomnoob", it'll return "randomnoob". Anyways, if it interests you, the reason you couldn't find the answer to these questions in other places on the forum is because these are functions that exist in VBScript and not just in SadScript.
  7. If you edit the source properly, you can do anything you want, as long as you know how to do it.
  8. I think I know how you could make the timer work. Put this in a separate sub, something like Sub Attacks: ``` Sub Attacks(Index, Target, Range) Dim npcnum npcnum = GetPlayerTargetNPC(Index) If Int(Range) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, Range) Else Target = GetPlayerTargetNPC(Index) Call DamageNPC(Index, Target, Range) End If End If If GetTimer("Attacks " & Index & ", " & Target & ", " & Range) >= 0 Then Call RemoveTimer("Attacks " & Index & ", " & Target & ", " & Range) End If If GetPlayerDir(index) = 2 Then Call SpellAnim(4, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End If If GetPlayerDir(index) = 3 Then Call SpellAnim(4, GetPlayerMap(index), GetNpcX(GetPlayerMap(index), npcnum), GetPlayerY(index)) End If End Sub ``` Under the case you're running this in, put this: ``` Case 2 Dim Target Dim Range Range = GetPlayerDamage(Index) * 1.5 Call SetPlayerMP(Index, GetPlayerMP(Index) - 10) Call Attacks(Index, Target, Range) Call SetTimer("Attacks " & Index & ", " & Target & ", " & Range, 100) ``` The way this works is, when you run the case you make your first attack and set a timer for the second one, and when the timer expires, the second attack is made and the timer is removed. The fun thing is that the timer is removed only if it is running, so you shouldn't have any bugs with that. Of course, you may want to randomize damage inside Sub Attacks so both attacks can deal different amounts of damage, but I think you can figure that out.
  9. As far as I know, you can't lock NPCs.
  10. Whoa, back on topic. @Savant: > Thanks so much for the tips! So I guess the only way to do it is to iterate through all the possible players and NPCs, correct?… > > Also, for NPCs, should I just go up to 15? Are those indexes not going to correspond either? > > EDIT: Okay, so for players, it looks like I can iterate from 0 to Get_Max_Players() and use IsPlaying() first before I try checking for a player's map and coordinates. Still trying to work through cycling through NPCs... > > Thanks again. I just need to talk this through with people. Yes, iterating through all players is the only way to do it. The main use of GetPlayersOnMap in this case is that, if all of the players on the map are found before you're done iterating through the loop, you can abort early and save yourself some processing time. However, it's not necessary, especially if the server's being run on a fast computer. If there's a large cap on the number of maximum players, and the server computer isn't overly fast, it may be worth considering, though. How you would do that is add another variable and have that variable count how many players you have located on the map so far, and check to see if that number equals the number of players on the map. It might be easier to use a Do While loop in that case, so you can check that at the same time you check if your index is less than the maximum number of players. For the NPCs, I believe all you have to do is run through NPC numbers 1 through 15 and check if they exist (you can use GetMapNpcNum(map#, NPCindex) for that), then do what's necessary with them. I think it would be prudent to use GetMapNpcHP(map#, NPCindex) to make sure the NPC's not dead first, as well. As for the correspondence issue, NPC indexes are unique to each map, so NPC#1 on map 13 is different from NPC#1 on map 56. In other words, don't worry.
  11. There is a For loop in SadScript; the syntax is: ``` For variable = num1 To num2 'body Next ```Some things to note, though, are that it only increments by 1 (that shouldn't be a problem in this case, though), and that the words I capitalized there are keywords. GetMaxPlayers() returns how many players can log in to the game, GetPlayersOnMap(Map#) returns how many players are on a map, and the maximum number of NPCs on a map is 15 (at least in EE 2.7). You may also want to know that GetPlayerX(index) and GetPlayerY(index) return the X and Y coordinates of a player, respectively, and that GetNpcX(map#, npcindex) and GetNpcY(map#, npcindex) return an NPC's X and Y coordinates. Those will help if you want to limit range. Also, knowing how to find certain commands on the command list really helps.
  12. ``` Case 2 If GetPlayerDir(index) = 0 Then if GetPlayerY(index) + 2 > 14 Then Call Playermsg(index, "You can't jump to there.", 4) Else Call SetPlayerY(index, GetPlayerY(index) + 2) End if End if If GetPlayerDir(index) = 1 Then if GetPlayerY(index) - 2 < 0 Then Call Playermsg(index, "You can't jump to there.", 4) Else Call SetPlayerY(index, GetPlayerY(index) - 2) End if End if If GetPlayerDir(index) = 2 Then if GetPlayerX(index) - 2 < 0 Then Call Playermsg(index, "You can't jump to there.", 4) Else Call SetPlayerX(index, GetPlayerX(index) - 2) End if End if If GetPlayerDir(index) = 3 Then if GetPlayerX(index) + 2 > 19 Then Call Playermsg(index, "You can't jump to there.", 4) Else Call SetPlayerX(index, GetPlayerX(index) + 2) End if End if ```If you replace Case 2 with this code, it should work. There were a few problems with your script: you were using ElseIf and Else wrong (syntax should be If statement Then … ElseIf statement Then ... Else ... End If, where statement is what you're checking for), and you got the directions wrong. For your reference, 0 is up, 1 is down, 2 is left, and 3 is right. (It took me forever to figure that out, though) Hope that helps.
  13. I guess that confirms my suspicion that HP is reset to max after OnDeath is called. What that means, then, is that you can't get people to revive with 1 HP unless you edit the source code.
  14. ``` Sub OnDeath(index) Dim mapnum Dim x Dim y Dim i i = GetPlayerClass(index) mapnum = GetVar("Classes\Class" & i & ".ini", "CLASS", "Map") y = GetVar("Classes\Class" & i & ".ini", "CLASS", "y") x = GetVar("Classes\Class" & i & ".ini", "CLASS", "x") Call SetPlayerHP(index, 1) Call SendHP(index) End Sub '
  15. Try this: ``` Sub OnDeath(index) 'stuff that's already there '... '... Call SetPlayerHP(index) Call SendHP(index) End Sub ``` I'm not sure if that works in TE, but it can't hurt to try.
  16. 1st question: You have to put the ElseIf before the End If, or the script won't work. 2nd question: It's possible, but I can't tell exactly how at the moment. It'd probably take a lot more work than giving each rod its own unique set of fish to catch, though.
  17. peekay, I think you want to add these lines: ``` Dim DmgRange DmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3) ``` to Sub PlayerHit, so that it'll look like this: ``` Sub PlayerHit(Index, NPCNum, Damage) Dim DmgRange DmgRange = Rand(Int(Damage) - 3, Int(Damage) + 3) If Damage > 0 Then Call NPCAttack(NPCNum, Index, DmgRange) End If End Sub ``` Also, be sure to add the same lines to Sub OnArrowHit, so ranged attack damage is randomized, too.
  18. I think the problem is the order you're calling the statements. Since you're calling DamageNPC first, the NPC will die before you can call the message saying that the NPC died, and since your target no longer exists, it'll try to find the name of something that doesn't exist anymore, the cause of the error. Try moving the DamageNPC call to the line after the BattleMsg call (right before the End If). That should fix it.
  19. Try out these ones. http://www.touchofdeathforums.com/smf/index.php/topic,21764.0.html http://www.touchofdeathforums.com/smf/index.php/topic,21767.0.html http://www.touchofdeathforums.com/smf/index.php/topic,21771.0.html http://www.touchofdeathforums.com/smf/index.php/topic,21773.0.html Those tutorials usually help out when you're first trying to learn SadScript. Also, here's a list of most, if not all, of the commands in SadScript (in EE 2.7). This'll be really useful once you learn how to script. http://www.touchofdeathforums.com/smf/index.php/topic,28153.0.html
  20. Call CustomMenuPicture(index, picture_index, "", 0, 0), with picture_index being the picture you want to remove, ought to get rid of the picture without closing the menu.
  21. Currency can be in any slot. However, there is a solution: run some code that will find the slot with the item number you use for currency, and check how much currency is in that slot. Here's the function I use for that task: ``` 'DarkMazer. Checks inventory for specified item. 'Returns the first slot that has the item or 0 if no slot has the item. Function CheckInventory(index, itemnumber) Dim h CheckInventory = 0 For h = 1 To 24 If GetPlayerInvItemNum(index, h) = itemnumber Then CheckInventory = h Exit Function End If Next End Function ```
  22. Instead of using SetMapNpcHP, you may want to try DamageNPC(index, NPCindex, damage). That should cause the NPC to react. I'm not sure if it'll use the default battle message or not, though. If it does something you don't want it to, then try adding SetMapNpcTarget(MapNum, NPCIndex, Target) and SendNPC(mapnum, NPCindex) to make it target the player. I'm not sure how to go about making the life bar appear, though. I can't figure out how to kill the NPC, either, besides hitting it with an attack after it's already at negative HP.
  23. GetPlayerTarget(index) will only return -1 if your target is an NPC, and GetPlayerTargetNpc(index) will tell you what an NPC's index is, so if you want to target only players, use GetPlayerTarget(index); if you want to target only NPCs, use GetPlayerTargetNPC(index), and if you want to target either, use something like: ``` Dim target target = GetPlayerTarget(index) If target > 0 Then 'do something Else target = GetPlayerTargetNPC(index) 'do something End If ``` Also, if that doesn't work either, it may be a bug in EE 2.7 preventing you from targeting an NPC properly. If that's the case, you need to find someone who can fix the source code for you.
  24. There's two ways to cast a spell in Eclipse: After selecting your target… 1\. Double-click on it to memorize it, then press Insert. 2\. Select it on the Spells menu (single click), then click "Cast". If you're going to be switching spells a lot, it's probably better to keep the spell menu open so you can click on a new spell and click Cast a bit faster. Having more than one key to which you could assign spells would be nice, but it's not the way Eclipse normally functions. I hope that answers your question.
  25. Thanks. I guess I do learn something new every day.
×
×
  • Create New...