Home » Renegade Discussions » Mod Forum » Infinite Ammo Mod
Re: Infinite Ammo Mod [message #330607 is a reply to message #330572] |
Thu, 15 May 2008 02:56 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to previous message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
I'm not entirely sure, but I think it's impossible to do what you want in level edit. Someone will most likely prove me wrong now, but I'm pretty sure to do what you want to do you will have to make a new server scripts.dll file.
The infinite ammo is possible in level edit, but it would be just as easy to do that via the API aswell, using this "Enable_Infinite_Ammo();".
To make the no-reload part of the mod I would look at the following functions:
int Get_Current_Bullets(GameObject *obj); //Get loaded bullets for an objects current gun
void Set_Current_Bullets(GameObject *obj,int bullets); //Set current loaded bullets for an object
You could attach a script to a player that has a timer, on the ::Created event it does something like this:
void reb_no_reload::Created(GameObject *obj) {
Max = Get_Current_Clip_Max_Bullets(obj);
Commands->Start_Timer(obj,this,1.0f,1);
}
Then on the timer expired event check what the current bullets are for that weapon, and if they are less then then Max value, set them to Max. Something like this:
void reb_no_reload::Timer_Expired(GameObject *obj, int number) {
if(number == 1){
if(Max > Get_Current_Bullets(obj)){
Set_Current_Bullets(obj, Max);
}
}
}
Obviously Max would have to be defined in the header file, like this:
class reb_no_reload : public ScriptImpClass {
public:
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
int Max
};
This would only work if the player had one weapon only though, if he switched weapons it would mess up. To make it work with all weapons would take a little more effort... You would have to use "Get_Max_Total_Bullets(GameObject *obj,const char *weapon);" of "int Get_Position_Bullets(GameObject *obj,int position);" and the other Bullet functions that require you to tell it what gun you're talking about.
That's the way I would first look at making a no-reload mod, there is probably a better way, but i've just woken up
|
|
|
Goto Forum:
Current Time: Sat Feb 08 20:40:11 MST 2025
Total time taken to generate the page: 0.00797 seconds
|