Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 me and mortal trying to make when player got lvl 15 he evolue in other sprite but for that it need to have itam in inventory```If Player(Index).Char(TempPlayer(Index).CurChar).HasItem = 5 ThenTakeInvItem Index, 5ElseAddtext "You need an Stone.", BrightRedEndIf```i geting error on HasItam any one cnow how to fix Link to comment Share on other sites More sharing options...
Domino_ Posted August 3, 2012 Share Posted August 3, 2012 server or client side? :DLooks like u coded that u can use more than one char or ist ED ? :D Link to comment Share on other sites More sharing options...
Guest Posted August 3, 2012 Share Posted August 3, 2012 Mortal released a code that when you reach a certain level you can change your sprite. Its in his Custom Scripts tutorial. Link to comment Share on other sites More sharing options...
zerohero Posted August 3, 2012 Share Posted August 3, 2012 Thats not really the correct way to use HasItem I believe, the correct method would be to do something like this (this is complete pseudo code)```CheckItem = HasItem(index, ItemNum)if CheckItem > 0 ThenTakeInvItem Index, 5ElseAddtext "You need an Stone.", BrightRedEnd If```Something like that should do the trick. Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 server side (eclipse dawn) event custom scripti hawe that code for evolution but i need when he got lvl 15 and when he try to evolue he need itam for that Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 @zerohero:> Thats not really the correct way to use HasItem I believe, the correct method would be to do something like this (this is complete pseudo code)> > ```> > CheckItem = HasItem(index, ItemNum)> > if CheckItem > 0 Then> TakeInvItem Index, 5> Else> Addtext "You need an Stone.", BrightRed> End If> > ```> Something like that should do the trick.ERROR On chekitam variable not defined Link to comment Share on other sites More sharing options...
zerohero Posted August 3, 2012 Share Posted August 3, 2012 Yes ofcourse you would need to define that first ^^At the start of your sub add```Dim CheckItem As Long``` Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 ahh yess dim chekitam as long but now i getting this error on TakeInvItem(argument not optional) Link to comment Share on other sites More sharing options...
zerohero Posted August 3, 2012 Share Posted August 3, 2012 @Zopto:> ahh yess dim chekitam as long but now i getting this error on TakeInvItem(argument not optional)Hmm your original paremetres for the **TakeInvItem** is incorrectIt should be more like this -```TakeInvItem index, itemname, Amount```So in your case it would be```TakeInvItem index, CheckItem, 1```So your final code should work now -```CheckItem = HasItem(index, ItemNum)if CheckItem > 0 ThenTakeInvItem index, CheckItem, 1ElseAddtext "You need an Stone.", BrightRedEnd If``` Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 but it dont take itam from inventory also it blocking evolution comandhere is my code see if you can fix it tnx```Public Sub CustomScript(Index As Long, caseID As Long) Dim itemnum As Long Dim CheckItem As LongCheckItem = HasItem(Index, itemnum) Select Case caseID Case 1 If Player(Index).Char(TempPlayer(Index).CurChar).Sprite = 1 ThenIf Player(Index).Char(TempPlayer(Index).CurChar).Level >= 5 ThenIf CheckItem > 5 ThenPlayer(Index).Char(TempPlayer(Index).CurChar).Sprite = 2TakeInvItem Index, CheckItem, 5Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 15) Call SendPlayerData(Index)End IfElseEnd IfElseEnd If Case Else PlayerMsg Index, "You just activated custom script " & caseID & ". This script is not yet programmed.", BrightRed End SelectEnd Sub``` Link to comment Share on other sites More sharing options...
zerohero Posted August 3, 2012 Share Posted August 3, 2012 ```Public Sub CustomScript(Index As Long, caseID As Long) Dim CheckItem As Long CheckItem = HasItem(Index, 5) Select Case caseID Case 1 If Player(Index).Char(TempPlayer(Index).CurChar).Sprite = 1 And Player(Index).Char(TempPlayer(Index).CurChar).Level >= 5 And CheckItem > 0 Then Player(Index).Char(TempPlayer(Index).CurChar).Sprite = 2 TakeInvItem Index, CheckItem, 1 Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 15) Call SendPlayerData(Index) End If Case Else PlayerMsg Index, "You just activated custom script " & caseID & ". This script is not yet programmed.", BrightRedEnd SelectEnd Sub``` Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 @zerohero:> ```> Public Sub CustomScript(Index As Long, caseID As Long)> Dim CheckItem As Long> > CheckItem = HasItem(Index, 5)> > Select Case caseID> Case 1> > If Player(Index).Char(TempPlayer(Index).CurChar).Sprite = 1 And Player(Index).Char(TempPlayer(Index).CurChar).Level >= 5 And CheckItem > 0 Then> Player(Index).Char(TempPlayer(Index).CurChar).Sprite = 2> TakeInvItem Index, CheckItem, 1> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 15)> Call SendPlayerData(Index)> End If> > Case Else> > PlayerMsg Index, "You just activated custom script " & caseID & ". This script is not yet programmed.", BrightRed> > End Select> > End Sub> ```WORKS TNX!!!!!! :star: :star: :star: :star: :star: Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 EDITE:but one problem it alweys take just itam number 1 not number 5?? Link to comment Share on other sites More sharing options...
zerohero Posted August 3, 2012 Share Posted August 3, 2012 Haha I knew we would get there in the end. Your code was a bit bloated and some of you logic was off, always be sure you understand the paremetres of a sub or function before calling them or you will just create errors that pile up.Please take a look at what I changed from your original code for future reference.*edit*Oh sorry change```TakeInvItem Index, CheckItem, 1```to```TakeInvItem Index, 5, 1```Have a nice day. Link to comment Share on other sites More sharing options...
Zopto Posted August 3, 2012 Author Share Posted August 3, 2012 @zerohero:> Haha I knew we would get there in the end. Your code was a bit bloated and some of you logic was off, always be sure you understand the paremetres of a sub or function before calling them or you will just create errors that pile up.> > Please take a look at what I changed from your original code for future reference.> > *edit*> > Oh sorry change> ```> > TakeInvItem Index, CheckItem, 1> ```> to> > ```> TakeInvItem Index, 5, 1> ```> Have a nice day.hehe tnx alot man !!!!works perfectly!tnx tnx! :bstar: :bstar: :star: :bstar: :star: 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