NPC's guard tradeskill tools

Moderator: Event DM

Post Reply
User avatar
Neve
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands
Contact:

NPC's guard tradeskill tools

Post by Neve » Sat Sep 20, 2003 12:48 pm

Put this in OnDamaged of a placable to have any NPC attack the attacker of the placable after two warnings. Maybe this is useful ?

Code: Select all

void ShoutWarning(object oNPC, int iNumber, object oTerrorist){
    string Warning = "";

    switch(iNumber){
        case 1 :
            switch(d6()){
                case 1 : Warning = "Hey, what the hell are you doing ? Quit that immediately.";
                break;
                case 2 : Warning = "Please refrain from doing that.";
                break;
                case 3 : Warning = "Hey. Stop that !";
                break;
                case 4 : Warning = "Quit that you lunatic !";
                break;
                case 5 : Warning = "Hey. What do you think you're doing ?";
                break;
                case 6 : Warning = "What the... Stop immediately !";
                break;
            }
            AssignCommand(oNPC, ActionSpeakString(Warning));
            break;
        case 2 :
            switch(d3()){
                case 1 : Warning = "Last warning. Quit NOW.";
                break;
                case 2 : Warning = "I won't warn you again. Stop that.";
                break;
                case 3 : Warning = "Keep it up and I'll smack you in the face. Quit that !";
                break;
            }
            AssignCommand(oNPC, ActionSpeakString(Warning));
            break;
        case 3 :
            AssignCommand(oNPC, ActionSpeakString("Now you're in for it !"));
            AssignCommand(oNPC, PlayVoiceChat(d3()));
            SetLocalInt(oNPC, GetName(oTerrorist), 2);
            SetIsTemporaryEnemy(oTerrorist, oNPC, TRUE, 90.0);
            AssignCommand(oNPC, ActionAttack(oTerrorist));
        break;
    }
}

void Warn(object oNPC, object oTerrorist){
    ShoutWarning(oNPC, GetLocalInt(oNPC, GetName(oTerrorist)), oTerrorist);
    SetLocalInt(oNPC, GetName(oTerrorist), GetLocalInt(oNPC, GetName(oTerrorist)) + 1);
}

int GetIsHumanoid(object oObject){
    if(GetIsPC(oObject) || GetObjectType(oObject) != OBJECT_TYPE_CREATURE) return 0;
    if( GetRacialType(oObject) == RACIAL_TYPE_DWARF     ||
        GetRacialType(oObject) == RACIAL_TYPE_ELF       ||
        GetRacialType(oObject) == RACIAL_TYPE_GNOME     ||
        GetRacialType(oObject) == RACIAL_TYPE_HALFELF   ||
        GetRacialType(oObject) == RACIAL_TYPE_HALFLING  ||
        GetRacialType(oObject) == RACIAL_TYPE_HALFORC   ||
        GetRacialType(oObject) == RACIAL_TYPE_HUMAN)
        return 1;
    return 0;
}

void main(){
    object oTerrorist = GetLastDamager();
    object oNPC = GetFirstObjectInArea();

    while(GetIsObjectValid(oNPC)){
        if(GetIsHumanoid(oNPC) && GetDistanceBetween(oNPC, oTerrorist) <= 25.0){
            if(GetLocalInt(oNPC, GetName(oTerrorist)) < 1)
                AssignCommand(oNPC, ActionMoveToObject(oTerrorist, FALSE, 3.0));
            Warn(oNPC, oTerrorist);
        }
        oNPC = GetNextObjectInArea();
    }
}
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Gaelyn Faerstryd
Team Member; Retired with Honors
Posts: 1813
Joined: Sat Feb 22, 2003 2:24 am
Timezone: Eastern
Location: Quebec, Canada (GMT -5)

Post by Gaelyn Faerstryd » Sat Sep 20, 2003 1:05 pm

Nice! Can this script be implemented? If so, can the cost be negotiated IC during the hiring of said guards?

Gaelyn.
User avatar
Garand
Apprentice Scholar
Posts: 559
Joined: Wed Apr 23, 2003 10:07 pm
Location: San Antonio, TX (GMT -6)
Contact:

Post by Garand » Sat Sep 20, 2003 5:52 pm

I know nothing about scripting, but if this sort of thing works I think this would be a great thing to impliment. If this sort of thing were added I think it would do alot to quell some of the problems people are having with the whole "anvil killer" plotline.

ie. NPCs would react to the situation and therefore make it more "realistic"
LuditeOfAvlis
Whiney Peasant
Posts: 17
Joined: Sat Aug 02, 2003 6:35 pm

Post by LuditeOfAvlis » Sat Sep 20, 2003 6:06 pm

Knowing nothing of scripting, this looks cool. I assume the NPC in question has to actually see/hear the PC in question though for this to work?

Now I'm going to have to watch that lovely "auto-attack feature" that Bioware has blessed us with when the hostile NPCs come running up. :roll:
User avatar
Titanium Dragon
Sage
Posts: 2916
Joined: Sun Apr 27, 2003 5:18 pm
Location: Corvallis, OR (GMT - 7)
Contact:

Post by Titanium Dragon » Sat Sep 20, 2003 9:42 pm

Bravo!
User avatar
Neve
Prince of Bloated Discourse
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands
Contact:

Post by Neve » Sat Sep 20, 2003 11:20 pm

LuditeOfAvlis wrote:Knowing nothing of scripting, this looks cool. I assume the NPC in question has to actually see/hear the PC in question though for this to work?
Well... "See"... I'm sure someone who's around will hear people smash their swords on an anvil. The NPC's walk towards the attacker first yelling a warning. Next they'll give a clear "last" warning. After, they'll attack. Basically, all NPC's within a range of 25 metres will respond (That's about the range of a screen, zoomed out if I'm not mistaken, so evil chars still get a fair chance to destroy stuff if their evil friends lure away the NPC's ;) )

[edit] The NPC's are mercyful, they'll change from hostile to neutral 90 seconds after they attack, unless they get attacked of course
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
Post Reply