Pasketi Posted June 2, 2009 Author Share Posted June 2, 2009 So i am doing a sailing-part to my game, and i need to script something like this:Player goes to a pier and script automatically changes his sprite to a boat and warps him to sea-map. When moving to shore, the player-sprite changes back and player is warped to pier. This works!Problem: I need to prevent those who haven't bought a ship to board it. So i have an item number 3 as a Light sloop, and i want my script to check if that's there. If it's not, the player won't get aboard and stays on that island.Help please? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 2, 2009 Share Posted June 2, 2009 Just install http://www.touchofdeathforums.com/smf/index.php/topic,28174.0.html and have:If CanTake(Index, 3, 1) = False Then 'Display a msg to player saying he needs the item 'Prevent the player from boarding.End If Link to comment Share on other sites More sharing options...
Pasketi Posted June 2, 2009 Author Share Posted June 2, 2009 Ok got to try. Thanks Link to comment Share on other sites More sharing options...
Pasketi Posted June 2, 2009 Author Share Posted June 2, 2009 Ok that code is working perfectly! Now other news:I use the boat script (modified) and this is the problem:1\. I go down the pier, game checks if i have a currency "Light Sloop" with me (if not, i'm thrown away and they say i have to get a boat), transform to a boat and warp to sea and gain a stat bonus (little different from land-battle).2\. I go back to island and de-transform back to my old sprite and de-gain a stat bonus i got earlier.New island, 2 new cases on scripted tile (new island dock and launch), nothing works! What is the problem?Used:Boat ScriptCheck item -scriptOriginal stat gain script (from that stat + script idk what it's called)PlayerWarpSub ScriptedTileWhen i start my server tomorrow, i can put here the code. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 2, 2009 Share Posted June 2, 2009 Yea, I'll have to see the code before knowing what's wrong (just please don't paste your entire main.txt, but rather the reliant subs and the scripted tile sub). Link to comment Share on other sites More sharing options...
Pasketi Posted June 2, 2009 Author Share Posted June 2, 2009 I'll post the script tomorrow… Now to sleep... I'm hungry... :icon_sleep: Link to comment Share on other sites More sharing options...
Pasketi Posted June 3, 2009 Author Share Posted June 3, 2009 Ok i got now the scrip *YAWN* here is the working copy:```Sub ScriptedTile(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE) Exit SubCase 2 If CanTake(Index, 3, 1) = False Then Call PlayerMsg(index, "You have not permissions to board the ship! You need a ship!", 4) Call PlayerWarp(index, 1, 3, 17) Else If int(GetPlayerSprite(index)) <> 80 Then Call PutVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat", GetPlayerSprite(index)) Call SetPlayerSprite(index, 80) Call PlayerMsg(index, "You begin to set sail from isle Gordas.", 2) Call PlayerWarp(index, 10, 25, 15) Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 50) Call SendPlayerData(index) End If End IfCase 3 Dim Sprite Sprite = int(GetVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat")) If int(GetPlayerSprite(index)) = 80 Then Call SetPlayerSprite(index, Sprite) Call PlayerMsg(index, "You have docked to Isle Gordas.", 2) Call PlayerWarp(index, 1, 1, 17) Call SetPlayerSTR(Index, GetPlayerSTR(Index) - 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) - 50) Call SendPlayerData(index) Else Call PlayerMsg(index, "Step onto the water to begin sailing", 2) End If Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```And this doesnt work:```Sub ScriptedTile(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE) Exit SubCase 2 If CanTake(Index, 3, 1) = False Then Call PlayerMsg(index, "You have not permissions to board the ship! You need a ship!", 4) Call PlayerWarp(index, 1, 3, 17) Else If int(GetPlayerSprite(index)) <> 80 Then Call PutVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat", GetPlayerSprite(index)) Call SetPlayerSprite(index, 80) Call PlayerMsg(index, "You begin to set sail from isle Gordas.", 2) Call PlayerWarp(index, 10, 25, 15) Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 50) Call SendPlayerData(index) End If End IfCase 3 Dim Sprite Sprite = int(GetVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat")) If int(GetPlayerSprite(index)) = 80 Then Call SetPlayerSprite(index, Sprite) Call PlayerMsg(index, "You have docked to Isle Gordas.", 2) Call PlayerWarp(index, 1, 1, 17) Call SetPlayerSTR(Index, GetPlayerSTR(Index) - 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) - 50) Call SendPlayerData(index) Else Call PlayerMsg(index, "Step onto the water to begin sailing", 2) End IfCase 4 If CanTake(Index, 3, 1) = False Then Call PlayerMsg(index, "You have not permissions to board the ship! You need a ship!", 4) Call PlayerWarp(index, 1, 3, 17) Else If int(GetPlayerSprite(index)) <> 80 Then Call PutVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat", GetPlayerSprite(index)) Call SetPlayerSprite(index, 80) Call PlayerMsg(index, "You begin to set sail from Savage Isle.", 2) Call PlayerWarp(index, 10, 18, 13) Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 50) Call SendPlayerData(index) End If End IfCase 5 Dim Sprite Sprite = int(GetVar("accounts\" & GetPlayerLogin(index) &".ini", "CHAR" & GetPlayerCharNum(index), "noboat")) If int(GetPlayerSprite(index)) = 80 Then Call SetPlayerSprite(index, Sprite) Call PlayerMsg(index, "You have docked to Savage Isle.", 2) Call PlayerWarp(index, 15, 15, 27) Call SetPlayerSTR(Index, GetPlayerSTR(Index) - 50) Call SetPlayerDEF(Index, GetPlayerDEF(Index) - 50) Call SendPlayerData(index) Else Call PlayerMsg(index, "Step onto the water to begin sailing", 2) End If Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```I didn't find a problem here…. did you?? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted June 3, 2009 Share Posted June 3, 2009 Unless you have two ScriptedTile subs in your Main.txt, I can't find any problems with this (atleast syntax).waits for bobosk to come in and point out something really simple that he missed. Link to comment Share on other sites More sharing options...
Bobosk Posted June 3, 2009 Share Posted June 3, 2009 Did you change something else in your main..? anything above your scripted tile sub.. Link to comment Share on other sites More sharing options...
Pasketi Posted June 3, 2009 Author Share Posted June 3, 2009 Umm… i just copy-pasted those two cases and changed them a bit but... nothing above. If i use bottom, nothing happens in scipted tile. If upper code, all works fine...and no, i don't have 2 scriptedtile subs. These are one and same, but modified Link to comment Share on other sites More sharing options...
Bobosk Posted June 3, 2009 Share Posted June 3, 2009 uhmm, try just having one "Dim Sprite" at the top of your scripted tile sub, instead one in each case… Link to comment Share on other sites More sharing options...
Pasketi Posted June 3, 2009 Author Share Posted June 3, 2009 hmmm…. never thought of that... i'll try tomorrow... you know if it works in 11 hours... Need my sleep :icon_sleep:Thanks in advantageEDIT: By the way, can i put this to script database after it's working? It's quite nice script... Link to comment Share on other sites More sharing options...
Bobosk Posted June 3, 2009 Share Posted June 3, 2009 i think you mean thanks in advance… loland yes you can... Link to comment Share on other sites More sharing options...
Pasketi Posted June 4, 2009 Author Share Posted June 4, 2009 Thanks, now the script works perfectly!! There was that Dim Sprite…And yes, i mean thanks in advance... 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