Welcome to Open Carnage

A resource for Halo 1 modding and tech, with unique means of rewarding individual content creation and support. Have a wander to see why we're worth the time! EST. 2012

Vic Firth

Change Weapon Strength

Ok so I have read through the entire SAPP Manual, and have been looking at a bunch of different lua scripts, trying to figure out how all of this coding works, but I am still getting stuck.

I want to be able to make the golden gun on bigass final perform 1 shot kills, and adjust the bullet travel distance. Do I have to write a custom script to do this, or can it be done in events?

Anyways, any help you guys have on this would be very much appreciated. I thank you for your patience.
 

 

Share this post


Link to post
Share on other sites

Members of Open Carnage never see off-site ads.

5 hours ago, Aer said:

you could try this script and change the damage values to something ridiculously high

 

Thank you so much! @Aer You are a life saver, this is exactly what I need. However, I have been testing it out and I can't seem to get it to work though, any ideas what I might be doing wrong?

I just want the Golden Gun to do 1 Shot kills, on a server with no shields.

--Config

-- side_effect can be "none", "harmless", "lethal_to_unsuspecting", or "emp"
-- "lethal_to_unsuspecting" is the same as backtapping and is not limited to melee
DAMAGE_EFFECT_SETTINGS = {
	{
		["tag_path"] = "weapons\\pistol\\bullet gold",
		["lower_dmg"] = 1700,
		["upper_dmg"] = {
			["from"] = 1700,
			["to"] = 1700
		},
		["can_cause_headshots"] = true,
		["side_effect"] = "emp"
	},
	{
		["tag_path"] = " ",
		["lower_dmg"] = 101,
		["upper_dmg"] = {
			["from"] = 101,
			["to"] = 101
		},
		["can_cause_headshots"] = false,
		["side_effect"] = "none"
	},
}

--End of config

old_damage_settings = {}
side_effects = {
	["none"] = 0,
	["harmless"] = 1,
	["lethal_to_unsuspecting"] = 2,
	["emp"] = 3
}
api_version = "1.9.0.0"

function OnScriptLoad()
	register_callback(cb['EVENT_GAME_START'], "OnGameStart")
	register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
end

function OnGameStart()
	for k,v in pairs(DAMAGE_EFFECT_SETTINGS) do
		local dmg_effect_tag = lookup_tag("jpt!", v.tag_path)
		if(dmg_effect_tag ~= 0) then
			local dmg_effect_data = read_dword(dmg_effect_tag + 0x14)
			
			local old_data = {
				["tag_path"] = v.tag_path,
				["lower_dmg"] = read_float(dmg_effect_data + 0x1D0),
				["upper_dmg"] = {
					["from"] = read_float(dmg_effect_data + 0x1D4),
					["to"] = read_float(dmg_effect_data + 0x1D8)
				},
				["can_cause_headshots"] = read_bit(dmg_effect_data + 0x1C8, 1),
				["side_effect"] = read_byte(dmg_effect_data + 0x1C4)
			}
			table.insert(old_damage_settings, old_data)
			
			if(type(v.lower_dmg) == "number") then
				write_float(dmg_effect_data + 0x1D0, v.lower_dmg)
			end
			if(v.upper_dmg ~= nil) then
				if(type(v.upper_dmg.from) == "number") then
					write_float(dmg_effect_data + 0x1D4, v.upper_dmg.from)
				end
				if(type(v.upper_dmg.to) == "number") then
					write_float(dmg_effect_data + 0x1D8, v.upper_dmg.to)
				end
			end
			if(type(v.can_cause_headshots) == "boolean") then
				if(v.can_cause_headshots) then
					write_bit(dmg_effect_data + 0x1C8, 1, 1)
				else
					write_bit(dmg_effect_data + 0x1C8, 1, 0)
				end
			end
			if(type(v.side_effect) == "string" and type(side_effects[v.side_effect]) == "number") then
				write_byte(dmg_effect_data + 0x1C4, side_effects[v.side_effect])
			end
		end
	end
end

function OnGameEnd()
	old_damage_settings = {}
end

function OnScriptUnload()
	for k,v in pairs(old_damage_settings) do
		local dmg_effect_tag = lookup_tag("jpt!", v.tag_path)
		if(dmg_effect_tag ~= 0) then
			local dmg_effect_data = read_dword(dmg_effect_tag + 0x14)
			
			write_float(dmg_effect_data + 0x1D0, v.lower_dmg)
			write_float(dmg_effect_data + 0x1D4, v.upper_dmg.from)
			write_float(dmg_effect_data + 0x1D8, v.upper_dmg.to)
			write_bit(dmg_effect_data + 0x1C8, 1, v.can_cause_headshots)
			write_byte(dmg_effect_data + 0x1C4, v.side_effect)
		end
	end
end



 

Share this post


Link to post
Share on other sites

You are loading the script through event_start, I assume.

 

If so, you can change OnScriptLoad function to this:

function OnScriptLoad()
	register_callback(cb['EVENT_GAME_START'], "OnGameStart")
	register_callback(cb['EVENT_GAME_END'], "OnGameEnd")
	OnGameStart()
end

 

Tucker933 and Aer like this

dynamic.png

Share this post


Link to post
Share on other sites

@giraffe That worked! Oh man, thank you so much guys, both of you! I can't tell you how much I appreciate it, and I know all of the players of my server will definitely appreciate it too!

 

Edited by Vic Firth

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.