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

Sign in to follow this  
Followers 0
giraffe

Damage Module

Posted (edited)

Since SAPP does not include a damage function, you can use this module to damage objects/players in your lua script.

 

To use this module, add this to the start of your lua script:

ffi = require("ffi")
ffi.cdef [[
	void damage_object(float amount, uint32_t receiver, int8_t causer);
	void damage_player(float amount, uint8_t receiver, int8_t causer);
]]
damage_module = ffi.load("damage_module")
damage_object = damage_module.damage_object
damage_player = damage_module.damage_player

 

The damage_object and damage_player functions take 3 arguments: Amount, Receiver, and Causer.

 

Amount is the amount of damage to apply.

Receiver is the ObjectID or PlayerIndex (1 to 16) depending on which function you use.

Causer can be a PlayerIndex (1 to 16), or one of the following:

  • 0 for no cause
  • -1 for the guardians
  • -2 for a vehicle
  • -3 for suicide
  • -4 for betray self

 

Example script that has "the guardians" constantly damaging all players:

ffi = require("ffi")
ffi.cdef [[
	void damage_object(float amount, uint32_t receiver, int8_t causer);
	void damage_player(float amount, uint8_t receiver, int8_t causer);
]]
damage_module = ffi.load("damage_module")
damage_object = damage_module.damage_object
damage_player = damage_module.damage_player

api_version = "1.9.0.0"

function OnScriptLoad()
	register_callback(cb['EVENT_TICK'], "OnTick")
end

function OnTick()
	for i=1,16 do
		if(player_present(i)) then
			damage_player(0.7, i, -1)
		end
	end
end

function OnScriptUnload() end

 

Video:

 

 

Extract damage_module.dll to the same directory as your halo server executable.

Download: https://mega.nz/#!C0cy2CzS!i-38PcB96dUvXUSuvQalFKZXzfbhwQOSsOFbadJtSc8

 

 

Edited by giraffe
(SBB) Storm, Java and Tucker933 like this

dynamic.png

Share this post


Link to post
Share on other sites

Members of Open Carnage never see off-site ads.

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
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.