Author Topic: Onrespawn help  (Read 342 times)

Legacy_seventh_son

  • Jr. Member
  • **
  • Posts: 74
  • Karma: +0/-0
Onrespawn help
« on: January 17, 2011, 01:32:23 am »


               I am looking for a script that when a player dies and clicks to respawn they are sent to a temple near them...

In the same area is ok, as I can set safe respawn rooms in all areas. but with the standard deathtemple, there is only on respawn location, and I want to be able to respawn somewhere near the location I was killed at.

Any ideas? 
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Onrespawn help
« Reply #1 on: January 17, 2011, 02:37:17 am »


               one issue is know what areas are close to what respawn locations:

you can fix this one way buy putting a variable on your area with the tag of the way point, then altering respawn script.

or alter respawn script to see what area in then decide but I have a script for you let me test it then I will post it....

Edit add...script:

//::///////////////////////////////////////////////
//:: Generic On Pressed Respawn Button
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
// * June 1: moved RestoreEffects into plot include
*/
//:://////////////////////////////////////////////
//:: Created By:   Brent
//:: Created On:   November
//:://////////////////////////////////////////////
#include "nw_i0_plot"

// * Applies an XP and GP penalty
// * to the player respawning
void ApplyPenalty(object oDead)
{
    int nXP = GetXP(oDead);
    int nPenalty = 50 * GetHitDice(oDead);
    int nHD = GetHitDice(oDead);
    // * You can not lose a level with this respawning
    int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

    int nNewXP = nXP - nPenalty;
    if (nNewXP < nMin)
       nNewXP = nMin;
    SetXP(oDead, nNewXP);
    int nGoldToTake =    FloatToInt(0.10 * GetGold(oDead));
    // * a cap of 10 000gp taken from you
    if (nGoldToTake > 10000)
    {
        nGoldToTake = 10000;
    }
    AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));
    DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));
    DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));

}


//////////////////////////////////////////////////////////////////////////////


void main()
{
    object oRespawner = GetLastRespawnButtonPresser();
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
    RemoveEffects(oRespawner);

//NOTE: Be sure to have a string variable on your areas called "respawn_loc"
// then have that variable match the closest respawn loc. or this case a waypoint "wp_respwn1"
    string sArea = GetTag(GetArea(oRespawner));
    string sObjWay=GetLocalString(GetArea(oRespawner),"respawn_loc");
    object oSpawnPoint = GetObjectByTag(sObjWay);

       AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));

}
               
               

               


                     Modifié par Greyfort, 17 janvier 2011 - 02:42 .
                     
                  


            

Legacy_seventh_son

  • Jr. Member
  • **
  • Posts: 74
  • Karma: +0/-0
Onrespawn help
« Reply #2 on: January 17, 2011, 02:41:42 am »


               yeah, I feel bad that I posted this when shortly after it was posted I found something close to what I wanted on the vault... but thanks for the quick reply.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Onrespawn help
« Reply #3 on: January 17, 2011, 02:45:53 am »


               Well I posted it if ya need it