I'd like the PC to be ambushed in my module, but only if they rest in a specific area. Presumably I'd have to edit the module's OnRest event - but how would I set up a condition to let the script get the PC's area?
Condition for resting in a specific area?
Débuté par
Mr. Versipellis
, août 01 2012 04:47
#1
Posté 01 août 2012 - 04:47
#2
Posté 01 août 2012 - 05:16
object oArea = GetArea(GetLastPCRested());
if there's already the line: object oPC = GetLastPCRested();
Then simply replace GetLastPCRested() by oPC
Kato
if there's already the line: object oPC = GetLastPCRested();
Then simply replace GetLastPCRested() by oPC
Kato
#3
Posté 01 août 2012 - 10:22
That's not what I meant, sorry. I want a script to go: "When the PC rests, IF they're resting in area x, spawn some creatures to attack her, ELSE, carry on as normal".Kato_Yang wrote...
object oArea = GetArea(GetLastPCRested());
if there's already the line: object oPC = GetLastPCRested();
Then simply replace GetLastPCRested() by oPC
Kato
#4
Posté 01 août 2012 - 11:46
Kato was simply showing you how to get the area so that you can check against the area when determining whether to launch the ambush.
#5
Posté 02 août 2012 - 10:21
Feeling pretty dumb right now. So what does that function "get" - the tag or resref of the area?
#6
Posté 02 août 2012 - 10:40
Mr. Versipellis wrote...
Feeling pretty dumb right now. So what does that function "get" - the tag or resref of the area?
Neither. It gets you an object reference to the area object. That lets you treat it like any other object. If you wanted its tag or resref, you'd use string sArea = GetTag(oArea) or string sArea = GetResRef(oArea).
So if the tag of the area you want the ambush to occur in is "ambush_area," you could do the following:
object oArea = GetArea(GetLastPCRested());
string sArea = GetTag(oArea);
if (sArea == "ambush_area") {
// Insert ambush code here
}
Modifié par AndarianTD, 02 août 2012 - 10:46 .
#7
Posté 02 août 2012 - 03:24
Got it - this seems to be working perfectly. Is there a way of cancelling the PC's rest as well? I'm sure I've seen it used somewhere but I'm not sure which "include" it was found in.





Retour en haut






