View Full Version : battling trolls

11-19-2010, 01:46 PM
Please forgive me for bothering you, but my posts are not being answered and I need help. I am trying to have a weapon (battle axe) detect whether it is close to a skullcap, a head, a wooden club and a list of enemy parts and bounce off hard items or partially sink into soft items. I also want this collision detection to be a parameter for how far the weapon gets swung. (i.e. While no-collision... turn arm right .1 revolutions)
I can use the body-part list for collision detection (boolean check) but the list will not go into a numerical detection method (i.e. If
<[battleaxe.blade's width / 2] + .1m> within .15m of {list}). I do not want to code seperately for each body-part and was hoping you would have a solution.

11-19-2010, 02:00 PM
Wait, please explain more clearly what you are trying to do? cause I'm just confused right now on what you need.

11-20-2010, 01:56 AM
Foreword: I haven't cleaned up my code or removed code I am no longer using in the game I have uploaded. I'm keeping it just in case I need to use it later. Please disregard the extra or disabled code.
Under the properties menu's of each troll is a list of bodyparts (less the skullcaps and weapons [I replaced the trolls clubs with other weapons]). I want to create a method(?) which checks every .1 second if a weapon is within {list-of-bodyparts depth/width(? see below)} of the opponent... If the answer is false, increment an attack movement of the weapon-arm by .1 revolution X world.speed (duration .1 second); Else stop attack movement, return the troll to 'startpose' (duration .5 seconds), and determine which bodypart/skullcap/weapon was hit... If the blow was against the skullcap or weapon the striking troll gets no points, the weapon bounces (the wooden club always bounces), and the troll randomly says something; Else determine how many points the blow was worth (the points awarded will be 12Xworld.speed of .25 = 3, 4Xworld.speed of .5 = 2, and 4/3Xworld.speed of .75 = 1 [whatever the code]), allow the battleaxe to sink .25 of its width/depth into opponent and (together) display strike-points in the 'strike' portion of scoreboard for 2 seconds and add strike-points to the 'total' portion of scoreboard.
Note: even though there could be numerous checks to see if a weapon has come close enough to the enemy to make a strike, the world.speed function can only be called once so that the speed of the swing remains constant for that particular swing.
PS: Depth/width/length(?) I do not know if the height of an arm is its length, or if the depth is its length, or unintuitively if the width is its length. Same for a weapon, what constitutes the battleaxes length/width/depth (top to bottom/side to side/frontblade to backblade)?
PPS: Somewhere I saw a timer event that used 3D-Text and an as.string and ABS function to display the changing numbers. Is this efficient, or is there a better way?