Home » Renegade Discussions » Mod Forum » crate question
Re: crate question [message #270989 is a reply to message #270832] |
Thu, 05 July 2007 14:48 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
You are going off topic with another question, you havn't even sorted this problem yet. You do this all the time, you drag me into more and more questions (which is my fualt for letting you, but I am a problem solver by nature and can't help myself sometimes).
I am going to stick with the crate question.
It seems to me that you are again just asking me to write the code for you, then you slap it into your mod.
You have a few options here
//Option one
If you want a quick and easy solution then just make the first crate only spawn after 200 seconds, regardless of it's type. To do this just go to the code shown here:
void Crate_Level_Loaded() {
int Total = Settings->CrateDeath + Settings->CrateVehicle + Settings->CrateWeapon + Settings->CrateCharacter + Settings->CrateMoney + Settings->CratePoints + Settings->CrateTiberium + Settings->CrateAmmo + Settings->CrateHealth + Settings->CrateArmor + Settings->CrateRefill + Settings->CrateButterFingers + Settings->CrateSpy + Settings->CrateThief + Settings->CrateBeacon + Settings->CrateStealth;
if (Total != 100) {
Crate_Defaults();
FDSMessage(StrFormat("Total crate percentages equal %d instead of 100. Using default percentages.",Total),"_ERROR");
}
Data->CrateLastPickup = -181;
Data->CrateExists = false;
Data->CrateID = 0;
}
Then on the line " Data->CrateLastPickup = -181;" change the value to "20". This will mean that a crate will not spawn on the map for 200 seconds.
//Option two
Just delete the crate if it tries to spawn a money crate within 200 seconds of the map starting.
To do this you will need to modify the script "void MDB_SSGM_Crate::Created(GameObject *obj) {" shown here:
void MDB_SSGM_Crate::Created(GameObject *obj) {
PickedUp = false;
if (!Settings->EnableCrates || Settings->GameMode == 3 || Settings->GameMode == 4) {
Commands->Destroy_Object(obj);
return;
}
else if (Settings->EnableCrates && Settings->EnableNewCrates) {
if (Data->CrateExists || (The_Game()->GameDuration_Seconds - Data->CrateLastPickup) < 180) {
Commands->Destroy_Object(obj);
return;
}
Data->CrateExists = true;
Commands->Set_Model(obj,"vehcol2m");
}
Set_Is_Powerup_Persistant(obj,true);
Set_Powerup_Always_Allow_Grant(obj,true);
Set_Powerup_Grant_Sound(obj,0);
}
Ok, now you see the two lines:
if (Data->CrateExists || (The_Game()->GameDuration_Seconds - Data->CrateLastPickup) < 180) {
Commands->Destroy_Object(obj);
Well that basically says (assuming you are running aow mode and have the new crates enabled in the .ini file) that if a crate is spawned within 180 seconds of the last crate being spawned then it destroys it (that why in the previous option i told you to initialise the crate last pickup as 20, because the server would do (0-20), giving -20, so it would be another 180 seconds plus the 20 extra so 200 until it allowed a crate to spawn. Left at -181 it means a crate can spawn on map load and 3 mins thereafter).
This code sounds similar to what you want right?
So what I would do is study that code and copy/paste it and adapt it to my needs.
All you have to do is add a few lines under those two lines under an if syntax saying if the gameduration is less then 200 ("if(The_Game()->GameDuration_Seconds < 200)") and the crate happens to be a money crate, then destroy the object.
//Option three
I really can't be bothered to go on anymore... But there are allot more ways you can do this. Probably all of them more efficient then I have show, but none simpler (other then removing the crate completely).
Now I am pretty sure you are going to want to go with option two. And in anticipation of you asking what exactly is the code to add and where exactly to add it, word for word, operator for operator and line for line. I am going to encourage you to work it out yourself
|
|
|
Goto Forum:
Current Time: Sat Dec 21 18:12:19 MST 2024
Total time taken to generate the page: 0.01272 seconds
|