marked Posted May 19, 2009 Author Share Posted May 19, 2009 Ok, I am making some new commands (I will post them here), but I am kinda just starting, so would someone telling me a few functions? The ones I need are below:Add HealthKill all Npcs on mapKill all Players on mapKill everything on mapSuicideAdd MPAdd SPGive ItemThat was it! If anything can't be done, please tell me. Oh, and please if you post it, explain for me what to edit :) I'm kinda new to this scripting language. Link to comment Share on other sites More sharing options...
Kite Posted May 19, 2009 Share Posted May 19, 2009 add hp,mp,spThis is the HP Call SetPlayerHP(Index, GetPlayerHP(Index)+ Num)This is the MP one. Call SetPlayerMP(Index, GetPlayerMP(Index)+ Num)This one is for SP Call SetPlayerSP(Index, GetPlayerSP(Index)+ Num) Link to comment Share on other sites More sharing options...
Fruitpunch Posted May 19, 2009 Share Posted May 19, 2009 most of these are already made Link to comment Share on other sites More sharing options...
Admiral Refuge Posted May 19, 2009 Share Posted May 19, 2009 All of them you are asking for, are subs, not functions.Regardless though, virtually everything there can be done.For adding health, I'd just use: Call SetPlayerHP(Index, HP)For adding MP: Call SetPlayerMP(Index, MP)For adding SP: Call SetPlayerSP(Index, SP)For giving an item, you'll need http://www.touchofdeathforums.com/smf/index.php/topic,28174.0.html for the functions and subsFor suicide, paste this script at the bottom of your main.txt:```Sub KillPlayer(index)damage = GetPlayerMaxHP(index) + 1Call SetPlayerHP(index, GetPlayerHP(index) - damage)If GetPlayerHP(index) <= 0 ThenCall OnDeath(index)Call GlobalMsg(GetPlayerName(index) & " has died.", 4)Call SetPlayerHP(index, GetPlayerMaxHP(index))Call SetPlayerMP(index, GetPlayerMaxMP(index))Call SetPlayerSP(index, GetPlayerMaxSP(index))Call SendMP(index)Call SendSP(index)If GetPlayerExp(index) \ 10 > 0 ThenCall SetPlayerExp(index, GetPlayerExp(index) - GetPlayerExp(index) \ 10)Call SendExp(index)End IfEnd IfCall SendHP(index)End Sub```Then, to use it, just use Call KillPlayer(Index)Killing all players on the map, I suppose you could do this.Paste this at the bottom of your main.txt:```Sub KillPlayersMap(Index)i = 1Do While i <= Int(GetVar("data.ini", "MAX", "MAX_PLAYERS"))If GetPlayerMap(i) = GetPlayerMap(index) ThenCall KillPlayer(i)End Ifi = i + 1LoopEnd Sub```Then, just call it like so: Call KillPlayersMap(Index)For killing all NPCs on the map, I'm not entirely sure, but this may work:```Sub KillNpcsMap(Index)i = 1Do While i <= 15Call DamageNPC( Index, i, Int(GetMapNpcHP(GetPlayerMap(Index), i) + 1) )i = i + 1LoopEnd Sub```To call it, simply call Call KillNpcsMap(Index)As for both, simply combine the two and get:```Sub KillAllMap(Index)i = 1Do While i <= Int(GetVar("data.ini", "MAX", "MAX_PLAYERS"))If GetPlayerMap(i) = GetPlayerMap(index) ThenCall KillPlayer(i)End Ifi = i + 1Loopi = 1Do While i <= 15Call DamageNPC( Index, i, Int(GetMapNpcHP(GetPlayerMap(Index), i) + 1) )i = i + 1LoopEnd Sub```For the record, I just wrote them up on-the-spot (excluding the KillPlayer one), but they should work (and credit goes to me; killPlayer goes to me and Ballie.Warning - while you were typing 2 new replies have been posted. You may wish to review your post.And now, I feel like crying :cry: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now