Quick Questions -- Quick Answers, The 22nd

Post » Wed Jul 21, 2010 11:21 pm

Previous thread : http://www.gamesas.com/index.php?/topic/1082474-quick-questions-quick-answers-the-21st/

Got a quick question? Post here for a quick response.
User avatar
Eliza Potter
 
Posts: 3481
Joined: Mon Mar 05, 2007 3:20 am

Post » Thu Jul 22, 2010 2:11 am

Would someone mind writing (what I think is) a very small script for me? I need a script that will be applied to a chair, and when the player attempts to sit down on the chair 200 points of shock damage will be inflicted on them. 200 is just a temporary number, I'll change it to suit my needs later on. I'm quite inexperienced at scripting so any help is very appreciated.
User avatar
helliehexx
 
Posts: 3477
Joined: Fri Jun 30, 2006 7:45 pm

Post » Thu Jul 22, 2010 9:09 am

scn useThisScriptbegin onActivate player   cast ShockSpell playerend

User avatar
*Chloe*
 
Posts: 3538
Joined: Fri Jul 07, 2006 4:34 am

Post » Wed Jul 21, 2010 6:43 pm

scn useThisScriptbegin onActivate player   cast ShockSpell playerend



Thanks! I'm assuming this wont work on NPCs though, right? Is there any way to alter it to make it work on NPCs?
User avatar
Red Sauce
 
Posts: 3431
Joined: Fri Aug 04, 2006 1:35 pm

Post » Thu Jul 22, 2010 8:23 am

scn useThisScriptref actRefbegin onActivate   set actRef to getActionRef   cast ShockSpell actRefend

User avatar
Prue
 
Posts: 3425
Joined: Sun Feb 11, 2007 4:27 am

Post » Thu Jul 22, 2010 7:58 am

scn useThisScriptref actRefbegin onActivate   set actRef to getActionRef   cast ShockSpell actRefend



Does that work on any NPC that walks by? I'm looking to make it so that this can be applied to any random chair and any NPC that is set to sit in it will get shock damage.
User avatar
Jesus Duran
 
Posts: 3444
Joined: Wed Aug 15, 2007 12:16 am

Post » Thu Jul 22, 2010 9:35 am

Yes.
User avatar
Susan Elizabeth
 
Posts: 3420
Joined: Sat Oct 21, 2006 4:35 pm

Post » Thu Jul 22, 2010 4:25 am

scn useThisScriptref actRefbegin onActivate   set actRef to getActionRef   cast ShockSpell actRefend


Wouldn't that need an extra 'activate' command in order for the NPC to actually sit down?

Unless the idea is to shock them the moment they touch the chair, before sitting down...
User avatar
Juan Cerda
 
Posts: 3426
Joined: Thu Jul 12, 2007 8:49 pm

Post » Thu Jul 22, 2010 8:35 am

Yes.


Thanks a lot then.
User avatar
Soku Nyorah
 
Posts: 3413
Joined: Tue Oct 17, 2006 1:25 pm

Post » Wed Jul 21, 2010 8:34 pm

Unless the idea is to shock them the moment they touch the chair, before sitting down...
I thought that was it.
User avatar
Andrew Perry
 
Posts: 3505
Joined: Sat Jul 07, 2007 5:40 am

Post » Thu Jul 22, 2010 1:11 am

Wouldn't that need an extra 'activate' command in order for the NPC to actually sit down?

Unless the idea is to shock them the moment they touch the chair, before sitting down...


I was planning on having them sit down first, yes.
User avatar
Vickytoria Vasquez
 
Posts: 3456
Joined: Thu Aug 31, 2006 7:06 pm

Post » Wed Jul 21, 2010 8:55 pm

Quick NPC/script question. :)

I have NPCs that spawn with level lists (as mentioned in the previous thread)
These NPCs, when spawned, have a script that puts them in a faction and give them items.

I've added lines that, on death, will "clean" them. That is, removing them from the faction and setting all variables use in their script to "False"
Is this needed? When a NPC who has the "respawn" box checked AND set to a leveled list, does he keep the scripted modifications when respawned or will the marker simply spawn a fresh, new NPC with a new reference ID?

Thanks!
User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am

Post » Wed Jul 21, 2010 11:55 pm

Is this needed? When a NPC who has the "respawn" box checked AND set to a leveled list, does he keep the scripted modifications when respawned or will the marker simply spawn a fresh, new NPC with a new reference ID?
No - Existing respawnable actors are purged and new ones are created from the list. Changes to faction info made with script functions however persists.
User avatar
Justin Bywater
 
Posts: 3264
Joined: Tue Sep 11, 2007 10:44 pm

Post » Thu Jul 22, 2010 1:18 am

No - Existing respawnable actors are purged and new ones are created from the list. Changes to faction info made with script functions however persists.


I see, thanks!

Another quick question. ;)
This time, regarding calling references.

There is sometimes a slight chance that two leveled creature markers will spawn the same NPC. The script attached on the NPC's editor ID is, thus, the same. The script places the NPC in a random faction and depending on the faction, it gives him different items to spawn with.

In-game, even though the two NPCs are assigned a different faction, they also belong to each other's faction. Does that mean that a script's changes on an NPC will add to another NPC sharing the same Editor ID?

If such is the case, do I need in the script to write a "Ref Actor" at the start and place the "Actor." before every variable and change in the script?

Example:

scn OblivifallBINPCPriestScriptshort InitialisationCompleteshort AffliatedGodShort ReligionShort GodChosenShort ReligionChosenShort ClearBackgroundShort JulianosRobeShort StendarrRobeShort TalosRobeShort ArkayRobeSilverShort ArkayRobeBlackref ActorBegin GameModeIf Actor.InitialisationComplete == 0 && Actor.ReligionChosen == 0		Actor.Set ReligionChosen to 1 endifIf Actor.InitialisationComplete == 0 && Actor.ReligionChosen == 1		Actor.set AffliatedGod to GetRandomPercent			If Actor.GetRandomPercent >= 99 && Actor.ReligionChosen == 1				MessageBox "I am from Akatosh Chantry. DEBUG"				Actor.SetFactionRank OblivifallLMRGodAkatoshChantry 5				Actor.Set ReligionChosen to 2				Actor.Set GodChosen to 1			Elseif Actor.GetRandomPercent >= 88 && ReligionChosen == 1				MessageBox "I am from Mara. DEBUG"				Actor.SetFactionRank OblivifallLMRGodBenevolenceOfMara 5				Actor.Set ReligionChosen to 2				Actor.Set GodChosen to 1


If not, how can I avoid this problem?
User avatar
Brian Newman
 
Posts: 3466
Joined: Tue Oct 16, 2007 3:36 pm

Post » Thu Jul 22, 2010 12:35 am

Is there a way to detect if the player is a target to a sun damage effect? And maybe getting the magnitude of the effect? :)
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Thu Jul 22, 2010 5:34 am

There is sometimes a slight chance that two leveled creature markers will spawn the same NPC. The script attached on the NPC's editor ID is, thus, the same. The script places the NPC in a random faction and depending on the faction, it gives him different items to spawn with.

In-game, even though the two NPCs are assigned a different faction, they also belong to each other's faction. Does that mean that a script's changes on an NPC will add to another NPC sharing the same Editor ID?

If such is the case, do I need in the script to write a "Ref Actor" at the start and place the "Actor." before every variable and change in the script?

If not, how can I avoid this problem?

The script associates any variables with the reference to the actor placed in the game. So, two actors with the same base object running identical scripts will be treated separately and the scripts will not conflict. That's not a problem in this case, and it means that using a specific reference to them won't change anything.

The problem is that things like SetFactionRank, and SetName and a few others work on the Base Object of the NPC, so changes will be applied to every reference to that base object. I don't believe there is any way to have two spawned references from a single base object with different factions.

If this is a huge problem for what you are doing, you'll have to substitute some other system than factions to differentiate the NPCs. Placing different tokens on them and basing their dialogue and reactions on the presence of the tokens, perhaps.
User avatar
Emmie Cate
 
Posts: 3372
Joined: Sun Mar 11, 2007 12:01 am

Post » Wed Jul 21, 2010 11:03 pm

The script associates any variables with the reference to the actor placed in the game. So, two actors with the same base object running identical scripts will be treated separately and the scripts will not conflict. That's not a problem in this case, and it means that using a specific reference to them won't change anything.

The problem is that things like SetFactionRank, and SetName and a few others work on the Base Object of the NPC, so changes will be applied to every reference to that base object. I don't believe there is any way to have two spawned references from a single base object with different factions.

If this is a huge problem for what you are doing, you'll have to substitute some other system than factions to differentiate the NPCs. Placing different tokens on them and basing their dialogue and reactions on the presence of the tokens, perhaps.


Thank you for the answer Showler. :D
I see, what I will do then is create other NPCs who already belong to the faction and put them in the lists.

These NPCs are for Oblivion Comes Alive, where there are markers spread around the world that spawn NPCs that have randomized equipment and appearance. I wanted to avoid creating new faction NPCs by using SetFactionRank when they spawn. No matter. I've already created around 1200 NPCs, I can create more. :P
User avatar
Marie
 
Posts: 3405
Joined: Thu Jun 29, 2006 12:05 am

Post » Thu Jul 22, 2010 5:32 am

I thought that was it.

I wasn't sure, that's why I asked. :)
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Thu Jul 22, 2010 7:48 am

Thank you for the answer Showler. :D
I see, what I will do then is create other NPCs who already belong to the faction and put them in the lists.

These NPCs are for Oblivion Comes Alive, where there are markers spread around the world that spawn NPCs that have randomized equipment and appearance. I wanted to avoid creating new faction NPCs by using SetFactionRank when they spawn. No matter. I've already created around 1200 NPCs, I can create more. :P

The danger with such a widespread usage of NPCs in this way is that NPCs who are spawned will be placed in a given faction, but, if they are not killed, any duplicate NPCs that use the same base will not only spawn as a different faction, but will also remain being part of the faction of what the previous spawn was.

Get rid of the script based faction variation and you should be fine.
User avatar
Star Dunkels Macmillan
 
Posts: 3421
Joined: Thu Aug 31, 2006 4:00 pm

Post » Wed Jul 21, 2010 9:02 pm

For some reason LOD textures are no longer generating properly. For whatever reason it is blacking out the whole left side of the image despite the fact that there are partials for these sections which look right. Does anyone know of a solution to this other than TES4qLod?

and http://cs.elderscrolls.com/constwiki/index.php/LOD_texture_fix_script isn't any help since none of the tools seem to work with more recent versions of Windows or Python... The PIL doesn't detect the install of 2.6.5. The DDS converter doesn't allow the selection of .dds files.
User avatar
Michael Korkia
 
Posts: 3498
Joined: Mon Jul 23, 2007 7:58 pm

Post » Thu Jul 22, 2010 6:01 am

Vagrant0 - I don't know of any other solution, and I've had this problem myself and have read myself into the matter. However, since TES4qLOD worked for me, I might have missed another solution. Wouldn't count on it if I was you, though. I've read it was related to your system and there was little you can do about it.
Asking a friend (or a friendly community member) to generate the LOD is of course another solution.

I've got a new problem myself:
I want to write a script that automatically removes the equipped weapon (unequips it first?) when its health reaches zero. How do I do that when I have more than one weapon of that type? Even if I'm able to store the reference of that weapon into a variable, it seems like I can't use RemoveItem because that function requires an ObjectID, which means that it acts on base objects, which means that at best, it would remove a random weapon of that type, but not the one with zero health.
Or am I mistaken here?
User avatar
Jessie Butterfield
 
Posts: 3453
Joined: Wed Jun 21, 2006 5:59 pm

Post » Thu Jul 22, 2010 9:14 am

I've got a new problem myself:
I want to write a script that automatically removes the equipped weapon (unequips it first?) when its health reaches zero. How do I do that when I have more than one weapon of that type? Even if I'm able to store the reference of that weapon into a variable, it seems like I can't use RemoveItem because that function requires an ObjectID, which means that it acts on base objects, which means that at best, it would remove a random weapon of that type, but not the one with zero health.
Or am I mistaken here?
You aren't - That's the way it works. There is no workaround for it either.
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Thu Jul 22, 2010 6:10 am

There's always the stupid high-workload kludge method.

Identify the weapon you want to remove as broken. Remove one reference to said weapon to NPC A. Check the Weapon in NPC A's inventory. If it's still broken you're fine, dump NPC A's inventory to NPC C. If it's not broken, dump NPC A's inventory to NPC B, and remove the next reference to that weapon from the players inventory to NPC A. Check it again. Repeat as necessary until the broken weapon is in NPC C's inventory. Dump NPC B's inventory back on the player.

How fast that could be accomplished, I don't know.
User avatar
Judy Lynch
 
Posts: 3504
Joined: Fri Oct 20, 2006 8:31 am

Post » Thu Jul 22, 2010 4:38 am

Thank you both.
No, a high-workload method is not something I'd like to use. I'll just go back to the less elegant solution - if the equipped weapon has a health of zero, I can unequip it. Almost the same, only now the player can repair the item (not good), and if he can't he has to throw it away himself.
User avatar
Danii Brown
 
Posts: 3337
Joined: Tue Aug 22, 2006 7:13 am

Post » Thu Jul 22, 2010 4:07 am

I'm trying to make a black version of the amber armor/weapons, but I just can't seem to get the textures right. The tools I have are Paint.Net and Adobe Photoshop CS2 (which was rather expensive). What do I need to do to change the yellows in the amber textures to black?
User avatar
Neil
 
Posts: 3357
Joined: Sat Jul 14, 2007 5:08 am

Next

Return to IV - Oblivion