![]() |
Default Tile Detection
This is a function that works pretty much like default tile detection(slashing bushes). The function itself is pretty flexible as to allow it to work in various amount of ways(for slashing or picking up an object, for example). It's expanded to allow you to define what tiles can be interacted with, and how much power it takes to destroy them. This allows you to, for example, allow players to slash lava rocks with a level 2 sword. Or hammer blackrocks with a level 3 hammer instead of a level 2. It also returns the data of the object you've 'hit' for further customization.
Parameters are pretty self-explanatory, I think. cdir is the direction to check, as this is in relation to the player. pwr is the amount of power needed to destroy the object, as specified in the array. The powers I mapped out are in relation to player sword powers, but you can specify whatever you'd like. doleap is whether or not to place a leap, you wouldn't want to do this if you are lifting an object. offsetx/y are how much to offset the check x/y from the default position. This is useful, for example, when the player is on a horse you need to offset the y by -1. By the way, the tile arrays in the objectdata array follows this format: [0][1] [2][3] New addition: Different power types. The array map now handles different types of damage. You can add new powers by: Adding the type to the 'temp.powerlayout'. There are 3 types currently. You can remove or add to them. The number of objects is important because the object array will reflect this number. If you add a type, you must add to the powers array in the 'temp.objectdata' value. Defaultly, if no type is specified when you call the function it reverts to the sword power array. PHP Code:
Sword: CheckTiles(player.dir,player.swordpower,true); CheckTiles(player.dir,{"sword",player.swordpower}, true); Sword on Horse: CheckTiles((player.dir+1)%4,{"sword",player.swordp ower},true,0,-1); Lifting: PHP Code:
|
Fixed the power system. The only thing is it may complicate things a bit. I've explained it as best I could in the original post, however.
edit: Fixed a bug that wasn't detecting powers right. |
Someone sticky this.
|
Minor oversight with leaps fixed:
PHP Code:
|
Does this work serverside so all players see this? =o
|
Quote:
|
Awesome- I know this sounds stupid but are you using the default lift system too? Or would I need to code the part of being hit and throwing it etc
|
| All times are GMT +2. The time now is 08:16 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.