Aller au contenu

Photo

2 Randoms


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

#1
Lemenhead22

Lemenhead22
  • Members
  • 17 messages
 Once again, just learning how to script here. I'm attempting to make a module and at the same time have been just looking up random scripts from the game and trying to understand them.

First, I was wondering if there's an easier way to make a corpse from a blueprint creature. Like if there was a simple way to automatically set the creature to be in it's dead state when the player arrives. So far, the only thing I could think of was to add this on a OnClientEnter script:

ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectDeath(), oObject);

That also brings me to another question I just thought of...what's the difference in OnClientEnter and OnEnter?

My second official question is when you're running a conversation that refers to a switch in a script, if in one of the cases that a convo node refers to has a DelayCommand(2.0f...) in it, does that automatically force that delay on the actual conversation node as well to where the PC can't progress the convo? And then, if you were to add a delay through the conversation editor would the DelayCommand and convo delay, be additive? That's the way it has appeared to me when tinkering with this module. I was just wanting to confirm it.

#2
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
I believe you can spawn it in with negative hit points and it will show up dead (so set the blue print or make a corpse blueprint with negative hp).

Btw it helps get answers quicker if you put the topic in the topic header.

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
There is also an OnSpawn script in the game that deadifies a creature. I've used the zero/negative hit points approach before though, and as long as your creature isn't set to decay it also works.

You may want to give the creature a neutral faction though. Otherwise your companions will run back and forth on the spot trying to attack the hostile creature their AI detects, unable to actually launch an attack though.

As for OnEnter and OnClientEnter:

OnEnter fires any time a creature enters the area, which includes placed creatures when the module starts (when their OnSpawn script fires), players entering the area, creatures that get summoned, creatures spawned by encounter triggers... pretty much any way in which a creature can 'enter' the area. It's not a good event to use for players, as it tends to fire before party members are fully loaded into the area.

OnClientEnter only fires when players enter the area, and only once the party is completely loaded. It's the event of choice where party members are concerned. Especially as you don't have to filter out non-player creatures.

#4
Lemenhead22

Lemenhead22
  • Members
  • 17 messages
Eesh, I never thought to simply make their HP 0. That's interesting with the AI as well. Thanks guys.

#5
I_Raps

I_Raps
  • Members
  • 1 262 messages
The designers tried something like this once - with imperfect results. There is a cave in the OC where some trolls are theoretically munching on some dead orcs. When you arrive, the orc corpses are laying there with lootable items. But if you rest in the area and then leave, the orcs will usually stand back up and only drop when they see you.

Just so you know - perfection may be hard to obtain.

#6
Tchos

Tchos
  • Members
  • 5 072 messages
I've played a couple of modules where my AI party members wasted scrolls trying to resurrect a dead monster. I think this might be because the NPC was both set to a friendly faction, and was marked "resurrectable".

#7
ColorsFade

ColorsFade
  • Members
  • 1 271 messages

I_Raps wrote...

The designers tried something like this once - with imperfect results. There is a cave in the OC where some trolls are theoretically munching on some dead orcs. When you arrive, the orc corpses are laying there with lootable items. But if you rest in the area and then leave, the orcs will usually stand back up and only drop when they see you.

Just so you know - perfection may be hard to obtain.


I remember that exact spot and the orcs waking up and falling dead. Not ideal. 

#8
Darin

Darin
  • Members
  • 282 messages
you can also import scripts on the creature, and select "spawn in dead" scripts, though that could lead to the orcs mentioned above.

#9
Dann-J

Dann-J
  • Members
  • 3 161 messages
One way to prevent them standing up might be to write an OnSpawn script that locks them into a dead pose, then kill them after a slight delay. That way if they do briefly undeadify, they should still be lying down. It's a lot of trouble to go to though. Also, assigning animations in an OnSpawn event can be hit-and-miss.

I've also created model VFX for dead creatures, having them execute a death animation (without looping). Then they can be used as placeable efffects in non-walkable areas. The only problem is that they tend to execute their death animation once when players first enter the area, so if they're in full view when you enter you can see them falling down. Plus you can't loot the corpse (or interact with it in any way, short of using a collision box). At least the VFX approach prevents them from ever standing up again.

#10
Eguintir Eligard

Eguintir Eligard
  • Members
  • 1 832 messages
Cant their spawn in script simply deliver a damage * 500 effect unresistable to self or is that too simple?

#11
Dann-J

Dann-J
  • Members
  • 3 161 messages
The corpse-making OnSpawn script already in the game assigns a death effect, after first making sure to make the target non-plot, non-immortal, non-fading, etc. That way it can be applied to just about any creature without having to mess with any of their properties (other than assign the OnSpawn script). I don't know how well it works against creatures immune to death effects though.

#12
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
In my King's Festival campaign I used my own script bb_dead_corpse_sp since I had issues with both the standard gb_spawn_dead_sp script and the OC 22_b_corpse_si script.

My script calls the KillAndReplaceDecorative function from x0_i0_corpses.

// bb_dead_corpse_sp
// by Brendan Bellina
// June, 2009

// This is an alternative to standard script gb_spawn_dead_sp

#include "x0_i0_corpses"

void main()
{
// Create bloodstain
location lLoc = GetLocation(OBJECT_SELF);
CreateObject(OBJECT_TYPE_PLACEABLE, "plc_mr_bloodstain1", lLoc);

// This damage code taken from a NWN script by Sir Elric (Ossian Studios) see <http://nwn.bioware.c...49296&forum=63>
// Unfortunately, couldn't get this method to work with my companions.
// effect eNearDeath = EffectDamage(GetCurrentHitPoints(OBJECT_SELF) - 1, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
// ApplyEffectToObject(DURATION_TYPE_INSTANT, eNearDeath, OBJECT_SELF);
// SetPlotFlag(OBJECT_SELF, FALSE); // turn off plot if on
// effect eDeath = EffectDamage(GetCurrentHitPoints(OBJECT_SELF) - 10, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
// ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, OBJECT_SELF);

// In case this doesn't work well an alternative approach from the OC (22_b_corpse_si) is:
// effect eDeath = EffectDeath();
// SetIsDestroyable(FALSE, FALSE,TRUE);
// ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, OBJECT_SELF));

KillAndReplaceDecorative(OBJECT_SELF);
}

#13
Dann-J

Dann-J
  • Members
  • 3 161 messages
Yes - there's some interesting stuff in x0_i0_corpses.

I used it to create a script that loots any leftover dropped or lootable items after a battle and puts the items into the inventory of a specified object (creature, container, or store). Why visit every corpse individually, when you can toss a gold piece to a local commoner and have them run around gathering items for you?

Modifié par DannJ, 30 mai 2013 - 11:07 .