Calling the "Actor"?

Post » Wed Nov 30, 2011 6:39 pm

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
Cathrine Jack
 
Posts: 3329
Joined: Sat Dec 02, 2006 1:29 am

Post » Wed Nov 30, 2011 10:12 pm

"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
Scott Clemmons
 
Posts: 3333
Joined: Sun Sep 16, 2007 5:35 pm

Post » Wed Nov 30, 2011 11:18 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
Adrian Morales
 
Posts: 3474
Joined: Fri Aug 10, 2007 3:19 am

Post » Wed Nov 30, 2011 11:33 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
Christine Pane
 
Posts: 3306
Joined: Mon Apr 23, 2007 2:14 am

Post » Wed Nov 30, 2011 10:46 pm

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
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Thu Dec 01, 2011 4:55 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
Iain Lamb
 
Posts: 3453
Joined: Sat May 19, 2007 4:47 am

Post » Wed Nov 30, 2011 4:43 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
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Wed Nov 30, 2011 8:44 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
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am

Post » Thu Dec 01, 2011 7:53 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
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Thu Dec 01, 2011 12:55 am

Not that I know
User avatar
mike
 
Posts: 3432
Joined: Fri Jul 27, 2007 6:51 pm

Post » Thu Dec 01, 2011 3:16 am

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
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Thu Dec 01, 2011 12:35 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
Richard Thompson
 
Posts: 3302
Joined: Mon Jun 04, 2007 3:49 am

Post » Wed Nov 30, 2011 9:06 pm

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
Kit Marsden
 
Posts: 3467
Joined: Thu Jul 19, 2007 2:19 pm

Post » Thu Dec 01, 2011 7:09 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
Annika Marziniak
 
Posts: 3416
Joined: Wed Apr 18, 2007 6:22 am


Return to III - Morrowind