|
|
Re: Script Request [message #315023 is a reply to message #315015] |
Fri, 01 February 2008 16:11 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
Zion Fox wrote on Fri, 01 February 2008 15:42 | Changing team will reset the score and credits won't it?
|
Not necessarily. ^,^
Console command: team2 <id> <teamid>
or...call it directly ("team2"/"team" console commands just call the following function when they're used)
void Change_Team_By_ID(int PlayerID,int Team);
Anyway, I'll see if I can do something. :v
~Zack
|
|
|
Re: Script Request [message #315082 is a reply to message #314997] |
Sat, 02 February 2008 02:56 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
There are many ways to win a normal game that cannot be predicted...
For instance, if someone destroys the last building controller the game ends immediately.
Unless the only way to win your map is by the time ending I don't really see how it would be possible.
|
|
|
Re: Script Request [message #315100 is a reply to message #315082] |
Sat, 02 February 2008 04:44 |
|
Mad Ivan
Messages: 513 Registered: February 2003 Location: United Kingdom
Karma: 0
|
Colonel |
|
|
reborn wrote on Sat, 02 February 2008 11:56 | There are many ways to win a normal game that cannot be predicted...
For instance, if someone destroys the last building controller the game ends immediately.
Unless the only way to win your map is by the time ending I don't really see how it would be possible.
|
The current design is time ending-based only.
My LinkedIn profile
|
|
|
Re: Script Request [message #315112 is a reply to message #314997] |
Sat, 02 February 2008 06:41 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Then using the cGameData class ("unsigned int TimeLimit_Minutes;" and "float TimeRemaining_Seconds;" along with "char *MapName;"), you could add some code to the server to determine how long the map has left to play, and if it is 2 seconds left, aswell as being your actual map that's being played, then do something similar to what Zack described.
If Zack doesn't do it for you then I will. But please note to actually run this map server owners would have you use this custom scripts.dll.
There are probably other ways using irc scripts and such, but this is the only way that I know of to ensure it works properly as you want it to.
|
|
|
Re: Script Request [message #315126 is a reply to message #314997] |
Sat, 02 February 2008 10:29 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
#include "engine.h"
#include "scripts.h"
#include "zbl.h"
void zbl_MVP_Script::Created(GameObject *obj)
{
timeLeft = The_Game()->TimeRemaining_Seconds;
Commands->Start_Timer(obj, this, 1.0f, 123); //every 30seconds check for time remaining
}
void zbl_MVP_Script::Timer_Expired(GameObject *obj, int number)
{
if (number == 123)
{
timeLeft = The_Game()->TimeRemaining_Seconds;
if (timeLeft <= 2) {
float score; int ID;
for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext)
{
GameObject *Player = (GameObject *)PlayerIter->NodeData;
int i = Get_Player_ID(Player);
score = Get_Score(i);
if (Get_Score(i) > score) {
ID = i;
}
}
for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext)
{
GameObject *Player = (GameObject *)PlayerIter->NodeData;
int i = Get_Player_ID(Player);
if (i == ID) {
Change_Team_By_ID(i, 1);
char Msg1[150];
sprintf(Msg1, "ppage %d You are being changed to team GDI for being the current MVP", i);
Console_Input(Msg1);
delete []Msg1;
}
else {
Change_Team_By_ID(i, 0);
char Msg1[150];
sprintf(Msg1, "ppage %d You are being changed to team Nod for not being the MVP for the current map.", i);
Console_Input(Msg1);
delete []Msg1;
}
}
}
else {
Commands->Start_Timer(obj, this, 1.0f,123);
}
}
}
ScriptRegistrant<zbl_MVP_Script> zbl_MVP_Script_Registrant("zbl_MVP_Script", "");
----------------------------------
class zbl_MVP_Script : public ScriptImpClass {
void Created(GameObject *obj);
void Destroyed(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
float timeLeft;
};
----------------------------------
**Note: Untested.
Usage: Create an invisible object or a dave's arrow on every map you want to use this script on and attach this script to it.
If it doesn't work, which I doubt , I'm sure reborn will help you out.
~Zack
[Updated on: Sat, 02 February 2008 10:32] Report message to a moderator
|
|
|
Re: Script Request [message #315140 is a reply to message #314997] |
Sat, 02 February 2008 12:04 |
|
Mad Ivan
Messages: 513 Registered: February 2003 Location: United Kingdom
Karma: 0
|
Colonel |
|
|
Thank you, Zack and Reborn!
I will see if i can find someone to test it out on LAN tomorrow and see the results but if something turns out wrong (which i doubt) I'll post here. Unfortunately my C++ knowledge is limited to operating with doubles/floats, integers, loops, matrices and strings ("High-School C++" so to say + some VERY limited ASM) as well as vague Structures, Classes and functions knowledge, so making my own scripts or figuring out bugs is currently out of the question (unless i can find some time and someone to tutor me the "advanced" stuff as well as how to actually make my own scripts or do anything programming-related to Renegade).
Reborn, since you noted, will this work if it's client-side only?
Also, Zack, do you mind if I use this in C&C Reborn maps?
My LinkedIn profile
[Updated on: Sat, 02 February 2008 12:08] Report message to a moderator
|
|
|
Re: Script Request [message #315141 is a reply to message #315140] |
Sat, 02 February 2008 12:15 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
Mad Ivan wrote on Sat, 02 February 2008 12:04 | Also, Zack, do you mind if I use this in C&C Reborn maps?
|
Doesn't matter to me. I released the source publicly for anyone to use... :v
~Zack
|
|
|
Re: Script Request [message #315163 is a reply to message #315140] |
Sat, 02 February 2008 17:28 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Mad Ivan wrote on Sat, 02 February 2008 14:04 |
Reborn, since you noted, will this work if it's client-side only?
|
Changing teams and such is server side, this would only work on a server running Zack's script.
|
|
|