Calling the "Actor"?

Post » Mon May 07, 2012 9:34 am

I'm a bit confused as to how to call an NPC. If it is a specific NPC you can just use their ID, but it there a way to perform something on a generic NPC? I.e. one that does something detected by a script function?

Also, I keep seeing the term "Actor->" in tutorials. Is this specific to a local script, in such that "Actor" is the NPC possessing that script?

In short, I'm attempting to perform some action upon an attacked NPC, and thus can't use its specific ID.
User avatar
Lindsay Dunn
 
Posts: 3247
Joined: Sun Sep 10, 2006 9:34 am

Post » Mon May 07, 2012 9:45 am

"actor" generally refers to the specific npc id you want t use.

what you may do instead of specifying the NPC and calling "gettarget" is "getsoundplaying" and specify hit sounds.
User avatar
Shaylee Shaw
 
Posts: 3457
Joined: Wed Feb 21, 2007 8:55 pm

Post » Mon May 07, 2012 1:37 pm

That's actually what I started trying to do actually. So I can successfully say "ok, that sound is played, someone is getting attacked," but I couldn't see a way to see if an npc was being attacked and to direct an action to that attacked npc. If it's the player, I assumed it player->getsoundplaying "...." == 1, and then some action on the player. But what about the npc?
User avatar
Tammie Flint
 
Posts: 3336
Joined: Mon Aug 14, 2006 12:12 am

Post » Mon May 07, 2012 12:14 pm

I do not have the answer to the last part, but I know from my own experience you CAN reference an actor without having knowledge of the actors ID using MWSE. You are able to call scripts based upon reference even if you don't have a specific ID available or you want a generic run for any given NPC.

ST
User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Mon May 07, 2012 1:04 am

I imaged as much for the script extender. I was really hoping there might be some way to do it without it though, if even by a gimmick. It just seems like surely the developers would have put in something similar into the script possibilities though....
User avatar
SaVino GοΜ
 
Posts: 3360
Joined: Mon Sep 17, 2007 8:00 pm

Post » Mon May 07, 2012 9:08 am

it's a tough one, especially without knowing what you are trying to do. bear in mind that MWSE SEEMS a lot harder to use than it really is.

for "getsoundplaying" you dont need a fix, the "player->" part.

if you are wanting just a certain type of generic NPC you have added to do something, you'd do well just having the same local script on them. as simple as having multiple copies of an NPC with a script attached. if it's something you want EVERYONE to do, the only way i can really think of doing it is scanning all NPCs nearby for "gettarget, player == 1" though i'm not sure how that would work if you have any NPCs on aifollow
User avatar
Josee Leach
 
Posts: 3371
Joined: Tue Dec 26, 2006 10:50 pm

Post » Mon May 07, 2012 12:32 pm

So what you saying is a global script like:

Begin Blahblah

GetTarget, Player == 1

"some action"

End Blahblah

Would cause all NPC's targetting the player to do "some action."?
User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Mon May 07, 2012 1:05 pm

Apart from using extender commands (with pros and cons),
there is a (limited) way to address NPC classes based on dialog voices filtering, and apply a http://mwmodders.com/scriptingnotes.html.
Problems
- you are limited to voice events, their possible filtering and their probability (standard min 10% of fVoiceIdleOdds, iVoiceAttackOdds - max. 30% for iVoiceHitOdds)
- as (contrary to a single local script) a single global script can not be targeted to multiple NPC, you have to implement a pool of similar global scripts and a recycling logic.

Even with these limitations, many things can be accomplished, from http://abot.silgrad.com/guppy/index.php?option=content&Itemid=67&task=viewpost&id=29&-Loot-control to http://planetelderscrolls.gamespy.com/View.php?view=mods.detail&id=771
User avatar
Laura
 
Posts: 3456
Joined: Sun Sep 10, 2006 7:11 am

Post » Mon May 07, 2012 1:13 am

So apart from that voice/sound trick, there's no way to perform an action on "any" npc by something that is happening/some attribute without directly attaching the script to them or calling their unique ID?
User avatar
Stephanie I
 
Posts: 3357
Joined: Thu Apr 05, 2007 3:28 pm

Post » Mon May 07, 2012 5:07 am

Not that I know
User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Mon May 07, 2012 1:36 pm

perhaps through dialog.... that's how i do it anyway.

sounds like this method would be incompatible with what you're trying to do though.

for example, in my mod - my only one, the faction mod in my sig - you can talk to any fighters guild member and send them out to find work. you can also send any thieves guild member out on a job.


the way i do it is with one global script, a few global variables, targeted scripts (that abot mentioned above) and dialog.

the global script is mainly in charge of initializing things. dialog choices flip a global variable and start the targeted script. the targeted script does everything, and the globals transfer the data back and forth (as targeted scripts cannot use their local variables as dialog conditionals)
User avatar
Dean
 
Posts: 3438
Joined: Fri Jul 27, 2007 4:58 pm

Post » Mon May 07, 2012 3:08 am

You can use anything that can be filtered in dialog to be assigned to a NPC. Voices are triggered automatically on certain events (player at hello distance, NPC hit, NPC attacking...), while dialog topics require player talking with NPC. The way of using (filter, start a global targeted script from dialog result) is the same, the only difference between using voices vs topics is how often/when things are triggered
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Mon May 07, 2012 12:55 am

here's the tricky part, how would we get any npc to walk up and forcegreet? assuming he wants to do something in combat, the only thing i can think of doing it is having a global script checking NPCs for gettarget-> player with MWSE, scanning a reference a frame.
User avatar
Amy Siebenhaar
 
Posts: 3426
Joined: Fri Aug 10, 2007 1:51 am

Post » Mon May 07, 2012 6:57 am

here's the tricky part, how would we get any npc to walk up and forcegreet? assuming he wants to do something in combat, the only thing i can think of doing it is having a global script checking NPCs for gettarget-> player with MWSE, scanning a reference a frame.
This is why we need voices, they auto-trigger. In the very simple example I linked, using the 10% chance of triggering NPC attack voice, still the real ratio of affected NPCs is high, I think that is because event chance is low, but event frequency is high, so you are never sure 100% of attacking NPCs will be affected, but the majority (those who say something=play attack voice) is.
In this particular case, as we need just one/any NPC to detect player, it could be a usable method (assuming you want to apply to hostile NPCs)
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am


Return to III - Morrowind