Traps damaging NPCs of the same faction
#1
Posté 22 avril 2013 - 01:00
Sir Elric's system spawns the traps from the area OnEnter essentially using CreateTrapAtLocation(). It uses STANDARD_FACTION_HOSTILE in the arguments. I am guessing the problem has something to do with that.
How do I get around this?
#2
Posté 22 avril 2013 - 01:14
If these traps are supposed to be friendly to a PC in any circumstance, then the issue is much more complicated.
#3
Posté 22 avril 2013 - 03:57
To do this, I could add a check to the 50ish nw_t1_ or x2_t1_ scripts to see if they should activate, right? (Sir Elric's system doesn't specify a custom impact script, so it uses the defaults)
#4
Posté 22 avril 2013 - 04:20
Terrorble wrote...
Okay, so make the trap infinite, then you are saying in its impact script, have it compare the entering NPC's faction to say TRAP_SAFE_FACTION|string|... that I set on the area to see whether it activates or not? Or by "custom script" did you mean something else?
To do this, I could add a check to the 50ish nw_t1_ or x2_t1_ scripts to see if they should activate, right? (Sir Elric's system doesn't specify a custom impact script, so it uses the defaults)
Here is an impact script that directly looks up the script for you.
void main()
{
object oEnter = GetEnteringObject();
object oFaction = GetLocalObject(GetArea(oEnter), "TrapFaction");
if(GetFirstFactionMember(oFaction) == GetFirstFactionMember(oEnter)) return;
ExecuteScript(Get2DAString("traps", "TrapScript", GetTrapBaseType(OBJECT_SELF)), OBJECT_SELF);
DestroyObject(OBJECT_SELF, 0.1);
}
#5
Posté 23 avril 2013 - 12:47
set to 1 on any npc you want to not activate the trap. In this way you could have some npc's that would trigger the trap, or maybe a friendly npc guide that shows the pc, (sets the local No_TrapMe) in a certain area for a certain time where the traps are, so they can be avoided, or perhaps recovered. You can always make them unrecoverable, if you want.
Regarding traps:
http://nwvault.ign.c....Detail&id=3632
Modifié par ffbj, 23 avril 2013 - 12:52 .
#6
Posté 23 avril 2013 - 01:24
#7
Posté 24 avril 2013 - 02:43
WhiZard wrote...
void main()
{
object oEnter = GetEnteringObject();
object oFaction = GetLocalObject(GetArea(oEnter), "TrapFaction");
if(GetFirstFactionMember(oFaction) == GetFirstFactionMember(oEnter)) return;
ExecuteScript(Get2DAString("traps", "TrapScript", GetTrapBaseType(OBJECT_SELF)), OBJECT_SELF);
DestroyObject(OBJECT_SELF, 0.1);
}
This worked nicely for me. Comparing first faction members of two objects and firing the trap script based on its 2da entry were both new ways to do things I previously didn't know - got my answer and learned a few things at the same time.
Thanks to both of you.





Retour en haut






