Author Topic: Help with script/faction issue  (Read 331 times)

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Help with script/faction issue
« on: June 26, 2011, 06:40:57 pm »


               Hey!
I was trying my skills at scripting today, as my ordinary scripter is away. It didn't go well, lol. So, I thought I'd present my problem to you, the REAL scripters '<img'>

Basically there are two steps; one special faction and one script. I created a special faction for the creature in mind, and then the script that is OnEnter in the area the creature lives.

The faction is hostile to all creatures and PC's. Here's how it should work:

Upon entering the Baelnorn's home, the creature attacks all but elves and half-elves.

The problem I have is that when an elf enters the encounter trigger, nothing happens; no Baelnorn spawns. But, when a non-elf enters, the Baelnorn spawns and attacks, as it should. What did I do wrong? Here's the script I made:

object oTarget;
//Put this script OnEnter
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
if ((GetRacialType(oPC)==RACIAL_TYPE_ELF)||
    (GetRacialType(oPC)==RACIAL_TYPE_HALFELF))
   {
   oTarget = GetObjectByTag("Baelnorn");
   AdjustReputation(oPC, oTarget, 100);
   }
}


Can you please help me figure out why the elf PC doen't spawn the Baelnorn?

Thanks for your time '<img'>

-Snottling
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
Help with script/faction issue
« Reply #1 on: June 26, 2011, 07:55:10 pm »


               I don't really know how encounters work, so I can't help with that, but imho it would be simpler to have him spawn with no scripts on the encounter, and then add your race&reputation part to Baelnorn's OnPerception event.

Make sure you dont erase anything from the default OnPerception script, and also be sure to save it under a different name. Otherwise all your NPCs will favor elves.
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
Help with script/faction issue
« Reply #2 on: June 26, 2011, 08:44:35 pm »


               That script is your trigger onenter script?
               
               

               
            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Help with script/faction issue
« Reply #3 on: June 26, 2011, 08:54:25 pm »


               No, the script is the Area OnEnter event.
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Help with script/faction issue
« Reply #4 on: June 26, 2011, 09:58:05 pm »


               Well this is only the adjustment script so where is the spawn script? If you are using the standard Bioware spawn the problem may be the adjustment to friendly.  One easy way to try to check this is to add a DelayCommand of 5.0 seconds or so to the adjustment of the object monster too friendly.
In other words if the spawning occurs by a trigger later than the onenter area script, the stipulation of the the standard spawner that only hostile creatures are spawned is being interfered with.  I know that does not make sense but it's worth a try.
               
               

               
            

Legacy_Snottling

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
Help with script/faction issue
« Reply #5 on: June 27, 2011, 01:39:17 pm »


               Just wanted to say that it's working now. I ended up putting the race check and reputation change on the OnSpawn event of the creature.
Thanks for your time.

-Snottling