Advanced Search

Author Topic: So About Adding NPCs...  (Read 3836 times)

0 Members and 1 Guest are viewing this topic.

August 02, 2017, 12:53:37 AM
Read 3836 times

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
So About Adding NPCs...
« on: August 02, 2017, 12:53:37 AM »
Could anybody send some information on how to mod in some custom NPCs, I would greatly appreciate the help.  :D

August 02, 2017, 02:11:00 AM
Reply #1

Offline Korby

  • Global Moderator

  • Benvenuto nella room italiana!
  • **************
  • Date Registered: March 04, 2010, 03:36:02 AM

    • View Profile
    • Korby Games
Re: So About Adding NPCs...
« Reply #1 on: August 02, 2017, 02:11:00 AM »
That depends entirely on what you want the NPCs to do.
If you just want them to stand around and look pretty, that's pretty easy.
If you want them to act like the robot masters in Light Labs, that's a little more difficult.

August 02, 2017, 02:18:57 AM
Reply #2

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #2 on: August 02, 2017, 02:18:57 AM »
That depends entirely on what you want the NPCs to do.
If you just want them to stand around and look pretty, that's pretty easy.
If you want them to act like the robot masters in Light Labs, that's a little more difficult.
So if I would like them to act like they are in Light's lab, how would one do such a thing?

August 02, 2017, 10:09:08 AM
Reply #3

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #3 on: August 02, 2017, 10:09:08 AM »
So first things first, you need an NPC actor.
Code: [Select]
actor DunkelmanProp : CutmanProp 19643
{
//$Category MM8BDM-NPC
Translation "198:198=41:41", "198:198=228:228"
States
{
Spawn:
BARB A 5 A_LookEx(LOF_NOSOUNDCHECK, 0, 100, 0, 360, "See")
loop
See:
BARB A 5 ACS_Execute(101,0,1)
Goto Spawn
Talking:
BARB IAIAIAIAIAIAIAIAIA 4
Goto Spawn
}
}
That'll do. Then you need a talk script.
Code: [Select]
int talkdelay = (35*4);
Script 101 (int whichcharacter)
{
int message = Random(0, 4);
int PropTID = ActivatorTID();
    while(OldMessage == message) //Ensuring NPCs don't repeat.
    {
        message = Random(0,4);
    }
TakeActorInventory(PropTID, "CutterFlag", 10);
GiveActorInventory(PropTID, "CutterFlag", message);
SetActorState(PropTID,"Talking",0);
    switch(whichcharacter)
    {
Case 1:
                    switch(message)
                    {
                        Case 0:
                            NPC_Talk (0.8, 1, "rabble rabble");
                            Delay(talkdelay); break;
                        Case 1:
                            NPC_Talk (0.8, 1, "chit chat");
                            Delay(talkdelay); break;
                        Case 2:
                            NPC_Talk (0.8, 1, "babble babble");
                            Delay(talkdelay); break;
                        Case 3:
                            NPC_Talk (0.8, 1, "blah blah");
                            Delay(talkdelay); break;
                        Case 4:
                            NPC_Talk (0.8, 1, "eyjafjallajokull");
                            Delay(talkdelay/2); SetActorState(105,"Talking",0);
                            NPC_Talk (0.85, 2, "it's a long long name"); //multiple lines!
                            Delay(talkdelay); break;
                    }
break;
}
}

Function void NPC_talk (int whatline, int whichone, str talkertext)
{
LocalAmbientSound("misc/chat",127);
SETFONT("SMALLFONT");
HudMessage(s:talkertext; HUDMSG_PLAIN, whichone, CR_GRAY, 0.0, whatline, 4.5);
}
This is a pretty basic NPC, but it'll do. Modify to your own specifications, and have fun writing funny one-liners.

August 02, 2017, 02:11:21 PM
Reply #4

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #4 on: August 02, 2017, 02:11:21 PM »
Ok, so one last thing. In game, the NPC won't talk because it says that script 101 is missing. Is there a fix to that?

August 02, 2017, 02:20:06 PM
Reply #5

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #5 on: August 02, 2017, 02:20:06 PM »
Simply add the talk script into the level that the NPC is in.

August 02, 2017, 03:55:54 PM
Reply #6

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #6 on: August 02, 2017, 03:55:54 PM »
For some reason, the game cannot load the script even when i put the script into the level. I've also tried placing the talk script in the map script and the actual script file and the script just doesn't load. Idk if i'm doing something incorrectly. :(

August 02, 2017, 05:01:11 PM
Reply #7

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #7 on: August 02, 2017, 05:01:11 PM »
Judging from the fact that you're quite new to this, I'd hazard to guess you aren't compiling the scripts. If that's the case, and you don't have an ACS compiler, you can find an ACS compiler here under the name of ACC.

If that's not the case, then I've no clue.

August 02, 2017, 06:36:39 PM
Reply #8

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #8 on: August 02, 2017, 06:36:39 PM »
Judging from the fact that you're quite new to this, I'd hazard to guess you aren't compiling the scripts. If that's the case, and you don't have an ACS compiler, you can find an ACS compiler here under the name of ACC.

If that's not the case, then I've no clue.

Well I compiled the Scripts and actually got it to work... somewhat. I can see the npc speaking but cannot see the actual dialogue.

August 02, 2017, 07:34:48 PM
Reply #9

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #9 on: August 02, 2017, 07:34:48 PM »
Do you hear them speaking?

August 02, 2017, 07:46:35 PM
Reply #10

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #10 on: August 02, 2017, 07:46:35 PM »
Nah. The speaking sound doesn't play either.

August 02, 2017, 10:17:27 PM
Reply #11

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #11 on: August 02, 2017, 10:17:27 PM »
Hmm. Can you upload the file so I can see what's going on?

August 03, 2017, 12:23:22 AM
Reply #12

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #12 on: August 03, 2017, 12:23:22 AM »
Okay here is the map:
http://www.mediafire.com/file/8rs7mxa5w86izgi/Kain%27sStrangeHideout.wad

The NPC I would like to alter is the GutsMan prop in the lower left corner.


The map itself is a work in progress though which is why i wanted to add NPCs in the first place.

August 03, 2017, 07:56:44 AM
Reply #13

Offline Xhatahx

  • Standard Member

  • *sregnif sevaelretni* stenet wef a evah I
  • Date Registered: September 03, 2016, 07:21:47 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #13 on: August 03, 2017, 07:56:44 AM »
You accidentally set Script Argument 1 to 11. It should be set to 1.
also i just murdered frost man

August 03, 2017, 01:51:30 PM
Reply #14

Offline CoolHuman

  • Standard Member
  • Date Registered: August 02, 2017, 12:42:31 AM

    • View Profile
Re: So About Adding NPCs...
« Reply #14 on: August 03, 2017, 01:51:30 PM »
You accidentally set Script Argument 1 to 11. It should be set to 1.
also i just murdered frost man
Well then... I suppose I was just being really unobservant and forgot that the script argument was supposed to be unique to the NPC.

So thanks for helping me.