summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/Rules.c4d/OutFader.c4d/Script.c
blob: de61ef5794140da873d07a204a51878fe9a697bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*-- Out-Fader --*/

#strict 2

protected func Activate(iByPlayer) 
{
  MessageWindow(GetDesc(), iByPlayer);
  return(1);
}

func Fading(iPlr)
{
	for (var obj in FindObjects(Find_OCF(OCF_InFree | OCF_InSolid | OCF_InLiquid),Find_Category(C4D_Object | C4D_Living)))
	if (!ImportantID(GetID(obj)))
	{
		if (GetAction(obj)=="Idle")
		{
			// Object owned by anyone?
			if (GetOwner(obj)== -1) FadeOut(obj,2);
			else FadeOut(obj,3);
		}
		else if (!GetAlive(obj))
		{
			if (GetOwner(obj)== -1) FadeOut(obj,1);		
			else FadeOut(obj,5);
		}
		else if (GetAction(obj)=="Be")
		{
			if (GetOwner(obj)== -1) FadeOut(obj,2);		
			else FadeOut(obj,3);
		}
		else if (GetAction(obj)=="None")
		{
			if (GetOwner(obj)== -1) FadeOut(obj,2);		
			else FadeOut(obj,3);
		}
		else if (GetAction(obj)=="Exist")
		{
			if (GetOwner(obj)== -1) FadeOut(obj,2);		
			else FadeOut(obj,3);
		}
	}
 return(1);
}


global func FadeOut(pObj,iTime)
{
 if (!iTime) iTime=2;
 if (!pObj) pObj=this;
 if (GetEffect("FadeOut",pObj)) return(0);
 AddEffect("FadeOut",pObj,200,iTime,0,OFDR);
 return(1);
}

func FxFadeOutStart(pTarget,iEffectNumber)
{
 EffectVar(0,pTarget,iEffectNumber)=255;
 return(1);
}

func FxFadeOutStop(pTarget,iEffectNumber)
{
 SetClrModulation(RGBpA(GetClrModulation(pTarget) || RGB(255, 255, 255)),pTarget);
 return(1);
}

func FxFadeOutTimer(pTarget,iEffectNumber)
{ 
 if (!pTarget) return(-1);
 if (Contained(pTarget) || pTarget->~AvoidFadeOut()) return(-1);
 EffectVar(0,pTarget,iEffectNumber)--;
 if (!EffectVar(0,pTarget,iEffectNumber)) RemoveObject(pTarget);
 SetClrModulation(RGBpA(GetClrModulation(pTarget) || RGB(255, 255, 255), 255-EffectVar(0,pTarget,iEffectNumber)),pTarget);
 return(1);
}

global func ImportantID(idObj) { return 0; }