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. You could try using timers instead, or you could do it for all player indexes, like this: ``` Dim Index For Index = 1 To MAX_PLAYERS 'do something Next ```
  2. You could use GlobalMsg, which doesn't need an index value.
  3. I only called that a problem because, if the player's speed is already higher than 4, it won't work, since SetSpeed only takes in powers of 2. Oh, I just noticed that you used SetPlayerSpeed and not SetSpeed. XP The main thing I was correcting was using putvar in a place where getvar should have been.
  4. @dg1423: > lol, there's no index in that sub, lol. Darn, I got beat to it. Remember to read what parameters are used in the sub. In this case, Hours, Minutes, and Seconds. If you want to use any other variables, you'll have to find a way to find them yourself.
  5. @Munro: > Sub ScriptedItem(index, Script) > > > Select Case Script > > Case 0 > > Call putvar("carform.ini", Sprites, GetPlayerName(index), Getplayersprite(index)) > > call setplayerspeed(index, GetPlayerSpeed(index)*2) > > Call SetPlayerSprite(Index, 5) > > Call PlayerMsg(Index, "You Hop in the car.", WHITE) > > SendPlayerData > > End Select > > End Sub > > To switch back just do > > > Call SetPlayerSprite(Index, getvar("carform.ini", Sprites, GetPlayerName(index))) > > Call PlayerMsg(Index, "You get out of the car", WHITE) > > call setplayerspeed(index, GetPlayerSpeed(index)/2) > > SendPlayerData > > something like this. I didn't test it or even read it through. Any problems tell me. I see a few problems, but I fixed them above. The changes are underlined.
  6. Delete this: > ' Remove this to enable. > Exit Sub
  7. There are 3 places you would put it: -after the line Call DamagePlayer(…) in Sub OnAttack -after the line Call DamagePlayer(...) in Sub OnArrowHit -after the line Call NPCAttack(...) in Sub PlayerHit Of course, the code there would have to change a bit for the first two, since it would have to use "target" instead of "index", but it'll stay the same for the last one. Also, you're using some of the commands wrong. Call BattleMsg(index, "message", color, side), where side is 0 for left and 1 for right Call PlaySound(index, "soundname.wav")
  8. I edited my earlier post and corrected a small mistake. It should work now (and I actually tested it this time, too).
  9. I rewrote the entire thing, because the old format looked a bit convoluted for my tastes. ``` Case 1 If GetPlayerMP(Index) < 5 Then 'check MP Call PlayerMsg(Index, "Not enough MP!", BRIGHTRED) Exit Sub End If target = GetPlayerTarget(Index) If target < 0 Then NPCTarget = GetPlayerTargetNpc(Index) x = GetNpcX(GetPlayerMap(Index), NPCTarget) y = GetNpcY(GetPlayerMap(Index), NPCTarget) Else x = GetPlayerX(target) y = GetPlayerY(target) End If If Abs(GetPlayerX(Index) - x) + Abs(GetPlayerY(Index) - y) > 5 Then 'check range Call PlayerMsg(Index, "You are too far away!", BRIGHTRED) Exit Sub End If If target < 0 Then Call DamageNPC(Index, NPCTarget, 5) Else Call DamagePlayer(Index, target, 5) End If Call PlaySound(Index, "magic19.wav") Call SpellAnim(50, GetPlayerMap(Index), x, y) ``` Hopefully you can see how the range check works in there.
  10. There are two ways of doing it, both explained here in pseudocode: ``` If abs(playerx - targetx) > range Or abs(playery - targety) > range Then message ("you are too far!") Else spell goes here End If ```This way checks if either a player's X or Y is too far away from the target's, so the area of possible targets is a sqare centering on the player. The other way: ``` Dim xdiff, ydiff xdiff = abs(playerx - targetx) ydiff = abs(playery - targety) If xdiff + ydiff > range Then message ("You are too far away!") Else spell goes here End If ```This one checks if the sum of the x-coordinate difference and y-coordinate difference is larger than the range, so the area of possible targets is a diamond-shape centering on the player. Hope that helps.
  11. If you haven't already, you can learn a lot by checking out the tutorials. You can find tutorials that explain what the different subs do, how to use commands, how to use timers to execute scripts after a certain amount of time passes, and more.
  12. The way you wrote that is kinda confusing, but I think this is what you want: ``` If thing1 > thing2 And thing2 > thing3 Then If thing4 > thing5 And thing5 > thing6 Then If thing7 > thing8 And thing8 > thing9 Then If thing10 > thing11 And thing11 > thing12 Then do this Else do that End If Else do that End If Else do that End If Else do that End If ``` You could also write it like this, which saves some space but makes one line really, really long: ``` If thing1 > thing2 And thing2 > thing3 And thing4 > thing5 And thing5 > thing6 And thing7 > thing8 And thing8 > thing9 And thing10 > thing11 And thing11 > thing12 Then do this Else do that End If ``` It's important to remember that you can only compare one object with one other object at a time. You can't do 0 < x < 10 when scripting (at least not in SadScript).
  13. I'm not sure how to fix it… Everything else looks right, but I haven't tried using SpellAnim before, so I can't really help too much on that. Edit: Actually, I think I might know what's wrong. If your target is an NPC, no spell animation will be called, since the spell animation right now assumes you're targeting a player. You can get the NPC's coordinates for the spell animation using GetNpcX(map, npcnum) and GetNpcY(map, npcnum). However, if you target another player and the spell animation still doesn't show, then there's something wrong with the call.
  14. It looks like the problem is the game was trying to use NPCNum as a variable even though there was nothing in it. I edited the script one last time (hopefully) to take that into account, and it should be able to remove the timer properly now.
  15. Looks like I was wrong about the SpellAnim command. Upon closer inspection, it appears as if it calls the animation for the spell number you specify at the location you specify. So, you need to make a spell that's either going to be a dummy spell, only there for the animation, or you can make that spell do something else as well, but you need a spell set up with the animation you want to call, then you need to put that spell's number in the SpellAnim call. Hopefully that's not too confusing.
  16. For PlaySound, the parameters are index and name of sound starting from the SFX folder, so if you put "magic19.wav" in the blank (including the quotes), you'll get the result you want. What you want for the second part is something like GetPlayerX(target) and GetPlayerY(target), where target is the index number of the player's target, which also happens to be the value that GetPlayerTarget(index) returns. So, to get those, you'd do something like this: ``` Dim x, y, target target = GetPlayerTarget(index) x = GetPlayerX(target) y = GetPlayerY(target) ```Do what you want with it from there. Call SpellAnim(animationnum, map, x, y) will show the spell animation specified at the coordinates specified. There's no need for Index, since you won't always be calling it on the current player's location.
  17. It works, but it probably doesn't do what you want it to do at all. First it warps you, then it checks immediately after you warp if you have item 2. Scripts don't wait unless they're on a timer.
  18. There were a bunch of lines that said "Bounty)) + number, so there was a missing quote at the end of Bounty that probably caused a bunch of errors. And that extra & in the GiveCurrency sub was causing some problems, as well. (The one in GlobalMsg is fine)
  19. @Gh0st: > Oh yeah, the extra "&" in the first globalmsg might have been causing it… Not to mention quite a few missing quotes…
  20. I removed all of the syntax errors, try it now: ``` Sub OnPVPDeath(Attacker, Victim) Dim bounty bounty=GetVar("bounty.ini","" & GetPlayerName(Attacker),"Bounty") Call GiveCurrency(Attacker, 4, GetVar("bounty.ini",GetPlayerName(Victim), "Bounty")) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) Call PutVar("bounty.ini",GetPlayerName(Victim), "Bounty", "0") If GetPlayerLevel(Victim) >1999 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >1499 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >999 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 5000)) End If If GetPlayerLevel(Victim) >749 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 2500)) End If If GetPlayerLevel(Victim) >499 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 2500)) End If If GetPlayerLevel(Victim) >249 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 1500)) End If If GetPlayerLevel(Victim) >99 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 500)) End If If GetPlayerLevel(Victim) >49 Then Call PutVar("bounty.ini", GetPlayerName(Attacker), "Bounty", CStr(CInt(GetVar("bounty.ini", GetPlayerName(Attacker), "Bounty")) + 500)) End If Call GlobalMsg(GetPlayerName(attacker) & " has" &Getvar("bounty.ini",GetPlayerName(attacker),"Bounty") & " bounty") End Sub ```
  21. Just a couple small problems. ``` Sub ScriptedNPC Case0 Call PlayerMsg(index, GetVar("Responses.ini","section1", "param" & rand(1,100)) End Sub ```After adding the quotes and that bit with "param" &, it should work fine.
  22. @AdrianC: > He wanted to learn how to use two different cases. It just happened that he used the same code for both. I can't see why you would ever make two cases which are exactly the same. The only use I've thought of for making two cases the same is weighted probabilities (like if you want something to happen 3/8 of the time, another thing to happen 1/8 of the time and a third thing to happen 4/8 of the time), but I'm sure there's other uses for it, too.
  23. Well, since they're exactly the same thing, you could do this: > **Case 0, 1** > dim weapon > Weapon = GetPlayerWeaponSlot(index) > If weapon = 0 Then > Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) > ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then > Call GoWoodcutting(index, 1, 10, "Logs") > Else > Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) > End If > > End Select > End Sub I don't think a whole lot of people know about that. If you simply separate two cases with a comma, it'll work for both cases. I don't see why you need it here, but there are certainly situations where that's helpful.
×
×
  • Create New...