Aller au contenu

Photo

ondeath help wanted


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

#1
Wawmong

Wawmong
  • Members
  • 50 messages

hello

 

I'm looking for a bit of help with a small mod i've been working on.

 

What i'm trying to do is create a custom ondeath that auto raises players, jumps them to another area, creates a grave stone where they died then allows players to jump back to their grave stone from a convo. I managed to create the auto raise and have players being sent to another area, i only need help with the last two scripts.

 

Any help would be nice, the mod is almost completed...

 

i know the vault would have something like this but the site is down, otherwise i'd look.

 

thanks



#2
Sheldomar

Sheldomar
  • Members
  • 20 messages

You could SetLocalLocation() on the player, and for the tombstone just CreateObject() at that location. The conversation could then jump the player to that location if they choose.



#3
Proleric

Proleric
  • Members
  • 2 352 messages

+1

 

The new vault is still available, incidentally.


  • Squatting Monk et icywind1980 aiment ceci

#4
Wawmong

Wawmong
  • Members
  • 50 messages

ok, thanks guys.

 

:)



#5
Wawmong

Wawmong
  • Members
  • 50 messages

alright so i have the gravestone being created at time of death but i'm unsure how to script SetLocalLocation() on the player.

 

i'm really terrible at scripting, sorry.



#6
Wawmong

Wawmong
  • Members
  • 50 messages

i meant to say i dont know how to jump the player to back to the gravestone...

 

i did figure out SetLocalLocation though...

 

location lLoc = GetLocation(oLooser);
SetLocalLocation(oLooser, "RECALL_LOC1", lLoc);
CreateObject(OBJECT_TYPE_PLACEABLE, "gravestone_1",lLoc);



#7
Wawmong

Wawmong
  • Members
  • 50 messages

i can jump them to the placeable but how do i make the location they jump to unique for each player?



#8
Squatting Monk

Squatting Monk
  • Members
  • 445 messages

If each player is getting their own gravestone, then jumping them to the correct gravestone is the only thing you need. Two options:

 

1: store the created gravestone as a local object on the PC (just like you did with the location), then get and jump to that from the dialog.

2: just jump to the local location that you already stored and created the gravestone at.



#9
Wawmong

Wawmong
  • Members
  • 50 messages

thanks monk, but that is beyond me. could you write it out for me maybe? thanks



#10
Wawmong

Wawmong
  • Members
  • 50 messages

here is what i made for the unused of a portal, after adding AssignCommand(oPC, ActionJumpToLocation(loc_gs,TRUE)); the script doesnt compile. can anyone tell me what i'm doing wrong please?

 

void main()
 {
object oPC = GetLastUsedBy();
location loc_gs = GetLocalLocation(OBJECT_SELF,"RECALL_LOC1");
//object oLastspeak = GetLastSpeaker();
effect eTeleport1 = EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION);
effect eTeleport2 = EffectVisualEffect(VFX_FNF_SCREEN_SHAKE);


if (GetLocalInt(oPC,"SPAWN_1") == 0)
{
FloatingTextStringOnCreature("You have no gravestone", oPC, FALSE);
return;
}
if (GetLocalInt(oPC,"SPAWN_1") == 1)
{

ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport1, oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport2, oPC);

//DelayCommand(1.5, AssignCommand(oPC, JumpToObject(GetObjectByTag("Gravestone_1"))));
AssignCommand(oPC, ActionJumpToLocation(loc_gs,TRUE));
SetLocalInt(oPC, "SPAWN_1", 0);
return;
}
}



#11
Squatting Monk

Squatting Monk
  • Members
  • 445 messages
Just remove the TRUE parameter from ActionJumpToLocation().
 
Also, you'll want to change the first parameter on this line...
location loc_gs = GetLocalLocation(OBJECT_SELF,"RECALL_LOC1");
... to this:
location loc_gs = GetLocalLocation(oPC,"RECALL_LOC1");
Because the location is stored on the PC (I'd assume, anyway. otherwise everyone is jumping to the same location).

#12
Wawmong

Wawmong
  • Members
  • 50 messages

sweet! everything works now!

 

thanks a lot monk.



#13
Wawmong

Wawmong
  • Members
  • 50 messages

sorry, one last question. im using DestroyObject in my module ondeath event, to destroy the gravestone on a delay. its not working, and im wondering which script handle on the placeable besides heartbeat i could place this so it gets deleted?



#14
Wawmong

Wawmong
  • Members
  • 50 messages

this is what im using in my ondeath for this issue. doesn't work though...

 

object gravestone1 = GetObjectByTag ("Gravestone_1");
DelayCommand(70.0, DestroyObject(gravestone1));



#15
Wawmong

Wawmong
  • Members
  • 50 messages

nevermind, got it working. placed the script on my portal convo instead.

 

thanks for the help everyone.



#16
Proleric

Proleric
  • Members
  • 2 352 messages

Glad you got it working. In general, there is a potential problem with delay command or actions in an OnDeath script, because the caller may not live long enough to do them. The resolution is to assign the task to the module or other permanent object, e.g.  AssignCommand(GetModule(), xxxx);



#17
Wawmong

Wawmong
  • Members
  • 50 messages

oh thats good to know, thanks Proleric.

 

i may be back here with a few other minor things in days to come. trying to get this mod wrapped up in the next few weeks.

 

:)



#18
Wawmong

Wawmong
  • Members
  • 50 messages

hey again folks. i have this script which is executed oncliententer and i was told it works fine, but it's broken. it's supposed to make a check on the player inventory for my mods unique items, delete them, then create new ones on the player. what it actually does is create the items with out deleting the old ones.

void main()
{
object oPlayer = GetEnteringObject();
if (GetItemPossessedBy(oPlayer, "manager")== OBJECT_INVALID)
    {
    CreateItemOnObject("manager", oPlayer);
    }
if (GetItemPossessedBy(oPlayer, "pwmenu")== OBJECT_INVALID)
    {
    CreateItemOnObject("pwmenu", oPlayer);
    }
if (GetItemPossessedBy(oPlayer, "statchecker")== OBJECT_INVALID)
    {
    CreateItemOnObject("statchecker", oPlayer);
    }
if (GetItemPossessedBy(oPlayer, "pipe")== OBJECT_INVALID)
    {
    CreateItemOnObject("pipe", oPlayer);
    }
 

 

thanks for any suggestions.



#19
meaglyn

meaglyn
  • Members
  • 808 messages

It actually does neither of the things you describe. What it does is check if the player has each item and if not creates any missing ones.  There is no deleting and there is only creating new items if the PC does not have the item. Something like this code would do what you are describing:

object oItem;

oItem = GetItemPossessedBy(oPlayer, "manager");
if (GetIsObjectValid(oItem)
        DestroyObject(oItem);
CreateItemOnObject("manager", oPlayer);

oItem = GetItemPossessedBy(oPlayer, "pwmenu");
etc.

Editted for code formatting...



#20
Wawmong

Wawmong
  • Members
  • 50 messages

that's what i'm looking for.

 

thank you!



#21
Wawmong

Wawmong
  • Members
  • 50 messages

couldn't get it to compile, however many edits i make. damn scripting is like a guessing game for me...

 

the script i posted doesn't work the way you said, it creates the items no matter what. i've had to log into this mod enough for testing to know this, i have a full inventory of these items from this script. if it worked like you say i'd be satisfied with that



#22
meaglyn

meaglyn
  • Members
  • 808 messages

If it's not doing that then the tags of those items are not what you have in the code. E.g. the tag for the "manager" item is not "manager". 

The argument in the GetItemPossessedBy call is the tag, whereas the one in CreateItemOnObject is the resref.  The resref is clearly right since you are getting items created.  So the tag is wrong.



#23
Wawmong

Wawmong
  • Members
  • 50 messages

yeah you're right, i had the resref in both calls. i didnt know that about GetItemPossessed.

 

everything works now, thanks for the help meaglyn.



#24
Wawmong

Wawmong
  • Members
  • 50 messages

back again... i have this script in all my areas onexit events and while it works, it also effects familiars and summons. wondering how i can make a check for them so they dont get whacked. thanks.

 

void DestroyMonster(object oMonster)
{
    effect eDeath = EffectVisualEffect(VFX_IMP_PULSE_NEGATIVE);
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oMonster);
    DestroyObject(oMonster, 0.01f);
}

void main()
{
    object oMonster = GetExitingObject();

    if (GetIsEnemy (oMonster) == TRUE){

    DelayCommand(0.5f, DestroyMonster(oMonster));
}
}



#25
BelowTheBelt

BelowTheBelt
  • Members
  • 394 messages

if (GetIsEnemy (oMonster) == TRUE){

 

What are you trying to achieve with the above?  Kill any creature that follows a PC out of the area?

 

Here's the lexicon definition of GetIsEnemy.  Since you don't define anything to compare the exiting monster to for purposes of defining what is an 'enemy', it uses the object that calls the script (and since this is in the area exit slot of the module, it is the 'module' calling the script, not a creature).

 

Another approach that should skip your associates could be to replace the line above with something like:

 

If (!GetIsPC(oMonster) && GetMaster(oMonster)==OBJECT_INVALID)

 

This looks to see if the exiting object is a PC.  If the exiting object is a PC, then nothing happens.  However, If the exiting object isn't a PC AND the object does not have a master, then destroy the monster.  Your summons/associates will return the PC as the master, so they'll fail the check and won't get destroyed.  A downside of this approach is that summons/associates of NPCs wouldn't be affected (since they do have masters, even though that master is not a PC).

 

This may or may not be appropriate based on what your objective is.