Aller au contenu

Photo

Death Scripting Across Campaign Modules


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

#1
MokahTGS

MokahTGS
  • Members
  • 946 messages
Original Thread: Click Here!

I had a module that has a custom death script that sends the player to a waypoint on respawn which was working just fine until I separated the module into multiple modules across a campaign. Now the script has ceased to work.

Here's the script:

//::///////////////////////////////////////////////
//:: Mokah's Module Death Script
//:: NW_O0_DEATH.NSS
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
This script handles the default behavior
that occurs when a player dies.

BK: October 8 2002: Overriden for Expansion
*/
//:://////////////////////////////////////////////
//:: Created By: Brent Knowles
//:: Created On: November 6, 2001
//:://////////////////////////////////////////////
// BMA-OEI 7/20/06 -- Temp death screen
// BMA-OEI 11/08/06 -- Added engine death GUI: SCREEN_DEATH_DEFAULT (ingamegui.ini) is force closed upon resurrection
const string GUI_DEFAULT_DEATH_SCREEN = "SCREEN_DEATH_DEFAULT";
// Resurrect and remove negative effects from oPlayer
void Raise( object oPlayer );
// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer );
void main()
{
object oPlayer = GetLastPlayerDied();
location lLoc = GetLocation(GetWaypointByTag("wp_jw_death"));
// * increment global tracking number of times that I died

int iQuest = GetLocalInt(oPlayer,"NW_JOURNAL_ENTRYjw_jr_011");

if (iQuest < 30)
{
DelayCommand( 2.5f, Raise(oPlayer));
DelayCommand( 2.6f, AssignCommand(oPlayer,JumpToLocation(lLoc)));
SetLocalInt(oPlayer,"NW_JOURNAL_ENTRYjw_jr_011",iQuest+10);
}
else
{
EndGame("");
}
}
void ClearAllFactionMembers(object oMember, object oPlayer)
{
// AssignCommand(oMember, SpeakString("here"));
AdjustReputation(oPlayer, oMember, 100);
SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
object oClear = GetFirstFactionMember(oMember, FALSE);
while (GetIsObjectValid(oClear) == TRUE)
{
ClearPersonalReputation(oPlayer, oClear);
oClear = GetNextFactionMember(oMember, FALSE);
}
}
// Resurrect and remove negative effects from oPlayer
void Raise(object oPlayer)
{
effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION);

effect eBad = GetFirstEffect(oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oPlayer);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oPlayer)), oPlayer);

//Search for negative effects
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)
{
//Remove effect if it is negative.
RemoveEffect(oPlayer, eBad);
eBad = GetFirstEffect(oPlayer);
}
else
eBad = GetNextEffect(oPlayer);
}
//Fire cast spell at event for the specified target
SignalEvent(oPlayer, EventSpellCastAt(OBJECT_SELF, SPELL_RESTORATION, FALSE));
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oPlayer);
}
// Display death pop-up to oPlayer
void ShowDefaultDeathScreen( object oPlayer )
{
DisplayGuiScreen( oPlayer, GUI_DEFAULT_DEATH_SCREEN, FALSE );
//DisplayMessageBox( oPlayer, 0, GetStringByStrRef(181408), "gui_death_respawn_self", "", FALSE, "", 6603, "", 0, "" );
}


Can someone show me how to make this work across campaign modules? The waypoint in question is in a specific module so the script is having issues with this.

Modifié par MokahTGS, 19 juillet 2010 - 10:12 .


#2
Shallina

Shallina
  • Members
  • 1 011 messages
Resurect the player before jumping him. Dead object can't be jumped.

#3
MokahTGS

MokahTGS
  • Members
  • 946 messages
Any chance I could get someone to correct the script? I'm not a scripter and did not write this.

#4
dethia

dethia
  • Members
  • 146 messages
http://pastebin.com/myuah0Qu

All I did is change restoration to ressurrection, works for me but I don't use split modules or whatever it is you're doing, give it a try.

Modifié par dethia, 20 juillet 2010 - 01:51 .


#5
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Just a quick thought ... You have moved the script from a module script to a campaign script?


Otherwise, the script will only work for the module it is in.


Lance.

Modifié par Lance Botelle, 21 juillet 2010 - 01:57 .


#6
MokahTGS

MokahTGS
  • Members
  • 946 messages
Yeah...I'm starting to see that a lot of scripts can't work as campaign scripts.

#7
Alupinu

Alupinu
  • Members
  • 528 messages
I’m having a similar problem but involve sending companions back to the hangout spot in a different module when they had been dismissed from the party. Like you I can’t get my companions to cross the module barrier. So far all I have figured out is that a call to 'SpawnNonPartyRosterMemberAtHangout()' in the module load script needs to be implemented but how to do this I’m still not sure.

Modifié par Alupinu, 25 juillet 2010 - 07:30 .


#8
Walker_Boh

Walker_Boh
  • Members
  • 11 messages
(Posted elsewhere)

Modifié par Walker_Boh, 24 novembre 2010 - 05:58 .


#9
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 592 messages

MokahTGS wrote...

Yeah...I'm starting to see that a lot of scripts can't work as campaign scripts.


Not sure what this means.

Module scripts can only be used by the module they are in. Campaign scripts are accessible from any module in the campaign.  Any script that you want to work in multiple modules should be a campaign script, not a module script.

Since only one module is open at a time I don't think you can make something happen in another module. I would try saving the companion as a global object, set a global variable that indicates that they should be spawned where you want, and then in the module load script of the other module check the variable and spawn them into the appropriate area.

Also, look at the OC scripts, since they do this when you dismiss companions from your party.

Regards

Modifié par Kaldor Silverwand, 24 novembre 2010 - 06:05 .


#10
diophant

diophant
  • Members
  • 116 messages
If it stopped working when splitting the campaign, the problem is most likely

that the target waypoint is in the other module. Try changing the main to

[nwscript]

void main()

{

object oPlayer = GetLastPlayerDied();

object oWaypoint = GetWaypointByTag("wp_jw_death");

location lLoc;



// * increment global tracking number of times that I died



int iQuest = GetLocalInt(oPlayer,"NW_JOURNAL_ENTRYjw_jr_011");



if (iQuest < 30)

{

SetLocalInt(oPlayer,"NW_JOURNAL_ENTRYjw_jr_011",iQuest+10);

DelayCommand( 2.5f, Raise(oPlayer));



if (GetIsObjectValid(oWaypoint)) // we are in the correct module

{

lLoc = GetLocation(oWaypoint);

DelayCommand( 2.6f, AssignCommand(oPlayer,JumpToLocation(lLoc)));

}

else // we must change the module

{

// change MODULE_NAME to the tag of the module where the waypoint is

DelayCommand( 2.6f, LoadNewModule("MODULE_NAME", "wp_jw_death"));

}

}

else

{

EndGame("");

}

}

[/nwscript]

Make sure to replace MODULE_NAME with the tag of the module where the target

waypoint is.