logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
So....Can I con anyone into checking my scripts..

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Mask



Joined: 20 Mar 2005
Posts: 12

PostPosted: Sun Apr 03, 2005 21:07    Post subject: So....Can I con anyone into checking my scripts.. Reply with quote

So let me throw out a few scripts and see where I'm F'ing up.

1.) Save script I actually have two of these but they are called diffrently, the one saved from the conversation I assume would be easier. Guess maybe I ought make sure it checks that location is valid as opposed to PC is valid?

Code:
#include "aps_include"
void main()
{
object oPC = GetPCSpeaker();
location lTarget = GetLocation(oPC);
if((GetIsObjectValid(oPC))&&(GetIsPC(oPC)))
    {
    SetPersistentLocation(oPC, "PCSavePoint", lTarget);
    SetPersistentInt(oPC, "PC_HP", GetCurrentHitPoints(oPC));
    ExportSingleCharacter(oPC);
    DelayCommand(0.1f, SendMessageToPC(oPC, "Character Saved"));
    }
}



2.) Jump to saved persistant location, I've actually come up with two(Couldn't remember the name of the old one at one point so I made a new one. *Sheepish grin*), so let me toss out both and get ya advice, as to which is best, or if neither are, how to change one to be....erm.....actually effective.

For refrence these both go/went in the "OnEntered" block of the starting area.


Code:
#include "aps_include"
void SetHP(object oPC, int nDamage)
{
    effect eDamage = EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_FIVE);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oPC);
}

void main()
{
object oPC = GetEnteringObject();
location lTarget = GetPersistentLocation(oPC, "PCSavePoint");
int nCurrentHitPoints = GetCurrentHitPoints(oPC);
int nHitPoints = GetPersistentInt(oPC, "PC_HP");
    if (GetIsPC(oPC))
    {
        if (!GetIsDM(oPC))
        {
        //Take to last saved location
        DelayCommand(0.5f, AssignCommand(oPC, JumpToLocation(lTarget)));
            // Set the players hit points
        if (nHitPoints != 0)
            {
            int nDamage = nCurrentHitPoints - nHitPoints;
            if (nDamage > 0)
                {
                    DelayCommand(3.0, SetHP(oPC, nDamage));
                }
            }
         }
    }
}


Code:
#include "aps_include"
void SetHP(object oTarget, int nDamage)
    {
    effect ePain = EffectDamage(nDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_TWENTY);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, ePain, oTarget);
    }
void main()
{
object oTarget = GetEnteringObject();
location lTarget = GetPersistentLocation(oTarget, "PCSavePoint");
int nCurrentHitPoints = GetCurrentHitPoints(oTarget);
int nHitPoints = GetPersistentInt(oTarget, "PC_HP");
    // Set the players hit points
    {
    if (nHitPoints != nCurrentHitPoints)
        {
        int nDamage = nCurrentHitPoints - nHitPoints;
        if (nDamage > 0)
            {
            DelayCommand(6.0, SetHP(oTarget, nDamage));
            }
        }
    }
    {
    if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;
        {
        DelayCommand(0.5f, AssignCommand(oTarget, JumpToLocation(lTarget)));
        }
    }
}


I hate to bug ya'll but I really do seem to be in over my head.
_________________
DM Mask


Legacy of Netheril
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Lokey



Joined: 02 Jan 2005
Posts: 158

PostPosted: Mon Apr 04, 2005 6:02    Post subject: Reply with quote

Setting the location and hitpoints looks fine.

DelayCommand(0.5f, AssignCommand(oTarget, JumpToLocation(lTarget)));

JumpToLocation() isn't an assignable action by itself.

Something like this will work after setting and delaying the amount of hitpoints you want to knock off:
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionDoCommand(JumpToLocation(lTarget)));

Does everything look ok on the database side?
_________________
Neversummer PW NWNx powered mayhem Wink
Back to top
View user's profile Send private message
Mask



Joined: 20 Mar 2005
Posts: 12

PostPosted: Mon Apr 04, 2005 6:24    Post subject: Reply with quote

Lokey wrote:

JumpToLocation() isn't an assignable action by itself.

Something like this will work after setting and delaying the amount of hitpoints you want to knock off:
AssignCommand(oTarget, ClearAllActions());
AssignCommand(oTarget, ActionDoCommand(JumpToLocation(lTarget)));



Would this ahh, be a recommendable change instead? Clear all actions I've noticed, can be defeated by key control running.(That may be incorrect, its an assumption based on PC's defeating it -somehow- in the past)

Code:
// The subject will jump to lLocation instantly (even between areas).
// If lLocation is invalid, nothing will happen.
void ActionJumpToLocation(location lLocation)


Lokey wrote:

Does everything look ok on the database side?


more a less, and thanks.. Let me show a few of my "Fruity entries."

HP saving works alright, the SetHP however seems to be........mmmm.


as for fruity entries..

    player tag name val expire last
    Deusicide Sucubi Tanner PCSavePoint 0 20050330172044
    mmmetaphor O'Cyrus Alebeard PCSavePoint 0 20050404053608
    Alexius the Exile 'Madison' PCSavePoint 0 20050401023226
    DM_Mask Mask PCSavePoint 0 20050403044701
    radioheadd Ramirez PCSavePoint 0 20050404003957
    Matheus the great Blake van Gelder PCSavePoint 0 20050402192620
    supaden Hoar PCSavePoint 0 20050402192511
    Heroboy123 Donny PCSavePoint 0 20050403015553
    James Wolf Artemas PCSavePoint 0 20050330135805
    RasputinCaarn Sol PCSavePoint 0 20050403122637
    RasputinCaarn Io PCSavePoint 0 20050402182246
    Heroboy123 Sywyn Weftylness PCSavePoint 0 20050330150325
    Talasmanca T'lira Skydancer PCSavePoint 0 20050402042911
    Terry W. Collum DMSilvanus PCSavePoint 0 20050401213531
    Terry W. Collum Meg Mucklebone PCSavePoint 0 20050404131500
    mmmetaphor Twikwillug Tinkerton PCSavePoint 0 20050330115110
    ChaosInTwilight Thryfing PCSavePoint 0 20050330170138
    Hawthorne The Horrible Green Dream PCSavePoint 0 20050330134318
    Heroboy123 Gorfiril Tir'ein PCSavePoint 0 20050330150418
    Gift_of_Fury Marcus Darkblade PCSavePoint 0 20050330145910
    supaden Grant'ire Kelenthor PCSavePoint 0 20050402035618
    mathew_g_99 Matteoo PCSavePoint 0 20050401111727
    fallenangelsrise Octavian Seppi PCSavePoint 0 20050330164952
    ChaosInTwilight Mask PCSavePoint 0 20050401054719
    Antaurius Pimiku Izshu PCSavePoint 0 20050331124741
    DemonicRetribution Mayan PCSavePoint 0 20050403222821
    Sharuma Zae'lauvi Jaelre PCSavePoint 0 20050330113110
    Gift_of_Fury Cyr'ion Shadowsong PCSavePoint 0 20050331195236
    azurepriest Grant'ire Kelenthor PCSavePoint 0 20050403142110
    -x-treme- Rodon Floud PCSavePoint 0 20050331015527
    Wrath_Child Torgar PCSavePoint 0 20050331155946
    DrugmeupElmo (DM) Cyric PCSavePoint 0 20050401042846
    antonio morales Claymore de Gorgoth PCSavePoint 0 20050331074049
    hyperflux1234 Vesula PCSavePoint 0 20050401142459
    masochistXU Fensbane Viluisurr PCSavePoint 0 20050331064922
    mortalsoul5 Alura Ashenvine PCSavePoint 0 20050331153802
    poisonshadow Meranda PCSavePoint 0 20050402171509
    Fawaz Valten PCSavePoint 0 20050402180303
    masochistXU Mandril Jarshby PCSavePoint 0 20050402043550
    Mercy Dorn Pandora PCSavePoint 0 20050402172947
    Manshoon v.2 Kal'Vashar PCSavePoint 0 20050402204137
    supaden Beliel PCSavePoint 0 20050403012605
    JhaeJhae Juliana PCSavePoint 0 20050401212128
    furybringer Grush Rashlak PCSavePoint 0 20050401141215
    mezzanine_angel Hemlock PCSavePoint 0 20050402025627
    James Wolf Test Test Test PCSavePoint 0 20050401144930
    Damion Slade Peragrin Genfaris PCSavePoint 0 20050402172239
    AshRosen Vilamir Raastin PCSavePoint 0 20050402232505
    Squirreltopia1 Coramil Xiloscent PCSavePoint 0 20050403005139
    Talasmanca Deleng Cendlen PCSavePoint 0 20050403044717
    Lady Helina ~Helina~ PCSavePoint 0 20050403083809
    Amelie2005 Angrevor Malquevieyer PCSavePoint 0 20050403224113
    Ski2die Serin Silvermane PCSavePoint 0 20050403211617
    FreeFragger Raziel Moosntar PCSavePoint 0 20050404032257
    Tom Waits Jo Jo Singh PCSavePoint 0 20050404124414
    ? Damion Slade Justan Adams PCSavePoint #AREA#ChapelofTyr#POSITION_X# 4.826053619#PO... 0 20050404055349
    ? Demetrius I Ðemetrius PCSavePoint #AREA#CormanthorForestSouthofMoonkiss#POSITION_X# ... 0 20050404140528
    ? kenas4.5 Nixamneth Dladargeth PCSavePoint #AREA#CormanthorForestSouthofMoonkiss#POSITION_X# ... 0 20050404121724
    ? kenas4.5 Nixamneth Dladargeth H_IC_Point #AREA#CormanthorForestSouthofMoonkiss#POSITION_X# ... 0 20050404114449
    ? Heroboy123 Hemlock PCSavePoint #AREA#CormanthorForestSouthofMoonkiss#POSITION_X# ... 0 20050404150646
    ? supaden Xeunoth PCSavePoint #AREA#CormanthorForestSouthofMoonkiss#POSITION_X# ... 0 20050402032428


Its strange in that it only actually saves locations for some PC's....any thoughts, now before ya asked, I tried wiping the database to see if it was only "Old" entries that did this... and such is not the case.
_________________
DM Mask


Legacy of Netheril
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Mon Apr 04, 2005 7:45    Post subject: Reply with quote

Hi Mask! I just read the post on Bioware's boards and haven't responded yet, but I'm glad you made it over here...

No idea why you would not get everything saved on the location. The only recommendation I could make is to use the full syntax, including defining expiration time and database table to use. See if that works for you....

Here is my code to jump to location:


void main()
{
object oPlayer=GetEnteringObject();
object oModule=GetModule();

location IAmHere=GetPersistentLocation(oPlayer,"PlaceInTheWorld","location");
AssignCommand(oPlayer,JumpToLocation(IAmHere));

}

About this..... First, I did NOT use ActionDoCommand. Why? Easy. Defining Action puts the parameter in the PC's action que, which means if they are quick at clicking they can break the jump by moving and clearing their action que BEFORE the jump. By just issuing a JumpToLocation they cannot abort the jump.

Also notice that I am specifically proclaiming which table to pull the info out of ("location"), none of my code uses the default tables for anything, hence you will always find the Time and Table entries in my Set parameters filled in.....

Second, this is put as the OnEnter script for a generic trigger that surrounds the Start location, NOT on the Area. Reason: The PC "enters" the module AND enters the area BEFORE they are fully in the game. But a JumpToLocation can only be done after the PC is fully in the game. COnsequently if it is attached to the area or module OnEnter() the script will fire but NOT jump the PC. So we attach it to a trigger. The other method is to add a delaycommand to the ActionJump but that delay might have to be as long as 15 seconds depending on how long it takes the PC's computer to load the module. Use the trigger.

Hopefully these help!
Back to top
View user's profile Send private message
Mask



Joined: 20 Mar 2005
Posts: 12

PostPosted: Wed Apr 06, 2005 9:16    Post subject: Reply with quote

Acrodania wrote:
Second, this is put as the OnEnter script for a generic trigger that surrounds the Start location, NOT on the Area. Reason: The PC "enters" the module AND enters the area BEFORE they are fully in the game. But a JumpToLocation can only be done after the PC is fully in the game. COnsequently if it is attached to the area or module OnEnter() the script will fire but NOT jump the PC. So we attach it to a trigger. The other method is to add a delaycommand to the ActionJump but that delay might have to be as long as 15 seconds depending on how long it takes the PC's computer to load the module. Use the trigger.


Actually doing it as an area on enter works great, triggers 3 secodns after they load into start room... I tried that combined with a trigger.....bleh..insta-kills.

I'll post all my relevenet scripts here int eh morning to stir up discussion, and give the next "New guy" that's completely clueless,(As I was) somethin gto start with that's Idiot-resistant

Thanks for the help guys, nothing warms my heart like watching someone known to death log, od exactly that and return to teh dragons feat.........dead..........a day and a half later..

'sPriceless.
_________________
DM Mask


Legacy of Netheril
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group