Calling the "Actor"?

Post » Fri May 27, 2011 8:50 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
Crystal Birch
 
Posts: 3416
Joined: Sat Mar 03, 2007 3:34 pm

Post » Fri May 27, 2011 6:58 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
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am

Post » Sat May 28, 2011 5:35 am

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
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Sat May 28, 2011 3:08 am

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
Manuela Ribeiro Pereira
 
Posts: 3423
Joined: Fri Nov 17, 2006 10:24 pm

Post » Sat May 28, 2011 3:47 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
Shirley BEltran
 
Posts: 3450
Joined: Wed Jul 26, 2006 4:14 pm

Post » Fri May 27, 2011 10:41 pm

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
Rachel Briere
 
Posts: 3438
Joined: Thu Dec 28, 2006 9:09 am

Post » Sat May 28, 2011 3:57 am

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
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Sat May 28, 2011 10:45 am

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
Philip Lyon
 
Posts: 3297
Joined: Tue Aug 14, 2007 6:08 am

Post » Sat May 28, 2011 1:54 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
Peter lopez
 
Posts: 3383
Joined: Mon Sep 10, 2007 5:55 pm

Post » Sat May 28, 2011 1:51 am

Not that I know
User avatar
Lily Evans
 
Posts: 3401
Joined: Thu Aug 31, 2006 11:10 am

Post » Sat May 28, 2011 10:07 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
kirsty joanne hines
 
Posts: 3361
Joined: Fri Aug 18, 2006 10:06 am

Post » Sat May 28, 2011 1:10 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
Angelina Mayo
 
Posts: 3427
Joined: Wed Jan 24, 2007 4:58 am

Post » Sat May 28, 2011 7:49 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
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm

Post » Sat May 28, 2011 4:31 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
Niisha
 
Posts: 3393
Joined: Fri Sep 15, 2006 2:54 am


Return to III - Morrowind