|
Phasor [Halo PC Infection]
|
| oxide |
Posted on 01/02/2011 00:59:19
|
Newbie

Posts: 6
Joined: 02.01.11
|
Hi,
I'm making a program for Halo PC, Phasor. Phasor does some stuff internally (hash rcon, more rcon commands etc) and does some other stuff externally, via scripts (Lua). I wanted to make an infection-style mod, but I wanted to let people customize it. That's where the script system comes in.
Phasor implements scripts either locally or globally. If a script based on the current map/gametype isn't found then a global one is loaded. The scripts have various exported functions that get called when certain events happen. The scripts can also call exposed Phasor functions. This is how I'm implementing Infection, it's a way of introducing the scripting interface.
Anyway, I'm posting here because I want ideas. What kind of things do you want to be able to do? Below are the functions that are done. Post ideas. Please.
Events (done):
[list]
[*]void OnScriptLoad(processid) - Called when the script is loaded. Process id is the parameter.
[*]void OnScriptUnload() - Called when the script is about to be unloaded.
[*]void OnNewGame(map) - Called when a new game is starting, the map name is passed.
[*]void OnGameEnd(type) - Called when a game "ends". Type specifies the event, 1 is the game just finished (still ingame F1 menu displayed), 2 is the post game, 3 is when quit shows up in post game.
[*]int OnTeamDecision(cur_team)- Called when a player is being assigned a team (as they join). cur_team is their current team and the return value is the actual team they are to join.
[*]void OnPlayerLeave(player, team) - Called when a player leaves.
[*]void OnPlayerKill(killer, victim) - Called when a player kills another player.
[*]bool OnTeamChange(relevant, player, team, dest_team) - Called when a player is changing teams. Relevant specifies whether or not the return value is considered. If relevant is 1 the return value is used to determine whether or not the player can change team.
[*]bool OnWeaponPickup(player) - Called when a player attempts to pickup a weapon. Return value determines whether or not they're allowed to.
[*]bool OnVehicleEntry(player) - Called when a player attempts to enter a vehicle. Return value determines whether or not they're allowed to.
[*]bool OnWeaponReload(player) - Called when a player attempts to reload. Return value determines whether or not they're allowed to.
[*]bool OnAmmoPickup(player) - Called when a player attempts to pickup ammo. Return value determines whether or not they're allowed to.
[*]bool OnGrenadePickup(player) - Called when a player attempts to pickup grenades. Return value determines whether or not they're allowed to.
[/list]
Planned:
[list]
[*]void OnPlayerSpawn(player) - Called when a player spawns, just after their object is assigned. You can change ammo and have it sync if done HERE.
[*]bool OnFallDamage(player) - Called when a player experiences fall damage. Return 0 to stop the fall damage.
[/list]
Exported functions that scripts can use:
[list]
[*]void hprintf(char* msg) - Writes text to the server console
[*]void changeteam(DWORD player) - Changes a player's team
[*]DWORD getteam(DWORD player) - Returns a player's current team.
[*]void setspeed(DWORD player, float speed) - Sets a player's speed (default is 1.0).
[*]void say(char* msg) - Sends a message to the server. (atm multibyte is passed and coverted into unicode, idk how to do unicode in Lua).
[*]void privatesay(DWORD player, char* msg) - Sends a server message to a specific player
[*]void registertimer(DWORD id, DWORD delay, DWORD userdata, char* callback) - Sets up a timer that calls the function 'callback' when the delay runs down. The callbacks return value is 0 or 1, 1 indicates the timer should repeat, 0 deletes the timer.
[*]char* getname(DWORD player) - Returns the multibyte representation of a player's name.
[*]char* gethash(DWORD player) - Returns a player's hashcode
[*]int getteamsize(DWORD team) - Returns the size of the specified team
[*]void svcmd(char* cmd) - Executes a server command
[/list]
Planned:
[list]
[*]void setdmgmodifier(DWORD weapon, float modifier)
[*]void sethealthmodifier(DWORD player, float modifier)
[*]DWORD getweapon(DWORD player, DWORD order)
[*]DWORD getcurrentweapon(DWORD player)
[/list] |
| |
|
|
| ninja |
Posted on 01/02/2011 07:26:41
|

Super Admin

Posts: 4174
Joined: 15.11.10
|
Why do we need this?


My brain is open.
- Paul Erdős |
| |
|
|
| oxide |
Posted on 01/02/2011 07:31:58
|
Newbie

Posts: 6
Joined: 02.01.11
|
Maybe because some people, who aren't lazy, want to customize how the server runs. Just a thought.
Edited by oxide on 01/02/2011 07:35:10 |
| |
|
|
| ninja |
Posted on 01/02/2011 07:33:29
|

Super Admin

Posts: 4174
Joined: 15.11.10
|
oxide wrote:
Maybe because some people, who aren't lazy, want to customize how the server runs. Just a thought.
Fair enough. Some of it sounds quite cool...


My brain is open.
- Paul Erdős |
| |
|
|
| ZA Googly |
Posted on 01/02/2011 11:00:19
|

Numpty

Posts: 1251
Joined: 14.11.10
|
Hmmm... I didn't totally understand the scripts themselves... but you sound like you know what you are doing so.. I'll leave this up to the leader.
I hate lag |
| |
|
|
| ZA numpty |
Posted on 01/02/2011 11:42:15
|

ShawnPeezy

Posts: 4430
Joined: 16.11.10
|
... OW MY HEAD HURTS. i have no clue what this is. im so confused. lets let slim deal with all the techy stuff. |
| |
|
|
| ZA Ice |
Posted on 01/02/2011 12:40:05
|

Wanker

Posts: 599
Joined: 16.11.10
|
Eh, I've been wanting a server tool to help control the server for zombies when there are noobs, but that's up to Slimy to get it or not.
|
| |
|
|
| FC_Cookie |
Posted on 01/02/2011 12:54:15
|

Super Admin

Posts: 358
Joined: 20.11.10
|
who is oxide??? |
| |
|
|
| ZA Ice |
Posted on 01/02/2011 12:59:17
|

Wanker

Posts: 599
Joined: 16.11.10
|
Random guy who made a zombie server scripting tool and is, from the sound of it, offering it to us by asking us what we want in it.
|
| |
|
|
| FC_SlimJim |
Posted on 01/02/2011 13:39:52
|
Super Admin

Posts: 4725
Joined: 14.11.10
|
Oxide is a halo programmer, once in SS. ive known & used his products for a while now. also, show some respect for alot of the tools that we use (more so me on behalf of you) are designed & made by oxide |
| |
|
|
| ZA Ice |
Posted on 01/02/2011 13:44:56
|

Wanker

Posts: 599
Joined: 16.11.10
|
Well he is random to me because I've never seen him before.
|
| |
|
|
| FC_Cookie |
Posted on 01/02/2011 15:06:50
|

Super Admin

Posts: 358
Joined: 20.11.10
|
FC_SlimJim wrote:
Oxide is a halo programmer, once in SS. ive known & used his products for a while now. also, show some respect for alot of the tools that we use (more so me on behalf of you) are designed & made by oxide
ok, thnx slim, i never heard about him and he just popped up so i was curious  |
| |
|
|
| RazNinjaMike |
Posted on 01/02/2011 19:37:48
|

Moderator

Posts: 4586
Joined: 20.11.10
|
nice oxide great job! |
| |
|
|
| Rabidtaco |
Posted on 01/02/2011 21:54:00
|
Senior Member

Posts: 305
Joined: 16.11.10
|
respect oxide. is that really how halo is programmed? I get the booleans and voids and stuff because I know a tiny bit, but does the code really look like that?
Member of ZÅ Feb. 19th, 2010 - May 15th, 2011

 |
| |
|
|
| FC_SlimJim |
Posted on 01/02/2011 22:02:39
|
Super Admin

Posts: 4725
Joined: 14.11.10
|
no, hes using a diff system. lua in fact is most famously used with video games like Garry's Mod. but its also used heavily in many applications. |
| |
|
|
| ZA 2 |
Posted on 01/02/2011 23:56:29
|

Numpty

Posts: 1173
Joined: 15.11.10
|
Sounds cool.. and long. lol. nice anyway

 |
| |
|
|
| oxide |
Posted on 01/03/2011 01:19:06
|
Newbie

Posts: 6
Joined: 02.01.11
|
Halo is programmed in C++ (like Phasor), the above code is some C++ function declarations. Well, tbh they're not really C++ declarations as I didn't include the argument types. Below is a C++ function.. Well more C as C++ is object oriented.
// This function gets a player's object data
LPBYTE GetObjectAddress(int mode, DWORD reqData)
{
// Make sure request data is valid
if (reqData == -1)
return 0;
WORD hi = (reqData >> 16) & 0xFFFF;
WORD lo = (reqData & 0xFFFF);
LPBYTE lpObjectList = (LPBYTE)*(DWORD*)UlongToPtr(0x744C18);
if (lo < (*(WORD*)(lpObjectList + 0x20)))
{
LPBYTE objPtr = (LPBYTE)ULongToPtr(*(DWORD*)(lpObjectList + 0x34) + (*(WORD*)(lpObjectList + 0x22) * lo));
if (!*(WORD*)objPtr)
return 0;
LPBYTE finalPtr = 0;
if (!hi)
finalPtr = objPtr;
else if (hi == *(WORD*)objPtr)
finalPtr = objPtr;
if (!finalPtr)
return 0;
if (mode < (1 << finalPtr[2]))
return (LPBYTE)*(DWORD*)UlongToPtr(finalPtr + 8);
}
return 0;
} |
| |
|
|
| ninja |
Posted on 01/03/2011 12:42:34
|

Super Admin

Posts: 4174
Joined: 15.11.10
|
I agree with the above.


My brain is open.
- Paul Erdős |
| |
|
|
| ZA Wunder Rofl |
Posted on 01/03/2011 20:14:28
|

Member

Posts: 206
Joined: 16.11.10
|
what...
 |
| |
|
|
| FC Wings |
Posted on 01/03/2011 20:25:44
|

Super Admin

Posts: 4425
Joined: 16.11.10
|
i get all of it exept this
WORD hi = (reqData >> 16) & 0xFFFF;
WORD lo = (reqData & 0xFFFF);

 |
| |
|