[script]reb_healing_arua [message #328838] |
Sat, 03 May 2008 07:15 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
I needed to make a healing arua script for cnc_reborn, but I thought the renegaders might find it useful too.
I have hard coded all the values to make it heal your own teams infantry only if they are withing 15 feet of the objects with the script attached. it heals there health only at a rate of +2 per second.
It might be nice for veteran players or perhaps as a crate, i dunno :-/
If people like it but only want to use it in level edit and change some of the values themselves then I will re-write it for that purpose and send it to Jonathan/SaberHawk/Jerad (whoever is writing the new one ).
I have another reason for posting it here, it's the first time i've dealt with the GenericSLNode * type and NodeData, it seems to me that It returns allot of objects and I have to filter most of them out, so if anyone sees some flaws in this or thinks they can make it more efficient then please post and correct me
void reb_healing_aura::Created(GameObject *obj){
Commands->Start_Timer(obj,this,1.0f,1);
}
void reb_healing_aura::Timer_Expired(GameObject *obj,int number){
if (number == 1){
int team = Get_Object_Type(obj);
Vector3 CurPosition = Commands->Get_Position(obj);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x){
GameObject *o = (GameObject *)x->NodeData;
if (o && As_ScriptableGameObj(o) && Is_Soldier(o)){
if ((Get_Object_Type(o) == team)){
Vector3 CurPositiono = Commands->Get_Position(o);
float Dist = Commands->Get_Distance(CurPosition,CurPositiono);
if(Dist <= 15.0f){
float armour = Commands->Get_Health(o);
armour += 2.0f;
if (armour > Commands->Get_Max_Health(o))
{
armour = Commands->Get_Max_Health(o);
}
Commands->Set_Health(o,armour);
}
}
}
x = x->NodeNext;
}
Commands->Start_Timer(obj,this,1.0f,1);
}
}
ScriptRegistrant<reb_healing_aura> reb_healing_aura_Registrant("reb_healing_aura","");
class reb_healing_aura : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
};
[Updated on: Fri, 30 January 2009 14:18] by Moderator Report message to a moderator
|
|
|
|
|
|
Re: reb_healing_arua [message #328905 is a reply to message #328896] |
Sun, 04 May 2008 01:09 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
rhuarc wrote on Sat, 03 May 2008 22:52 | how would i use this..?
|
Add the code to SSGM then attach it to a GameObject *.
SSnipe wrote on Sat, 03 May 2008 22:54 | is this script used for the medic by any chance?
|
Yeah, I will be adding it to him shortly, he is kinda useless as he is now, especially seeing as the technician/engineer can heal quicker...
|
|
|
Re: reb_healing_arua [message #328946 is a reply to message #328905] |
Sun, 04 May 2008 10:01 |
_SSnipe_
Messages: 4121 Registered: May 2007 Location: Riverside Southern Califo...
Karma: 0
|
General (4 Stars) |
|
|
Quote: |
Yeah, I will be adding it to him shortly, he is kinda useless as he is now, especially seeing as the technician/engineer can heal quicker...
|
lmfao
need to make it so nothing can heal infantry ONLY medic
[Updated on: Sun, 04 May 2008 10:02] Report message to a moderator
|
|
|