Ranking
Is there anyway to make, for example, newgrenade.lua push ALL objects (and players[Won't work in 4 player]), as well as environmental objects?
not sure about 4 players. Edit the script to see if it can.
Enviroment objects = no.
:D
Can scripts interact with Environmental objects at all?
Edit: I gave it a whack and failed. I failed so bad, I made it worse. Now you won't fracture or dismember. I think it's because there is no player3 and player4 variable in lua.
Last edited by Nuyashaki; Jan 24, 2008 at 07:57 PM.
You can do the same to players 3 and 4 as you can to uke and tori.

The script i attached is random.lua but it makes all 4 players have random joints.
Last edited by Blam; Mar 29, 2008 at 11:27 AM.
:D
How does draw_text function work?

I can't seem to make a string of text appear on screen.
From SDK:
-- draw__text(string text, number pos_y [, integer font_type])

-- USE: Draws text on the screen
-- NOTES: -

local function draw_text_example()
set_color(0, 0, 0, 1)
draw_text("THIS... IS... TORIBASH!", 100, 100)
end

add_hook("draw2d", "draw_text_example", draw_text_example)

Makesure its in a "draw2d" hook.
:D
I've been trying to make a script that allows you to rewind the game. It correctly sets the positions of the joints and bodyparts, but not the orientation of the bodyparts. I've tried using get_body_info(player,part).sides, but this function always returns the same answer, no matter what the orientation is.

Also if I use set_body_sides with different data it causes toribash to crash.

-- replay_rewind

do
	local joint_poss = {} -- done
	local body_infos = {} 
	local grip_states = {}
	local body_infos = {} -- doing
	local body
	local body_angular_vels = {}
	local nody_linear_vels = {}
	
	local current_frame = 1
	
	local function enter_frame()
		world_state = get_world_state()
		match_frame = world_state.match_frame
		joint_poss[match_frame] = {}
		body_infos[match_frame] = {}
		
		echo("match_frame = "..match_frame)
		for p=0,1,1 do
			joint_poss[match_frame][p] = {}
			body_infos[match_frame][p] = {}
			for temp,j in pairs(JOINTS) do
				x,y,z=get_joint_pos(p,j)
				joint_poss[match_frame][p][j] = {x,y,z}
			end
			for temp,j in pairs(BODYPARTS) do
				body_infos[match_frame][p][j] = get_body_info(p,j)
			end
		end
	end
	
	local function set_tori()
		if joint_poss[current_frame]==nil then
			echo ("current frame does not exist")
		else
			for p=0,1,1 do
				for temp,j in pairs(JOINTS) do
					jp = joint_poss[current_frame][p][j]
					echo ("p="..p.." j="..j.." jp[1]="..jp[1])
					set_joint_pos(p, j, jp[1], jp[2], jp[3])
				end
				for temp,j in pairs(BODYPARTS) do
					bp = body_infos[current_frame][p][j].pos
					set_body_pos(p,j, bp.x, bp.y, bp.z)
					bs = body_infos[current_frame][p][j].sides
					set_body_sides(p,j, bs.x, bs.y, bs.z)
				end
			end
		end
	end
	
	local function key_down(key)
		if key==string.byte('[') then
			current_frame = current_frame - 1
			echo ("current_frame = "..current_frame)
			set_tori()
			return 1
		end
		if key==string.byte(']') then
			current_frame = current_frame + 1
			echo ("current_frame = "..current_frame)
			set_tori()
			return 1
		end
	end
	
	add_hook("enter_frame","replay_rewind", enter_frame)
	add_hook("key_down", "replay_rewind", key_down)
end