DJMaxus Posted July 11, 2010 Author Share Posted July 11, 2010 This is a tutorial for Eclipse Origins v.1.1.0\. It will allow users to be automatically revived if they are killed by an Npc. This is a small and easy tutorial, no one should have a problem understanding it.* Made with 1.1.0, but should work with all versions of Eclipse Origins_**How It Works:**_When a player has an Auto Heal (Auto-Life) item in their inventory, when they die, it will automatically be activated and they will instantly be revived. In the Item Editor, you define how much HP is restored, even how much MP is restored if you wish._**The Code:**_**Server Side:**In **modConstants**Find:```Public Const ITEM_TYPE_SPELL As Byte = 13```Below it, Add:```Public Const ITEM_TYPE_AUTOHEAL As Byte = 14```In **modPlayer**Go to **Sub OnDeath**Find:```Dim I As Long```Below it, Add:```Dim s As Long Dim m As Long For m = 1 To MAX_INV If GetPlayerInvItemNum(Index, m) > 0 Then If Item(GetPlayerInvItemNum(Index, m)).Type = ITEM_TYPE_AUTOHEAL Then For s = 1 To Stats.Stat_Count - 1 If GetPlayerStat(Index, s) < Item(GetPlayerInvItemNum(Index, m)).Stat_Req(s) Then Exit Sub Next SendActionMsg GetPlayerMap(Index), "+" & Item(Player(Index).Inv(m).Num).Data1, BrightGreen, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32 SendActionMsg GetPlayerMap(Index), "+" & Item(Player(Index).Inv(m).Num).Data2, BrightBlue, ACTIONMSG_SCROLL, GetPlayerX(Index) * 32, GetPlayerY(Index) * 32 Call SendAnimation(GetPlayerMap(Index), Item(GetPlayerInvItemNum(Index, m)).Animation, 0, 0, TARGET_TYPE_PLAYER, Index) Call SetPlayerVital(Index, Vitals.HP, GetPlayerVital(Index, Vitals.HP) + Item(Player(Index).Inv(m).Num).Data1) Call SetPlayerVital(Index, Vitals.MP, GetPlayerVital(Index, Vitals.MP) + Item(Player(Index).Inv(m).Num).Data2) Call TakeInvItem(Index, Player(Index).Inv(m).Num, 0) Call PlayerMsg(Index, "Auto-Heal item activated!", BrightGreen) Call SendVital(Index, Vitals.HP) Call SendVital(Index, Vitals.MP) Exit Sub End If End If Next```**Client Side:**In **modConstants**Find:```Public Const ITEM_TYPE_SPELL As Byte = 13```Below it, Add:```Public Const ITEM_TYPE_AUTOHEAL As Byte = 14```In **modGameEditors**Find:```If (frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_SPELL) Then frmEditor_Item.fraSpell.Visible = True frmEditor_Item.scrlSpell.Value = .Data1 Else frmEditor_Item.fraSpell.Visible = False End If```Below it Add:```If (frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_AUTOHEAL) Then frmEditor_Item.fraAutoHeal.Visible = True frmEditor_Item.scrlHP.Value = .Data1 frmEditor_Item.scrlMP.Value = .Data2 Else frmEditor_Item.fraAutoHeal.Visible = False End If```**_Form Work:_**Open up **frmEditor_Item**Add the following items to it:1\. Frame, call it "fraAutoHeal"(You should add all of the items below inside of the frame above)2\. Label, call it "lblHP"3\. Label, call it "lblMP"4\. Horizontal Scroll Bar, call it "scrlHP"5\. Another Horizontal Scroll Bar, call it "scrlMP"Double Click **scrlHP** and paste the following into it:```If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub lblHP.Caption = "HP: " & scrlHP.Value Item(EditorIndex).Data1 = scrlHP.Value```Double Click **scrlMP** and paste the following into it:```If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub lblMP.Caption = "MP: " & scrlMP.Value Item(EditorIndex).Data2 = scrlMP.Value```Double Click **cmbType** and find:```If (cmbType.ListIndex = ITEM_TYPE_SPELL) Then fraSpell.Visible = True Else fraSpell.Visible = False End If```Below it Add:```If (cmbType.ListIndex = ITEM_TYPE_AUTOHEAL) Then fraAutoHeal.Visible = True Else fraAutoHeal.Visible = False End If```Last thing to do is add the Auto-Heal to the list of cmbType. To do this click cmbType, and look for "List" in its Properties. Click the drop-down and you should see all of the item types like Weapon, Armor, etc. Add "Auto-Heal" to the bottom of this list.That's it for the tutorial. You now have items that will automatically bring you back to life if you die. I hope this tutorial helps you further your project if you use it. If you have any questions feel free to ask. Enjoy. Link to comment Share on other sites More sharing options...
Chakkra Posted July 11, 2010 Share Posted July 11, 2010 Wow, nice! Does this work like resurrection phials in Fable?I think I might use this is Edonis. Link to comment Share on other sites More sharing options...
DJMaxus Posted July 11, 2010 Author Share Posted July 11, 2010 That's exactly how it works. No need to use it or anything. As long as it is in your inventory, it will automatically activate and revive you when all of your health is depleted. Link to comment Share on other sites More sharing options...
Chakkra Posted July 11, 2010 Share Posted July 11, 2010 Nice work man, I'm not gunna check it right now to see if it works I'll probably check it out in the morning ;D Link to comment Share on other sites More sharing options...
adr990 Posted July 12, 2010 Share Posted July 12, 2010 Thanks dude, this one works great.Also thumbs up for the tutorial. :) Link to comment Share on other sites More sharing options...
Sir Cid Posted August 18, 2010 Share Posted August 18, 2010 That's one hell of a feature, DJMaxus. And it works great! Link to comment Share on other sites More sharing options...
s3th Posted December 30, 2010 Share Posted December 30, 2010 nice one hehe:) i like it^^ Link to comment Share on other sites More sharing options...
EclipseCommunity Posted January 8, 2011 Share Posted January 8, 2011 I like this. Another idea would be to add a percentage of the maximum HP, rather than a static amount when the player is revived.For those no good at maths, we can't use percent symbols in VB6.So, say a player had a maximum health of 247, and you only wanted to give 18% back on revival.(18 * 247) / 100 = 44.46or in the case of adding to the source:```(18 * GetPlayerMaxVital(index, Vitals.HP)) / 100```**Edit:** I just remembered that Visual Basic does NOT automatically round to whole numbers. If I remember correctly, you can wrap the equation in **Round()**. That should round the answer up or down. 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