View Full Version : Respawn thingy
TriLleX The Slayer
Sat, 13th Jul '02, 5:30am
I'm currently making a dungeon.. a BIG one. But one thing I want to know is: Is it possible to, when you die. To reset every single thingy and make one start all over from the Start Location? Not with a restart of the module but just a restart of the dungeon with encounters, items and stuff.. And oh yes. How do I do so a person drops EVERY single thing from his inventory when he dies? Thanks in advance.
Sat, 13th Jul '02, 11:14am
I don't think it is actually possible, from what we've seen you can't anyway
Sat, 13th Jul '02, 8:06pm
I would imagine that's not too difficult. The official modules have some routine where all the unnecessary items from the last chapter are removed from your inventory at the start of the new chapter, and I wouldn't think starting the module over would be too difficult either.
But, as I haven't cracked open the toolset yet, I couldn't tell you if it's possible for sure, or how to do it...
Sun, 14th Jul '02, 5:48pm
Hullo Trillex, yeah ok:
When you die, you have to set the player's OnDeath script to one which restarts the module. Look up the area transition's, and browse through the scripts, there shoudl be one option that gives you "GoToModule" or something similar. Basically enter the module you're in at the moment, so when the player dies, you will enter the module as if you've never even been there.
Not many ideas on the inventory though. Hmm...try it out in a conversation first:
- (NPC_1)- Hello, would you like your inventory exterminated?
|___ Yes please
|___ No thankyou.
Set the yes please to the ActionGiveItemInSlot script, then set the item to nothing. This should effectively remove what you had in that inventory slot.
I know i'm not really helping here, but those things should work.
Mon, 15th Jul '02, 1:40am
What Gopher is saying would likely work, except for it would not recreate the item on the ground where they fell. Perhaps it would be possible to use that command in conjunction with the CreateItemAtLocation command. I haven't tried the script editor yet, so not sure if this would work or not.
Mon, 15th Jul '02, 10:40am
This is part of a completed quest dialogue script that removes an item tagged "it_BugHead" from a players inventory.
The problem is that you have to know the item's tag in order to destroy it. If you gave all your items the same unique tag header I think you could use a search string function to get the tags, but this would only destroy items that you have placed and not any that they had on them before entering. Hope this helps.
Thu, 18th Jul '02, 7:15pm
Here is what I did for respawning player characters in my module.
Please give some credit to me in your module description, or inside the scripts if you choose to copy and paste all this into your module.
With this method, you will activate a series of 'save points' that you'll return to when you die. So you touch one, and after that, when you die you respawn there. The loss of XP and gold is not yet input.
First, on the OnClientEnter script in Edit:Module Properties, this is the type of script you'll need. This sets it so that if the player begins the module and never touches a save point, he will respawn at the first one designated instead of where he died.
SetLocalString(GetModule(), "RespawnPoint", "1st Spawn Point");
be sure to change "1st Spawn Point" to the tag of your initial spawn point that you want the characters to appear at when they haven't touched any save points yet.
Now just add this to OnPlayerRespawn below that on the scripts list.
object oRespawner = GetLastRespawnButtonPresser();
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHe al(GetMaxHitPoints(oRespawner)), oRespawner);
location lRespawn = GetLocation(GetObjectByTag(GetLocalString(GetModul e(), "RespawnPoint")));
Then add this script to the OnUsed script of the object which the character touches to set the save point. Every save point must have a different tag, but the script never changes.
object oPC = GetLastUsedBy();
SetLocalString(GetModule(), "RespawnPoint", GetTag(OBJECT_SELF));
I think that this is pretty much it...it SHOULD work. It works on mine, but I may have missed something here.
TriLleX The Slayer
Fri, 26th Jul '02, 2:11am
Sorry, haven't replied. It seems to work fine, thanks.
Wed, 14th Aug '02, 3:13pm
As far as having the PC drop everything when they die.. would something like this work?
have some kind of while loop..
object oItem = GetFirstItemInInventory(oPC);
while oItem != OBJECT_INVALID
oItem = GetFirstItemInInventory(oPC);
}something like that? would that work?