Scripting control of npcs -1 reply

  • 1
  • 2

Please wait...

ajcrow

He's just some guy, you know?

50 XP

12th March 2007

0 Uploads

116 Posts

0 Threads

#1 10 years ago

Hey. I was wondering if anybody would know how I would construct a script to enable me to control an npc (like how you can control the mouse and r5 droids in jk2)

I honestly would have no idea how to start.

Thanks.




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#2 10 years ago

It will only work in SP, but I think you just need one line.

SET_VIEWTARGET

I may be wrong, because I've never used it. But according to the documentation, that's what that command does. All you need is an npc with a targetname.

Check that out, it should get you on your way.




ajcrow

He's just some guy, you know?

50 XP

12th March 2007

0 Uploads

116 Posts

0 Threads

#3 10 years ago

Awesome.

Thanks a lot.




ajcrow

He's just some guy, you know?

50 XP

12th March 2007

0 Uploads

116 Posts

0 Threads

#4 10 years ago

Just a LITTLE problem...:(

When ever I give a npc a targetname, it refuses to spawn.

Am I going to have to make a spawn script for it? :confused:

(I presume this because when i typed in "npc kill all" I got a message saying that the npc was a "spawner")




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#5 10 years ago

I got the wrong variable. The correct variable is SET_VIEWENTITY. My bad.

If you give an NPC a targetname, it needs fired by a trigger somewhere, and it will spawn when triggered. Give that a shot, and if that doesn't work, there's one other possibility. :)




ajcrow

He's just some guy, you know?

50 XP

12th March 2007

0 Uploads

116 Posts

0 Threads

#6 10 years ago

All right, thanks.

I guessed about the view entity thing, but the trigger thing really helped.




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#7 10 years ago

If targetname fails to change your view to the NPC, you may need to use an npc_targetname or npc_target instead.......I forget which. Otherwise, it's up to a manual or a more experienced modder to answer your question.




jk3editor

Retard Hungarian Modder

50 XP

21st August 2008

0 Uploads

1,520 Posts

0 Threads

#8 10 years ago

[COLOR=Navy]I think you should open from the JK2 the kejim_base map...on that's end there is a control with a mouse, and the script there are in the assets0.pk3...and the essence is that, what ov_nab622 sait, use VIEWENTITY;) .........Sry, I can't understand everything....did you fix the problem, or no?:D [/COLOR]




ajcrow

He's just some guy, you know?

50 XP

12th March 2007

0 Uploads

116 Posts

0 Threads

#9 10 years ago

No, I haven't yet been able to get it to work, but I think that it's because of how I've set it up in my map.

The script I made is just a one liner "set view entity" so it should be working.

I've just got to set this map up to work.

I hate scripting...




NAB622

EAT ME!

50 XP

8th October 2005

0 Uploads

6,921 Posts

0 Threads

#10 10 years ago

Post a screenshot of the script, and a screenshot of the entity window (with the NPC selected, of course). That'll make it pretty easy for us to help you.




  • 1
  • 2