Aller au contenu

Photo

Secret chest. How?


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

#1
Runspect

Runspect
  • Members
  • 11 messages
I want a secret (invisible) chest that appears thru a trigger.

I've found the SecretTriggerChest activator, but its associated script (x0_o2_sec_truniq) seems not available.

Please, helpppppppp!!!!!

#2
Dann-J

Dann-J
  • Members
  • 3 161 messages
A very simple method would be placing the chest somewhere out of sight, then relocating it via a script. That way you can set up the inventory before hand. I'm not sure whether you can create a blueprint of a chest and retain its inventory - if you could, then you could just spawn in the chest from the blueprint. Creature blueprints certainly preserve their inventory, but I've never tried making a container blueprint.

I've created my own highly simplified search heartbeat script that attaches to placeables. They start out non-static and non-usable (so they don't show up using the Z key), then become usable when the search DC is achieved. The script also spawns in levers based on pre-defined blueprints, using an Ipoint  instead of a placeable.

I suspect I've reinvented the wheel though. There seem to be a lot of secret object scripts, triggers and placeables in the toolset, but I've never bothered to figure out how to configure them properly (scripting my own from scratch seemed to be faster).

Modifié par DannJ, 09 mai 2011 - 10:58 .


#3
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
@DannJ - You can add inventory into the chest/container in its blueprints and the spawned copy will retain that inventory.

@Runspect - Create a copy blueprint and edit it's Properties so that the Appearance is InvisibleBodyBag. That will make a chest that is invisible but works the same in all other aspects. Then use a script to spawn it in.

#4
Dann-J

Dann-J
  • Members
  • 3 161 messages
Thanks Knightmare. That's good to know.

It should also be possible to spawn an empty container and use CreateObject to add things to its inventory (so that you don't have to create a separate blueprint for each chest).

Here's my own 'secret object' heartbeat script that either makes non-static non-usable objects into usable objects, or spawns in an object at an Ipoint location.
[Edit: Now on the vault, with an example module]

----

// Local variables to set on non-static & non-usable placeable to make it usable:
//
// Radius = search radius from object (float)
// SearchDC = search rank required (integer)
// Spawn = resref of placeable to spawn, if using Ipoint (string)
//
// Use an Ipoint instead of a placeable to spawn a
// hidden object from a blueprint (see 'Spawn' variable above)

void main()
{
location lTarget = GetLocation(OBJECT_SELF);
float fRadius = GetLocalFloat(OBJECT_SELF,"Radius");
int iSearchDC = GetLocalInt(OBJECT_SELF,"SearchDC");
string sSpawn = GetLocalString(OBJECT_SELF, "Spawn");
int iSkill;
int iSearching;

if (GetLocalInt(OBJECT_SELF,"Found") == 1)
return;// Already found the object once

object oSearcher = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget, TRUE, OBJECT_TYPE_CREATURE);
while ( GetIsObjectValid(oSearcher) )
{
// If actively searching, add 1D10 to search skill
iSearching = GetDetectMode(oSearcher) == DETECT_MODE_ACTIVE;
iSkill = GetSkillRank(SKILL_SEARCH,oSearcher) + (d10(1)*iSearching);

// If a party member
if(GetFactionEqual(oSearcher, GetFirstPC()) || GetIsPC(oSearcher))
{
if ( iSkill >= iSearchDC )
{
PlayVoiceChat(VOICE_CHAT_LOOKHERE, oSearcher);
SetUseableFlag(OBJECT_SELF,1);// Make a non-usable placeable usable
effect eVis = EffectNWN2SpecialEffectFile("fx_nolaloth");
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eVis,OBJECT_SELF,10.0);
PlaySound("sim_magsee");
SetLocalInt(OBJECT_SELF,"Found",1);

if (sSpawn != "")
{
// Spawn in a hidden object (optional)
CreateObject(OBJECT_TYPE_PLACEABLE,sSpawn,lTarget);
}
}// end if found object
}// end if party member
oSearcher = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget, TRUE, OBJECT_TYPE_CREATURE);
}// end while
}

Modifié par DannJ, 10 mai 2011 - 01:08 .


#5
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
Yeah I found out that you can spawn in the chest invisible with inventory because I'm using it as a "take a reward" type thing. I spawn in the chest invisible, inventory is all the items the player can select from, and force open the chest inventory screen for the player. Once the player selects the number of items they are allowed (based on quest success), it closes the chest inventory screen and destroys the chest (I edited the XML so I could hide the "Loot All" button). Works great.

Modifié par _Knightmare_, 10 mai 2011 - 02:39 .


#6
rjshae

rjshae
  • Members
  • 4 505 messages
Dumb question perhaps, but have you tried the Secret Object placeable under MISC PROPS?