Aller au contenu

Photo

Need a simple custom death script.


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

#1
Anotherone773

Anotherone773
  • Members
  • 24 messages
I have tried making one myself with and without Lilac's Soul's Script Generator and i can't get a functional death script i  like.

This is what i am wanting in the script:

1) Remove effects on player(same as normal death )
2) Respawn/ End Game GUI.
3)Respawns at a waypoint. This waypoint may or may not be in a different module( this is for campaign use). So it will need a load module command that is conditional on if the waypoint is in the same module as the death.
4) Take item from players inventory. This will be a rogue stone( global rogue stone blueprint). This will be the "cost for respawn".

So the result should be  normal death removal of effects, respawning the PC  at a specific waypoint  in a specific module. I can fill in the variables using the variables in the module script properties. And then takes a rogue stone from player  as the cost of respawning. If no rogue stone is on the PC the game ends and you load from save.

The script sounds simple in theory but i cant get one that actually works. Most of the time i end up  with errors.



Also on a different note is their a script or maybe a hak that  increases the level max in game to go above 30?I am working on an epic series of campaigns and i would like to get up to 50 plus levels before the end of the campaign.

#2
dethia

dethia
  • Members
  • 146 messages
The trouble you may be having with the death script is that you can't jump players to a location if they are dead. So you must revive them first and then port them somewhere. Similarly you must remove the stone after they are revived.



As for the lvl cap, no it cannot be exceeded.

#3
Anotherone773

Anotherone773
  • Members
  • 24 messages
My problem seems to be in writing the code. I have only spent a few hours playing with the script but i keep messing the coding up and it complies with errors. When i do get it to work it i respawn on the spot.

What i thought about trying but havent yet is using the default death script and and trying to add lines at the end.

I was thinking of adding a jump to waypoint command from a travel script that way it contains the strings i need to jump modules. Then lastly adding a take item script which i would boost from somewhere( might try to use Lilac Soul's Script Generator for that one).

So basically cut and paste a bunch of section of other scripts together. My issue is i seem to mess up the lines so the script is invalid. I am quite a novice at scripting.

Well NWN max level can be increased, their was a hakpak floating around a few years back that would allow you to level to 60-70. Dragons Age max level can be increased via .2da files( not for sure how the NWN max level was increased.) The exptable.2da goes to 40. and the spells gained table for sorc goes to level 60.

So with this info its hard for me to believe their is a level 30 hardcoded cap on levels. One, Why would the games before and after NWN2 have ways to up the level cap and just leave out a way to increase the level cap in NWN2. Second, why would the devs bother writing tables that go to level 40 and 60.

Though one could argue that Obsidian used a hardcap in the game's engine. But that would be silly as they would have to modify the engine coding to add xpacks. Like increasing the level cap from the first to second xpack would of required rewriting the coding for the engine. Why would they make it harder on themselves to expand the game? When they can just set the hardcode limit high and do a softcode limit that can be easily increased.

Their has to be a way to increase this limit via 2da files. It just doesnt fit in that they went rogue on this part of the game and did something off the wall. Especially with them focusing in the last xpack on being able to do a lot of customization ( in crafting) Allowing that degree of modding and then saying " oh yeah your limited to 30 levels even though the games before and after NWN2 that have been put out by Bioware allow for level modding. " Just doesnt seem logical.

Also I can level a creature to 120 by quad classing it currently. So this also makes me think their is no hard limit( or its 120 plus) or else i couldnt achieve level 120 on a creature since the toolset maxes out at the max level.

It has to be a 2da that is preventing me from achieving 31 levels in a single class....i hope.

Modifié par Anotherone773, 30 novembre 2010 - 08:43 .


#4
MasterChanger

MasterChanger
  • Members
  • 686 messages
I really recommend splitting up these two complicated and totally separate issues into separate threads (your death scripts and the max level issue).

When it comes to code that doesn't work, what most scripters will tell you is to find out exactly where it's failing. To do this, you put in lots of temporary debugging feedback that will let you know which part isn't firing correctly all throughout your conditional structures (if-statements and such). It can be just an issue of timing--for example, I imagine that if you revive the Player-Character, you may want to use DelayCommand on the JumpToLocation just a fraction of a second.

Certainly make sure the revive-jump piece is working before you introduce the additional complication of transitioning to the different module.

#5
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Yes, as suggested, revive and heal the PC (to at least 1 HP) before jumping them. In a similar script I have it doing a Fade To Black to sort of "hide" the jump and then Fade From Black when it is done. My jump is delayed for about half a second after ressurecting/healing them and only within the same module (same area actually).



My tutorial linked in sig below may be of help to you. Written for the novice scripter. Among other things there is a section in there about combining multiple scripts into a single one.



I think the level cap is pretty much a hard coded limit, otherwise we would have seen a community made hak for higher levels long ago. The 2DA entries are left over from NWN1 (which went up to level 40 max.). The best you could do is "fake it," but that would take a whole lot of work.

#6
Anotherone773

Anotherone773
  • Members
  • 24 messages
@knightmare: I have glanced over your tutorial. I havent had enough time yet to sit down and give it a proper read. I really think my problem is i am just messing up in combining of scripts...and i didnt notice that section. Thanks.

It sucks that they gave NWN2 all this potential for modding then set the level cap at one of the lowest levels i have seen in a game and wont allow you to change it. Its like we are going to give you nearly unlimited power to mod the game....but we are going to place this major limit on you so you cant make anything epic.

I have a back up work around i can use. I prefer actually leveling up so it auto balances and you can create an epic character in more than one class if you wish. Luckily i can use items in inventory to give the PC the necessary abilities to over come enemies that would be insanely strong for a level 30.

@Masterchanger: Normally i would of made these two separate threads but i thought the max level would be a quick answer question( and hoped one i wanted to hear) and i dont like spamming the forums with a bunch of threads so i thought i would toss it in and someone could quick link me to a hak i cant find...which i know ,now, doesnt exist.

Modifié par Anotherone773, 30 novembre 2010 - 05:37 .


#7
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
I think the hard cap is at 30 due to WotC requirement or something. D&D isn't like a lot of other rpgs. In the PnP rules, levels only go up to 30. Yes there are basic rules set up for advancement beyond this, but the D&D game designers didn't really think you should go beyond that level. The most powerful mortal (wizard) in all of (Forgotten Realms) history was 44th level IIRC.

#8
Anotherone773

Anotherone773
  • Members
  • 24 messages
I have tried for 5 hours tonight to get this script to work. I get either the default respawn or i lay on the ground dead. I tried the tutorials, not a lot of help. I just dont get this scripting stuff. It seems overly complicated for what i want to do which, when the PC dies is:



1) GUI pop up allowing respawn or main menu

2) Effects are removed

3) PC is transported to a waypoint in starting module.

4) A rogue stone is removed from the PC inventory

5) if no rogue stone PC cannot respawn.



But the scripting is an overly complicated way of going about a simple task at least to me. I tried splicing scripts as well but that always ends up in an error.



I guess i will go with the default script as i have done spent about 15-20 hours on this one script and im not spending more time on it.

#9
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Can you post the script you have so far, even if it is not working? We can take a look at it and offer adjustments.

Also, as may have been mentioned, try getting things to work in steps. See if you can get only the GUI to pop up and have the effects removed when the player clicks "Respawn." Once you have that, then try to add in the "PC is transported" to a WP inside the same area. If that works, try jumping them to a WP in another area. Then to another module all together. When you have that, add in the item removal, etc.

Scripting can be tough to learn, I'm self-taught and it took me a while. Baby steps is the way to go. I do suggest learning at least some basic scripting as it will greatly help your finished module to stand apart from others.

Modifié par _Knightmare_, 01 décembre 2010 - 12:47 .


#10
Anotherone773

Anotherone773
  • Members
  • 24 messages
Well this isnt a high priority for me at the moment. I dont have the time ( nor patience) at the moment to learn scripting. Right now i am running with no script. The main reason for changing the script was because i can spam respawn which makes every fight easy. I never liked the gold and XP penalty.

The first thing i did was take the original default script  and tried to remove some of the junk. That was a mistake and caused errors so i decided just to stick with it in its original form and add a travel script i lifted from another script.

So i  started with this:

//Custom Campaign Death Script
#include "ginc_transition"
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();
   
    // * increment global tracking number of times that I died
    SetLocalInt(oPlayer, "NW_L_PLAYER_DIED", GetLocalInt(oPlayer, "NW_L_PLAYER_DIED") + 1);

    // * BK: Automation Control. Autopcs ignore death
    if (GetLocalInt(oPlayer, "NW_L_AUTOMATION") == 10)
    {
        Raise(oPlayer);
        //DelayCommand(1.0, ExecuteScript("crawl", OBJECT_SELF));
        return; // Raise and return
    }

    DelayCommand( 2.5f, ShowDefaultDeathScreen( oPlayer ) );
/*
    // * Handle Spirit of the Wood Death
     string sArea = GetTag(GetArea(oPlayer));

    if (sArea == "MAP_M2Q2F2" && GetDistanceBetweenLocations(GetLocation(GetObjectByTag("M2Q2F2_M2Q2G")), GetLocation(oPlayer)) < 5.0 && GetLocalInt(GetModule(),"NW_M2Q2E_WoodsFreed") == 0)
    {
        int bValid;

        Raise(oPlayer);
        string sDestTag = "WP_M2Q2GtoM2Q2F";
        object oSpawnPoint = GetObjectByTag(sDestTag);
        AssignCommand(oPlayer,JumpToLocation(GetLocation(oSpawnPoint)));
        return;

    }

    // * in last level of the Sourcestone, move the player to the beginning of the area
    // * May 16 2002: or the main area of the Snowglobe (to prevent plot logic problems).
    // * May 21 2002: or Castle Never
    if (sArea == "M4Q1D2" || sArea == "M3Q3C" || sArea == "MAP_M1Q6A")
    {

        //Raise(oPlayer);
        //string sDestTag = "M4QD07_ENTER";
        //object oSpawnPoint = GetObjectByTag(sDestTag);
//        AssignCommand(oPlayer, DelayCommand(1.0, JumpToLocation(GetLocation(oSpawnPoint))));
// * MAY 2002: Just popup the YOU ARE DEAD panel at this point
        DelayCommand(2.5, PopUpDeathGUIPanel(oPlayer,FALSE, TRUE, 66487));
        return;
    }

    // * make friendly to Each of the 3 common factions
    AssignCommand(oPlayer, ClearAllActions());
    // * Note: waiting for Sophia to make SetStandardFactionReptuation to clear all personal reputation
    if (GetStandardFactionReputation(STANDARD_FACTION_COMMONER, oPlayer) <= 10)
    {   SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
        SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 80, oPlayer);
    }
    if (GetStandardFactionReputation(STANDARD_FACTION_MERCHANT, oPlayer) <= 10)
    {   SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
        SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 80, oPlayer);
    }
    if (GetStandardFactionReputation(STANDARD_FACTION_DEFENDER, oPlayer) <= 10)
    {   SetLocalInt(oPlayer, "NW_G_Playerhasbeenbad", 10); // * Player bad
        SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 80, oPlayer);
    }

    DelayCommand(2.5, PopUpGUIPanel(oPlayer,GUI_PANEL_PLAYER_DEATH));
*/
}

/*
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, "" );
}

//Travel Script

void main(string sModule, string sTarget)
{
    object oPC = GetIsObjectValid(GetPCSpeaker()) ? GetPCSpeaker() : OBJECT_SELF;
    object oTarget = GetObjectByTag(sTarget);
    // check if the target exists in the current module
    if(GetIsObjectValid(oTarget))
    {
        // exists in module: jump the party to the target
        SinglePartyTransition(oPC, oTarget);
    }
    else
    {
        // does not exist in module: load the appropriate module and jump the party to the target
        LoadNewModule(sModule, sTarget);
    }
}


Now i get a function implentation and definition differ on line 140. Line 140 is:

139  void main(string sModule, string sTarget)
140 {
141 object oPC = GetIsObjectValid(GetPCSpeaker()) ? GetPCSpeaker() : OBJECT_SELF;


I was getting something about variables are undefined or something orginally( something that lead me to believe that i need "SetCampaignString" for sModule and sTarget). This latest error is a new one despite not changing the script since i last messed with it.

I really have no clue what i am doing . I know a few very basic things but i would really need time to sit down and study scripting to figure this out and i dont have near the kind of time i would need.

Modifié par Anotherone773, 03 décembre 2010 - 08:18 .