Kirby4tw Posted October 12, 2009 Author Share Posted October 12, 2009 Hey Eclipser.I have a big problem and i dont know how to fix :lipsrsealed:I want to add strength to the Player(Index).So this is my code (its 100% correct):```Call SetPlayerSTR(Index, GetPlayerSTR(Index) +10)```All know this code sets the Player strenght + 10 but theres a big error:I try to explain:If the Player has no equipped equipment so this code is working fine. BUT!:granted that the player has a basic value of strenght of 15 and a equipped weapon with +5 STR so the basic value increased to 20 (logic).But if i want to use now my code above to increase 10 STR to my actual basic value (20), its unexpected add the weapon Strengh(5) + my Code-Strenght (10) to my basic value. Result 20 + 10 + 5 = 35\. Thats wrong. But Theres should be: 20+10 =30.My Question:Why the server add the EquipStr + My 10 to my STR Value if a equipped something?I think thats a fatal mistake in the Eclipse Engine.So please help me =)Heres the GetPlayerSTR function:```Function GetPlayerSTR(ByVal Index As Long) As Long Dim Add As Long Add = 0 If GetPlayerWeaponSlot(Index) > 0 Then Add = Item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AddStr End If If GetPlayerArmorSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerArmorSlot(Index))).AddStr End If If GetPlayerShieldSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerShieldSlot(Index))).AddStr End If If GetPlayerHelmetSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerHelmetSlot(Index))).AddStr End If If GetPlayerLegsSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerLegsSlot(Index))).AddStr End If If GetPlayerRingSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerRingSlot(Index))).AddStr End If If GetPlayerNecklaceSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerNecklaceSlot(Index))).AddStr End If GetPlayerSTR = Player(Index).Char(Player(Index).CharNum).STR + AddEnd Function```And Here the SetPlayerSTR:```Sub SetPlayerSTR(ByVal Index As Long, ByVal STR As Long) Player(Index).Char(Player(Index).CharNum).STR = STREnd Sub```(Sorry for my bad english)<(Kirby4tw)> Link to comment Share on other sites More sharing options...
Punika Posted October 12, 2009 Share Posted October 12, 2009 i can't help you because I suck at vb but you got a great idea here. Link to comment Share on other sites More sharing options...
zade_o Posted October 12, 2009 Share Posted October 12, 2009 If I'm not mistaken the actual source code for either SetPlayerSTR or GetPlayerSTR is messed up. I can't remember and I don't feel like downloading the source just to look at it, but one of those is messed up in the actual VB source. Link to comment Share on other sites More sharing options...
Ruins of Hell Posted October 12, 2009 Share Posted October 12, 2009 Remove it in the source. Should be in clsCommands. Link to comment Share on other sites More sharing options...
Kirby4tw Posted October 12, 2009 Author Share Posted October 12, 2009 Punika, meinst du echt es is ne tolle idee die stärke übern server zu verändern? Ich brauch das in verbindung mit nem Buffscript. Das Funktioniert soweit. Aber wenn ich was angelegt habe addiert er die falschen werte siehe mein Problem oben im schlechten Englisch >_>Aber danke das du es dir wenigstens angeschaut hast. Ich hoffe einer der ECLIPSE_FREAKS xD kann das lösen.Thank you Punika.I hope anybody can help me with this :/@ The Soul Numb:no clsCommand fpr SadScript is the same as the Server-Side One.Because the clsCommand use the same GetPlayerSTR Function. === PROBLEM Link to comment Share on other sites More sharing options...
Ruins of Hell Posted October 12, 2009 Share Posted October 12, 2009 @Kirby4tw:> @ The Soul Numb:> no clsCommand fpr SadScript is the same as the Server-Side One.> Because the clsCommand use the same GetPlayerSTR Function. === PROBLEMYes, you fix it, just take away the part where it gets the what the player is wearing, and change it to a new command like GetPlayerBaseStr. Link to comment Share on other sites More sharing options...
Kirby4tw Posted October 12, 2009 Author Share Posted October 12, 2009 I dont understand what you mean o.o sryHeres the GetPlayerSTR function:```Function GetPlayerSTR(ByVal Index As Long) As Long Dim Add As Long Add = 0 If GetPlayerWeaponSlot(Index) > 0 Then Add = Item(GetPlayerInvItemNum(Index, GetPlayerWeaponSlot(Index))).AddStr End If If GetPlayerArmorSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerArmorSlot(Index))).AddStr End If If GetPlayerShieldSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerShieldSlot(Index))).AddStr End If If GetPlayerHelmetSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerHelmetSlot(Index))).AddStr End If If GetPlayerLegsSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerLegsSlot(Index))).AddStr End If If GetPlayerRingSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerRingSlot(Index))).AddStr End If If GetPlayerNecklaceSlot(Index) > 0 Then Add = Add + Item(GetPlayerInvItemNum(Index, GetPlayerNecklaceSlot(Index))).AddStr End If GetPlayerSTR = Player(Index).Char(Player(Index).CharNum).STR + AddEnd Function```And Here the SetPlayerSTR:```Sub SetPlayerSTR(ByVal Index As Long, ByVal STR As Long) Player(Index).Char(Player(Index).CharNum).STR = STREnd Sub```But, damnit, wheres is the bug come from? o.O Link to comment Share on other sites More sharing options...
varinyc Posted October 12, 2009 Share Posted October 12, 2009 the SetPlayerSTR finds the STR that is saved for that playerthe GetPlayerSTR finds what that player is AND adds all the armor/weapons to it.If you want to add to the base and NOT what it is after your code should be this:```Call SetPlayerSTR(Index, Player(Index).Char(Player(Index).CharNum).STR +10)```I think. ^_^ Link to comment Share on other sites More sharing options...
Kimimaru Posted October 12, 2009 Share Posted October 12, 2009 varinyc's code will probably solve the problem. The main problem is that the source only contains one strength function. It should also have something like a **GetPlayerMaxStr(Index)** function to prevent this from happening. I'll try to explain what was happening before:First, you were getting the strength bonus from equipping the weapon, giving you 20 strength. When you used the **GetPlayerStr(Index)** function, it went through the equipment part, found a +5, and added it to your existing strength (20), leaving you with 25\. Then, you added a 10 to whatever the **GetPlayerStr(Index)** was, which is 25, thus leaving you with 35 strength. Basically, it added the +5 twice in a different way. Link to comment Share on other sites More sharing options...
anasky Posted October 15, 2009 Share Posted October 15, 2009 This is really simple actually xD```Function GetPlayerStr(ByVal Index As Long) As Long ...End FunctionFunction GetPlayerBaseStr(ByVal Index As Long) As Long 'GetPlayerSTR = Player(Index).Char(Player(Index).CharNum).STR + Add is the original getplayerstr. 'the + Add is ruining your thing, so we just make it: GetPlayerSTR = Player(Index).Char(Player(Index).CharNum).STREnd Function```Btw, I don't like it how you called the coders in eclipse ECLIPSE_FREAKS (I know you said: I hope the eclipse freaks can solve this, but still)@Kirby4tw:> Punika, meinst du echt es is ne tolle idee die stärke übern server zu verändern? Ich brauch das in verbindung mit nem Buffscript. Das Funktioniert soweit. Aber wenn ich was angelegt habe addiert er die falschen werte siehe mein Problem oben im schlechten Englisch >_>> Aber danke das du es dir wenigstens angeschaut hast. Ich hoffe einer der ECLIPSE_FREAKS xD kann das lösen.Have a nice day. 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