Author Topic: Respawn script?  (Read 7836 times)

Offline fireknight40

  • Sr. Member
  • ****
  • Posts: 277
    • MSN Messenger - fireknight40@hotmail.com
    • AOL Instant Messenger - fireknight40
    • Yahoo Instant Messenger - briortheforesaken
    • View Profile
    • http://members.dslextreme.com/users/fierynight3/Iceys%20Hints%20and%20Tips.htm
    • Email
Respawn script?
« on: January 06, 2005, 01:02:57 AM »
I need s script that will repawn people after they die. maybe about 5 seconds after death...

Lord of Doriath[/span]
[span style=\'color:blue\']Sentinel of GodSpire[/color]

Offline CleTus

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • http://
Respawn script?
« Reply #1 on: January 06, 2005, 05:43:03 AM »
This script is very simple.. Goes OnDeath in module properties.. If you want me to add a. You've been slain by or you have slain type message... Just say something.. Or a res/death effect.. Also I added a ForceRest in there to get spells back and stuff.. I assume you have a PvP server.. If not just remove it.


Code: [Select]
void main()
{
object oPC = GetLastPlayerDied();
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC));
DelayCommand(5.0,ForceRest(oPC));
}
« Last Edit: January 06, 2005, 05:45:11 AM by CleTus »
GIT-R-DONE!

Light travels faster than sound. That is why some people appear bright until you hear them speak.

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
Respawn script?
« Reply #2 on: January 06, 2005, 07:10:36 AM »
For a pvp you might also do a loop te remove effects that still could be there from the player, like strenght decrease or drain level. You can use a while loop for that.

-Mel

Offline CleTus

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • http://
Respawn script?
« Reply #3 on: January 06, 2005, 08:43:57 AM »
Quote
For a pvp you might also do a loop te remove effects that still could be there from the player, like strenght decrease or drain level. You can use a while loop for that.

-Mel
[snapback]14987[/snapback]

Doesn't death remove all effects?
GIT-R-DONE!

Light travels faster than sound. That is why some people appear bright until you hear them speak.

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
Respawn script?
« Reply #4 on: January 06, 2005, 08:59:21 AM »
Quote
Quote
For a pvp you might also do a loop te remove effects that still could be there from the player, like strenght decrease or drain level. You can use a while loop for that.

-Mel
[snapback]14987[/snapback]

Doesn't death remove all effects?
[snapback]15007[/snapback]
Not really, you can give someone a visual effect and keep that even when he dies/respawn for example. In most cases there's no problem as you do lose the spelleffects ondeath, but to be sure I always remove all effect I don't like them to have on respawn. As not all effects come from spells.

Still I might be wrong with this, to be sure you'll have to test :P

-Mel

Offline CleTus

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • http://
Respawn script?
« Reply #5 on: January 06, 2005, 09:25:53 AM »
Ok.. Better safe than sorry I guess.. I got the remove ffects striaght out of Lexicon so it should work..



Code: [Select]
void main()
{
object oPC = GetLastPlayerDied();
effect eBad = GetFirstEffect(oPC);
DelayCommand(5.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPC));
DelayCommand(5.0,ForceRest(oPC));

 while(GetIsEffectValid(eBad))
        {
            if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE ||
                GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS ||
                GetEffectType(eBad) == EFFECT_TYPE_DEAF ||
                GetEffectType(eBad) == EFFECT_TYPE_PARALYZE ||
                GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL)
                {

                    RemoveEffect(oPC, eBad);
                }
            eBad = GetNextEffect(oPC);
        }
        }
GIT-R-DONE!

Light travels faster than sound. That is why some people appear bright until you hear them speak.

Offline nathan

  • Sr. Member
  • ****
  • Posts: 296
    • View Profile
    • Email
Respawn script?
« Reply #6 on: January 06, 2005, 01:51:11 PM »
can you make it remove hostle, when you die it removes hostle if your hostle with anybody...

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
Respawn script?
« Reply #7 on: January 06, 2005, 03:52:48 PM »
Quote
can you make it remove hostle, when you die it removes hostle if your hostle with anybody...
[snapback]15038[/snapback]
Don't know if that's a good idea to host/unhost with pc's. Setting the faction back to neutral seems fine. But hostile setting with pc's can interrupt actions going on. It's 1 of the reazons why the cutscene get used to freeze someone and not just petrify.

-Mel

Offline CleTus

  • Full Member
  • ***
  • Posts: 234
    • View Profile
    • http://
Respawn script?
« Reply #8 on: January 07, 2005, 01:59:40 AM »
Quote
can you make it remove hostle, when you die it removes hostle if your hostle with anybody...
[snapback]15038[/snapback]

I don't really know what Mel means.. er...

Anyways.. Just add..
object oKiller = GetLastKiller();   <---- That goes on the top..

SetPCLike(oKiller ,oPC);
GIT-R-DONE!

Light travels faster than sound. That is why some people appear bright until you hear them speak.

Offline Tea-cup

  • Hero Member
  • *****
  • Posts: 916
    • View Profile
Respawn script?
« Reply #9 on: January 07, 2005, 03:05:34 AM »
Quote
Quote
can you make it remove hostle, when you die it removes hostle if your hostle with anybody...
[snapback]15038[/snapback]

I don't really know what Mel means.. er...

Anyways.. Just add..
object oKiller = GetLastKiller();   <---- That goes on the top..

SetPCLike(oKiller ,oPC);
[snapback]15075[/snapback]
That post I did was just a little tip about a side effect of changing hostile settings.

Just try this: let someone attack something (melee, spell, doesn't matters) then while he's attacking, hostile/unhostile. You'll see that the other will stop attacking. Even won't be able to do anythung but moving/talking as long you keep going setting hostile/unhostile.

I just want to point out that if you let a script set hostile setting. Make sure you're not going to interrupt players on wrong moments. Because that may be something you don't want.

In case of a duel for example you could add a check if the player is in combat and make the script wait with changing the hostile setting till the player isn't in combat anymore.

Poeple somethimes use this effect to be irritating. They can make a other player stop all the time by spamming the like/dislike button in the playerlist. Because some tend to do that when they are banned to jail, it's better to cutscene them. Then they can't acces the player menu :P

I'm just giving a few notes/tips, they aren't anything critical for the main function of a respawn script, but they are usefull to know.

-Mel

Offline fireknight40

  • Sr. Member
  • ****
  • Posts: 277
    • MSN Messenger - fireknight40@hotmail.com
    • AOL Instant Messenger - fireknight40
    • Yahoo Instant Messenger - briortheforesaken
    • View Profile
    • http://members.dslextreme.com/users/fierynight3/Iceys%20Hints%20and%20Tips.htm
    • Email
Respawn script?
« Reply #10 on: January 07, 2005, 12:19:25 PM »
Thank you. :) And you're semi right about the PVP server it's actually my clan server. It has a few arenas in it.

Lord of Doriath[/span]
[span style=\'color:blue\']Sentinel of GodSpire[/color]