Aller au contenu

Photo

Respawn Question--


  • Veuillez vous connecter pour répondre
13 réponses à ce sujet

#1
Omega27

Omega27
  • Members
  • 198 messages
 Ok so heres every thing in short.
 So say the character that's playing the module, is fighting the last boss. Rather then being sent ALL the way to their *Home Base*.  I want it to be  like
If the character dies in this area "only" they respawn to an area close by. Is that clear, and possible?

#2
FunkySwerve

FunkySwerve
  • Members
  • 1 308 messages
Yes. You could do it fairly simply by setting a variable on the area, like Respawn_Waypoint, of type string, with the tag of the waypoint you want to port them to instead of 'home base'. Then, in the respawn script, check for that variable on GetArea of the respawner, and if found, use GetWaypointByTag to get the location you're respawning them to.

Funky

#3
Omega27

Omega27
  • Members
  • 198 messages
Sorry Funky for the late reply.
I think i've got that down, but just to make sure, so if i wanted an object such as an Light Shaft to be the respawn location.
make its tag say something unique like " Abyss_Respawn" ?
Then from there go to the desired area, find the respawn script and add the name?
Or is it located in Mod-Properties?

#4
Omega27

Omega27
  • Members
  • 198 messages
What do i place when in the Value spot?

#5
wyldhunt1

wyldhunt1
  • Members
  • 246 messages
It'll be the respawn script.
Without looking at your script, it's hard to say exactly how to add it.
In general, here's what you need:
1: Lightshaft with a unique tag such as Abyss_Respawn
2: Unique area tag for the boss encounter
3: Altered re-spawn script.

Or, Funkies idea would need
1: Lightshaft with a unique tag
2: String set on the area and set to the custom tag of your respawn object
3: Altered respawn script

To alter the respawn script, you'll need to look through it and find where it jumps the player to the begining of the mod. I don't play single player often, but I doubt that's default engine behavior.
There should be existing code in the respawn script that already jumps the player.
You want to integrate your change with that part.

I'd do something like:
if (GetTag(GetArea(oPC)) != "CustomAreaTag")
{
//Normal code fires to jump them to the begining
}
else
{
//Custom Code to jump player to GetObjectByTag("Abyss_Respawn")
}

If you need more than that, you may need to post your re-spawn code.
Unless you're using the default scripts, but I don't recall them doing that.

Funky was suggesting using a variable on the area, which would define the string of the objects tag..
Set any unique variable on the area as a string and set it to the tag of your spawn point.
IE: string Custom_Spawn = Abyss_Respawn
So,

if (GetLocalstring(GetArea(oPC, "Custom_Spawn")) == "")
{
//Normal code fires to jump them to the begining
}
else
{
//Custom Code to jump player to GetObjectByTag(GetLocalString(GetArea(oPC), "Custom_Spawn"))
}

EDIT: I missread Funkies idea.

Modifié par wyldhunt1, 16 décembre 2011 - 09:43 .


#6
Omega27

Omega27
  • Members
  • 198 messages
Thanks Hunt, i was able to work this one out very well.

#7
Omega27

Omega27
  • Members
  • 198 messages
Ok ok im sorry i think i lied. :(.
Could you tell my exactly where will i be placing this script


-If i follow funkies way where does it go?

#8
Omega27

Omega27
  • Members
  • 198 messages
//::///////////////////////////////////////////////
//:: 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));

}

///////////////////////////////////////////////////////////////////////
// this function resets variabls and clears the arenas in the fighter
// 'gauntlet' subplot in chapter one
///////////////////////////////////////////////////////////////////////

void ClearArena(object oPC,string sArena)
{
if(sArena == "Map_M1S4C")
{
DestroyObject(GetObjectByTag("M1S04CHRUSK02"));
DestroyObject(GetObjectByTag("M1S4CBeast"));
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4HruskDef",0);
}
else if(sArena == "Map_M1S4D")
{
DestroyObject(GetObjectByTag("M1S04CFASHI02"));
DestroyObject(GetObjectByTag("M1S4DBeast"));
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4FashiDef",0);
CreateItemOnObject("M1S04IBADGELVL01",oPC);
}
else if(sArena == "Map_M1S4E")
{
DestroyObject(GetObjectByTag("M1S04CAGAR02"));
DestroyObject(GetObjectByTag("M1S4EBeast"));
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4AgarDef",0);
CreateItemOnObject("M1S04IBADGELVL02",oPC);
}
else if(sArena == "Map_M1S4F")
{
DestroyObject(GetObjectByTag("M1S04CCLAUDUS02"));
DestroyObject(GetObjectByTag("M1S4FBeast",0));
DestroyObject(GetObjectByTag("M1S4FBeast",1));
SetLocalInt(GetObjectByTag(sArena),"NW_A_M1S4ClaudusDef",0);
CreateItemOnObject("M1S04IBADGELVL03",oPC);
}
SetLocalInt(oPC,"NW_L_M1S4Won",FALSE);
SetLocalInt(GetModule(),"NW_G_" + sArena + "_Occupied",FALSE);
}

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


void main()
{
object oRespawner = GetLastRespawnButtonPresser();
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);
//* Return PC to temple



string sDestTag = "NW_DEATH_TEMPLE";
string sArea = GetTag(GetArea(oRespawner));
/*
CHAPTER 1 SPECIAL CASE
*/
if (sArea == "MAP_M1S3B")
{
sDestTag = "M1_WIZSPAWN";
}
else
if (sArea == "Map_M1S4E" || sArea == "Map_M1S4C" || sArea == "Map_M1S4D" || sArea == "Map_M1S4F")
{
sDestTag = "M1_FIGSPAWN";
ClearArena(oRespawner,sArea);
}
else
/*
CHAPTER 2 SPECIAL CASE
*/
/*
if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oRespawner)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
{

sDestTag = "WP_M2Q2GtoM2Q2F";
}
else
*/
// * Druid Match
if (sArea == "MAP_M2Q2E2")
{
sDestTag = "WP_M2Q2E_ENDDCC";
DestroyObject(GetObjectByTag("M2Q2EWELCARFT"));
DestroyObject(GetObjectByTag("M2Q2EHENNAFT"));
DestroyObject(GetObjectByTag("M2Q2EJANKENFT"));
DestroyObject(GetObjectByTag("M2Q2EELGARFT"));
// * June 2002: Destroy pets as well
DestroyObject(GetObjectByTag("M2Q2EWELCARFTPET"));
DestroyObject(GetObjectByTag("M2Q2EHENNAFTPET"));
DestroyObject(GetObjectByTag("M2Q2EJANKENFTPET"));
DestroyObject(GetObjectByTag("M2Q2EELGARFTPET"));


SetLocalInt(GetObjectByTag("M2Q2EJAER"),"NW_M2Q2E_LFIGHT",FALSE);
}
/*
CHAPTER 3 SPECIAL CASE
*/
else
// * time travel dungeon past - Dungeon
if (sArea == "M3Q2G")
{
sDestTag = "WP_ALTERNATE_SPWN";
}
// * time travel dungeon past - Grove
else
if (sArea == "M3Q2I")
{
sDestTag = "WP_ALTERNATE_SPWN";
}
if (GetIsObjectValid(GetObjectByTag(sDestTag)))
{

if (sDestTag == "NW_DEATH_TEMPLE")
{
object oPriest = GetObjectByTag("NW_DEATH_CLERIC");
//SetLocalInt(oPriest, "NW_L_SAYONELINER", 10);

//AssignCommand(oPriest, DelayCommand(3.0,ActionStartConversation(oRespawner)));
AssignCommand(oPriest, DelayCommand(2.1, PlayVoiceChat(VOICE_CHAT_TALKTOME, oPriest)));

SetLocalLocation(oRespawner, "NW_L_I_DIED_HERE", GetLocation(GetLastRespawnButtonPresser()));
SetLocalInt(oRespawner, "NW_L_I_DIED", 1);
SetLocalObject(oPriest, "NW_L_LASTDIED", GetLastRespawnButtonPresser());
// * April 2002: Moved penalty here, only when going back to the death temple
ApplyPenalty(oRespawner);
}
object oSpawnPoint = GetObjectByTag(sDestTag);
AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
// * mak
}
else
{
// * do nothing, just 'res where you are.
}
}





I have the normal script set up right now. Its kinda simple but at the same time a major headache
dont know what would happened if i tampered with it.

#9
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Here is the script you posted, with the stuff that does nothing trimmed out and the modification that funcky sugested.

//::///////////////////////////////////////////////
//:: 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 = GetGold(oDead)/10;
// * 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);
//* Return PC to temple
  object oArea = GetArea(oRespawner);
  string sDestTag = GetLocalString(oArea,"Respawn_Waypoint");
  if (sDestTag == "" )sDestTag = "NW_DEATH_TEMPLE";
  object oPriest;
  object oSpawnPoint = GetObjectByTag(sDestTag);
  if (GetIsObjectValid(oSpawnPoint))
  {
   if (sDestTag == "NW_DEATH_TEMPLE")
   {
    oPriest = GetObjectByTag("NW_DEATH_CLERIC");
    AssignCommand(oPriest, DelayCommand(2.1, PlayVoiceChat(VOICE_CHAT_TALKTOME, oPriest)));
    SetLocalLocation(oRespawner, "NW_L_I_DIED_HERE", GetLocation(oRespawner));
    SetLocalInt(oRespawner, "NW_L_I_DIED", 1);
    SetLocalObject(oPriest, "NW_L_LASTDIED", oRespawner);
   }
   ApplyPenalty(oRespawner);
   AssignCommand(oRespawner,JumpToLocation(GetLocation(oSpawnPoint)));
  }
}

#10
Omega27

Omega27
  • Members
  • 198 messages
 oh so in truth all that extra stuff i dont need at all and is related to OC stuff?

#11
Omega27

Omega27
  • Members
  • 198 messages
do i have to make multiple copies of this for each special area

#12
ehye_khandee

ehye_khandee
  • Members
  • 855 messages
My advice is, remove all the OC stuff - THEN adjust the remaining script to suit your needs and use that ONE on enter script for every area in your module (you can differentiate how it functions based on which area the PC is actually in). Hope that makes sense. We do this with our module of over 1337 areas and it works just fine (not to mention it keeps the number of actual scripts fairly low - important in a large module. :D

Be well. Game on.
GM_ODA

#13
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Omega27 wrote...

do i have to make multiple copies of this for each special area


No,  The script only goes into the OnPlayerRespawn on the module.      Just like the original script it will default to respawning to a waypoint named  NW_DEATH_TEMPLE, unless there is a local string set on the area named Respawn_Waypoint  in that case it will Spawn the PC to the tag that Respawn_Waypoint is set to for that area.  

So if in a given area you wanted the PC to respawn to a waypoint with the Tag ALT_DEATH_1

You would edit the area properties:

Go the the advanced tab and Click the variables button.
Give your varaiable a name of:  Respawn_Waypoint
Give it a Type of:                            String
and a Value of :                             ALT_DEATH_1
and hit the add button.

then you just need to make sure that you have only one valid Object  with that tag in the module.  

#14
Omega27

Omega27
  • Members
  • 198 messages
Oh thank you both so! much very helpful!! Im such a newbie at scripting -.-'