OK...I need help with the blood.....again...

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

OK...I need help with the blood.....again...

Post by metal_head »

I got a really cool blood spray exlosion.I tried to make it when a pawn is hit,it sprays blood,but I only managed to do that when the pawn is in PainOrder.I'm working with the genericmissile.s scirpt and I want it to be when a bullet touches the pawn blood is sprayed without showing pain,just every time a pawn is hit a blood is sprayed.I really need help and I'll be happy if you just tell me what to do,but I won't understand so please can you write that command and tell me where in the genericmissile.s to put it. :oops: Just don't know where to put the AddEXplosion command
User avatar
QuestOfDreams
Site Admin
Posts: 1520
Joined: Sun Jul 03, 2005 11:12 pm
Location: Austria
Contact:

Re: OK...I need help with the blood.....again...

Post by QuestOfDreams »

Well, I think the pain orders (IdlePain, AlertPain) would be the right places to put your blood effect. If you don't want the pawn to play a pain animation, just remove the switch statements in these functions. IdlePain is called every time the pawn is hit (100%), AlertPain is only called half of the time (50%). To change the latter just set the PAINPERCENT variable to 100.
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: OK...I need help with the blood.....again...

Post by metal_head »

I don't know how to thank you!!! Everything is great,just I don't know why the enemy stops for a while,when bleeding,but I'll try to fix it and if I can't I'll let you know. !!!Many Thanks!!!
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: OK...I need help with the blood.....again...

Post by metal_head »

OK,now maybe I still have a little problem.When I shoot at the pawn blood is spilled,but the pawn stops walking when bleeding.
Here's What I did:

Code: Select all

dlePain[ ()
	
		}
		SetEventState(ALERTTRIGGER, true);	// set trigger to go to alert
		Return();
	} ]	

	// start shifting from idle to alert

	IdleToAlert[ ()
	{
		FindTargetOrder(ALERTSIGHTDIST, "FoundTarget", DAMAGEATTRIBUTE);	// increase viewing 

distance
		AddPainOrder("AlertPain", PAINPERCENT);			// show pain
		AddTimerOrder(1, 10, "AlertToIdle");			// go to idle after 10 secs
		SetEventState(ALERTTRIGGER, false);		// turn off alert trigger
		NewOrder("Alert");
	} ]

	// look around at alert looking for enemy

	Alert[ ()
	{
		PlayAnimation(STAND, true, "");
		if(random(1,10)>3) // turn around once in awhile
		{
			if(random(1,10)>5)
			{
				Rotate(TURNL, 102, 0, 90, 0, "");
				Rotate(TURNL, 102, 0, 90, 0, "");
				Rotate(TURNL, 102, 0, 90, 0, "");
				Rotate(TURNL, 102, 0, 90, 0, "");
			}
			else
			{
				Rotate(TURNR, 108, 0, -90, 0, "");
				Rotate(TURNR, 108, 0, -90, 0, "");
				Rotate(TURNR, 108, 0, -90, 0, "");
				Rotate(TURNR, 108, 0, -90, 0, "");
			}
		}
		RestartOrder();
	} ]	

	// show pain at alert

	AlertPain[ ()
		
                }
		Return();
	} ]	

	// timed out at alert so go to idle

	AlertToIdle[ ()
	{
		FindTargetOrder(SIGHTDIST, "FoundTarget", DAMAGEATTRIBUTE);	// decrease viewing distance
		AddPainOrder("IdlePain", 100);				// show pain 
		AddTriggerOrder("IdleToAlert", ALERTTRIGGER, 0);	// go to alert when triggered
		NewOrder("Idle");
	} ]

	// found a target to attack

	FoundTarget[ ()
	{
		DelTimerOrder(1);	// get rid of alert timer
		LowLevel(RUNFUNC);	// attack functions are low level
	} ]

	// lost target while attacking so go back to idle again

	LostTarget[ ()
	{
		FindTargetOrder(SIGHTDIST, "FoundTarget", DAMAGEATTRIBUTE);	// seen a target to chase
		AddPainOrder("IdlePain", 100);				// show pain and trigger alert
		AddTriggerOrder("IdleToAlert", ALERTTRIGGER, 0);	// go to alert when triggered
		NewOrder("Idle");
	} ]

	// you died

	Death[ ()
	{
		DelTimerOrder(1);	// remove alert timer
		AddPainOrder("IdlePain", 0);	// remove pain order
		FindTargetOrder(0, "FoundTarget", DAMAGEATTRIBUTE);	// remove target finding
		DelTriggerOrder("IdleToAlert");	// remove alert trigger
		SetNoCollision();	// remove bounding box so there are no collisions with corpse
		switch(random(1,4)) // chose between 4 death animations
		{
			case 1
			{
				AnimateStop(DIE, DIEHOLD, "");
			}
			case 2
			{
				AnimateStop(DIE1, DIEHOLD, "");
			}
			case 3
			{
				AnimateStop(DIE2, DIEHOLD, "");
			}
			case 4
			{
				AnimateStop(DIE, DIEHOLD, "");
			}
		}
		FadeOut(DIEFADE, 0); // fade out corpse
		Remove(true);	// remove actor
	} ]

	// Low level attack routines

	// Start of run to attack

	monster_run_start[ ()
	{
		Animate(RUN);					// play run animation
		self.ThinkTime = 0;				// start thinking on next frame
		self.think = "monster_run";		// go to run attack routine
		self.ideal_yaw = enemy_yaw;		// set direction to run
		self.yaw_speed = YAWSPEED;		// set rotation speed
		back_up = false;				// initialize obsticle avoidance
		attack_state = AS_NONE;			// not attacking yet
	} ]

	// run to enemy to attack

	monster_run[ ()
	{
		self.ThinkTime = 0.1;
		if(self.health<=0)
		{
			HighLevel("Death"); // dead
			return 0;
		}
		if((self.in_pain = true) and (random(1,100)<PAINPERCENT))
		{
			self.think = "monster_run_pain_start"; // in pain
			return 0;
		}
		if(EnemyExist(DAMAGEATTRIBUTE) < 3)
		{
			HighLevel("LostTarget"); // enemy is gone or dead
			return 0;
		}
		if(enemy_vis = false)
		{
			self.think = LOSTFUNC; // lost sight of enemy
			lost_time = time + LOSTTIME;
			return 0;
		}
		ai_run(random(RUNSPEED-2,RUNSPEED+2)); // run toward enemy
	} ]

	// start of pain while running

	monster_run_pain_start[ ()
	{
		
                AddExplosion("headshot",GetLastBoneHit(),0,0,0);
		SetHoldAtEnd(true);	// set to stop at animation end
		self.ThinkTime = 0.1;
		self.think = "monster_run_pain";
	} ]

	// wait for animation to stop

	monster_run_pain[ ()
	{
		self.ThinkTime = 0.1;
		if(self.animate_at_end = true) // wait for end of animation
		{
			self.think = "monster_run_start"; // start running again
			SetHoldAtEnd(false); // remove animation stop
			self.ThinkTime = 0;
		}
	} ]
Post Reply