Jump to content


Photo

[BFME2] When hero dies, how I can get him to respawn?


  • Please log in to reply
11 replies to this topic

#1 Samppu

Samppu
  • Members
  • 25 posts

Posted 21 December 2009 - 09:07 PM

Hi again, now I CANT solve this problem. I have been trying to solve it for 2 hours, please help!

So, my problem is, that I have hero, Aragorn. He's "unit name" is aragorn1, and he belongs to team "team Player1/aragorn". I have looping script named aragorn_resurrect, and it goes like this:

IF team aragorn heatlh is less or equal to 10%
--> teleport unit aragorn1 to waypoint resurrect_point
--> set "team Player1/aragorn" health 100%

But that doesn't work! Aragorn just dies! I need help with this problem, and please, that what I really wanted was that Aragorn really dies, and then spawns to resurrect_point, but when I did that, Aragorn's health was set to 1, so if there is any way to spawn a hero with he's old levels, please, tell me how to do that, but if there isn't, just tell me how to teleport and heal unit when he's health is under 10%.

If you help me, we will see Samppu's Roleplay Scenario! This is just little request for so unbelievable mod & map!

#2 Crusard

Crusard

    Local n00b

  • Project Team
  • 483 posts
  • Location:Buenos Aires, Argentina
  • Projects:Crusard's Tower Defense
  •  Poor feedback kills mapper.

Posted 22 December 2009 - 01:06 AM

This question belongs to the Worldbuilder Forum :good:

Why don't you use IF unit "aragorn1" 's heatlh is less or equal to 10% instead of team?
That will work.

Posted Image


#3 Samppu

Samppu
  • Members
  • 25 posts

Posted 22 December 2009 - 05:25 AM

Mm, okay, I will try that later, but do you have idea about how to make him respawn when he's healht reaches 0? Becuse it's little bit stupid that he cant waste he's all health, he "dumbs" that 10% from hes health :good:

#4 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 22 December 2009 - 03:03 PM

IF
Aragorn has been killed

THEN
Spawn unit 'Aragorn' of type 'MenAragorn' at waypoint 'X' on team 'teamplyr1'

This should be the kind of thing you want, but you might have to do a little more to preserve his rank.
Posted Image

#5 Crusard

Crusard

    Local n00b

  • Project Team
  • 483 posts
  • Location:Buenos Aires, Argentina
  • Projects:Crusard's Tower Defense
  •  Poor feedback kills mapper.

Posted 22 December 2009 - 04:32 PM

Once a hero has been killed, the only way to really bring them back is with a fortress. Otherwise you can just spawn a "new" aragorn and give him the levels he previously had using scripts.
I haven't used it yet, but you may want to experiment with spawning a delayed carryover unit. Maybe that works.

Posted Image


#6 Samppu

Samppu
  • Members
  • 25 posts

Posted 24 December 2009 - 02:43 AM

I have not solved this yet. I know there is a way to make new aragorn, and I have to make 50 scripts to make unit to get he's old levels back, but it gives only levels, not exp.

But, I now realized one way to get Aragorn respawning working: guys, tell me what code from INI.big I have to delete, to make Aragorn to immortal, I dunno is that right word, but make Aragorn that he cannot die, understand? Then I can just put that when hes health reaches 0. Please guys, tell me just what I have to delete from INI.big or what script I have to make to have Aragorn immortable. I have searched Aragorn's diething from aragorn.ini, but there is nothing that would help me. If I dont get this thing working, my RolePlaying map cannot be published becuse sometimes, when player got hit that all hp is gone, even my old script what just gives Aragorn health, will not work, so now please help me :good:

#7 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 24 December 2009 - 10:38 AM

I can't imagine you would need many scripts to revive him when he dies.

[ns na nd] Aragorn rank 1

IF
Unit 'Aragorn' is dying and is still on screen (CINE)
AND
Aragorn is rank '1'
THEN
Set counter 'Aragorn's rank' to '1'
Enable Script 'Aragorn revive rank 1'
Disable Script 'Aragorn rank 1'
ELSE
Disable Script 'Aragorn rank 1'

[ns na nd] Aragorn revive rank 1

IF
Unit 'Aragorn' has been killed, and has finished dying
AND
Counter 'Aragorn's rank' is 'equal to' '1'
THEN
Spawn unit 'Aragorn' at waypoint 'Aragorn Revive' on team 'Team/Player_1'
Spawn unit 'MediumRankLevelUp' at waypoint 'Aragorn Revive' on 'Team/PlyrCivilian'
Enable Script 'Aragorn dying rank detect'
Disable Script 'Aragorn revive rank 1'

[ns na nd] Aragorn dying rank detect

IF
Unit 'Aragorn' is dying and is still on screen (CINE)
THEN
Enable Script 'Aragorn rank 1'
Enable Script 'Aragorn rank 2'
Enable Script 'Aragorn rank 3'
Enable Script 'Aragorn rank 4'
Enable Script 'Aragorn rank 5'
Enable Script 'Aragorn rank 6'
Enable Script 'Aragorn rank 7'
Enable Script 'Aragorn rank 8'
Enable Script 'Aragorn rank 9'
Enable Script 'Aragorn rank 10'
Disable Script 'Aragorn dying rank detect'


Repeat first 2 scripts for all ranks, making 20 scripts, but bear in mind you are only ever changing the numbers up one and spawning another rank up object for each rank above the last.

In the interest of saving time, you could always make it so if he dies at rank 1, 2, or 3, then he will revive rank 2. Rank 4/5/6 > 5. Rank 7/8/9 > 8. Rank 10 > 10.

[ns na nd] Aragorn rank 2

IF
Unit 'Aragorn' is dying and is still on screen (CINE)
AND
Aragorn is rank '1'
OR
Unit 'Aragorn' is dying and is still on screen (CINE)
AND
Aragorn is rank '2'
OR
Unit 'Aragorn' is dying and is still on screen (CINE)
AND
Aragorn is rank '3'
THEN
Set counter 'Aragorn's rank' to '2'
Enable Script 'Aragorn revive rank 2'
Disable Script 'Aragorn rank 2'
ELSE
Disable Script 'Aragorn rank 2'

[ns na nd] Aragorn revive rank 2

IF
Unit 'Aragorn' has been killed, and has finished dying
AND
Counter 'Aragorn's rank' is 'equal to' '2'
THEN
Spawn unit 'Aragorn' at waypoint 'Aragorn Revive' on team 'Team/Player_1'
Spawn unit 'MediumRankLevelUp' at waypoint 'Aragorn Revive' on 'Team/PlyrCivilian'
Spawn unit 'MediumRankLevelUp' at waypoint 'Aragorn Revive' on 'Team/PlyrCivilian'
Enable Script 'Aragorn dying rank detect'
Disable Script 'Aragorn revive rank 2'

This way you would only need to create 10 scripts.
1) 2 dying
2) 5 dying
3) 8 dying
4) 10 dying
5) 2 revive
6) 5 revive
7) 8 revive
8) 10 revive
9) Rank detect (same as 1st revive (below) but [ns na nd])
10) 1st revive script (as they are all inactive to start):

[ns A D] First revive

IF
Unit 'Aragorn' is dying and is still on screen (CINE)
THEN
Enable Script 'Aragorn rank 2'
Enable Script 'Aragorn rank 5'
Enable Script 'Aragorn rank 8'
Enable Script 'Aragorn rank 10'

If you don't understand how this would work, please pay attention to the [ns na nd] and [ns A D] parts as they are hugely important in determining the behaviour of the script.

Edited by Puzzler33, 24 December 2009 - 10:53 AM.

Posted Image

#8 Samppu

Samppu
  • Members
  • 25 posts

Posted 24 December 2009 - 12:46 PM

Thank you for so much help, but I did know that before, as I said in my previous post. The problem in that is, that only level is set back to normal, but your experience is not, and it needs 50 scripts and little bit more. The easiest way is that tell me is that possible to disable that Aragorn dies, to make him immortal, or put some kind of "godmode" on, but just for aragorn? :good:

#9 Puzzler33

Puzzler33
  • Members
  • 226 posts

Posted 24 December 2009 - 01:05 PM

Create a unit called Aragorn on the map which is 'MenAragorn' in the object tool and go on his properties and tick indestructible. The only thing is that it seems to defeat the purpose if he can't die doesn't it?
Posted Image

#10 Crusard

Crusard

    Local n00b

  • Project Team
  • 483 posts
  • Location:Buenos Aires, Argentina
  • Projects:Crusard's Tower Defense
  •  Poor feedback kills mapper.

Posted 24 December 2009 - 01:53 PM

There is a body behavior that allows a unit to resurrect as soon as it's killed. Maybe you can mix that with a script that checks when he is killed and teleports him away.

Body = FreeLifeBody ModuleTag_FreeLifeBody   ;FreeLifeBody is a variation of RespawnBody
	MaxHealth		= FRODO_HEALTH   ;BALANCE Frodo Health
	FreeLifeHealthPercent	= 50%	   ;percentage of MaxHealth health to recover
	FreeLifeTime		= 600000   ;amount of time until we can rise from the dead again
	FreeLifeInvincible	= Yes	   ;During the RESURRECTED animation
	FreeLifePrerequisiteUpgrade = Upgrade_Chicken	   ;What upgrade is needed before I resurrect?
	FreeLifeAnimAndDuration	= AnimState:RESURRECTED AnimTime:4600;The RESURRECTED animation
	PermanentlyKilledByFilter = NONE   ;Who kills me permanently?
	DodgePercent		= 80%
End

Posted Image


#11 m@tt

m@tt

    #######

  • Project Team
  • 4,056 posts
  • Location:England
  • Projects:The Dwarf Holds
  •  T3A Chamber Member

Posted 24 December 2009 - 02:58 PM

Maybe have a script that says IF Aragorns health is <5%, then change him to Team Civilian and teleport him somewhere. Then use another script to give him all his health back and change him back to team 1. You wont see him die though.

Another possibility is to use a map.ini to change which buildings he can be respawned from. Atm, it is just NONE + KEEP. You could add a certain building, change the respawn time to 0, and then set a script saying if Aragorn does not exist, force building to build him.
Posted Image

#12 Samppu

Samppu
  • Members
  • 25 posts

Posted 24 December 2009 - 08:32 PM

There is a body behavior that allows a unit to resurrect as soon as it's killed. Maybe you can mix that with a script that checks when he is killed and teleports him away.

Body = FreeLifeBody ModuleTag_FreeLifeBody  ;FreeLifeBody is a variation of RespawnBody
	MaxHealth		= FRODO_HEALTH  ;BALANCE Frodo Health
	FreeLifeHealthPercent	= 50%	  ;percentage of MaxHealth health to recover
	FreeLifeTime		= 600000  ;amount of time until we can rise from the dead again
	FreeLifeInvincible	= Yes	  ;During the RESURRECTED animation
	FreeLifePrerequisiteUpgrade = Upgrade_Chicken	  ;What upgrade is needed before I resurrect?
	FreeLifeAnimAndDuration	= AnimState:RESURRECTED AnimTime:4600;The RESURRECTED animation
	PermanentlyKilledByFilter = NONE  ;Who kills me permanently?
	DodgePercent		= 80%
End


THANK YOU SO MUCH! I tried your all guys things, but this was the only one what did really work! Crusard, that was really helpful! Now my scenario is working really good! Thanks dude, really.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users