Difference between revisions of "User talk:RedFault"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>RedFault
(Getting some content in here.)
 
imported>RedFault
(→‎Game Settings: Response to Haama after tests.)
 
(7 intermediate revisions by 3 users not shown)
Line 5: Line 5:


===Are Static Objects Scriptable?===
===Are Static Objects Scriptable?===
One of my biggest concerns, especially comparing this with the Neverwinter Nights Aurora Toolset, is that it seems there's no way to attach scripts to static world objects.  Am I wrong?  I had a brilliant idea to make an Archery Target script that would really increase your Marksmanship Skill (at a slower rate than in combat), and I wrote a rough script that I thought would get me started, only to discover that the TargetHeavy01 object doesn't have a "Script" field.  Is there a workaround for this?  If so, I think it deserves an entry in this Wiki.  Unless I'm overlooking something obvious, and it's completely possible, and very easy to do.  Being able to script placeable objects is a fundamental ability for good modding.
:One of my biggest concerns, especially comparing this with the Neverwinter Nights Aurora Toolset, is that it seems there's no way to attach scripts to static world objects.  Am I wrong?  I had a brilliant idea to make an Archery Target script that would really increase your Marksmanship Skill (at a slower rate than in combat), and I wrote a rough script that I thought would get me started, only to discover that the TargetHeavy01 object doesn't have a "Script" field.  Is there a workaround for this?  If so, I think it deserves an entry in this Wiki.  Unless I'm overlooking something obvious, and it's completely possible, and very easy to do.  Being able to script placeable objects is a fundamental ability for good modding.
 
:The script I had started was as follows:
<pre>
  ScriptName ArcheryPractice
  ref ammoRef
  ref shooter
  short distance
  Begin OnTrigger
  Set ammoRef to GetActionRef
    ;When something collides with me, capture the colliding object's
    ;reference so I can check to see if it's an ammo object
  If (ammoRef.IsAmmo == false)
    Return
    ;I have been hit by something other than ammo, don't waste processor
    ;power with the rest of the script
  Endif
  If (ammoRef.IsOwner != 1)
    Message "A shot was fired at an Archery Target by someone other than
            the Player."
      ;This would want to be removed after testing, of course.
    Return
    ;If this works as intended, then the script does not continue to execute
    ;if the shot was not fired by the player.
  Endif
  Set shooter to Player
    ;This should only be possible if the shooter was the Player.  There
    ;is probably a more elegant solution.
  Set distance to GetDistance shooter
    ;Capture the distance between myself and the shooter
  shooter.IncrementPlayerSkillUse Marksmanship 1 1
    ;I don't know how the integers work here.  How much am I increasing?
  Message "You are about %.0f feet from the target." distance
    ;If I'm using this right, it should display the "distance" variable in
    ;an integer format.
  End
</pre>
 
:Obviously not a finished product, and probably not even correctly written.  I don't know how some of the functions work until I can try them, and since this script was written to be attached to the target itself, I can't test it.  It seems strange to me that you wouldn't be able to interact with something as straightforward as an archery target.  So.  Am I overlooking something, or can static objects really not be scripted?
 
[[User:RedFault|RedFault]] [[User_Talk:RedFault|Talk]] 14:38, 4 January 2008 (EST)
 
::Welcome to the Wiki may your contributions be wordy and many! Now on to your question, you are absolutely right in your assumption that you can't attach a script to a static object. The only way to interact with static objects through scripts is by giving the object a Reference Editor ID or by placing the object with [[PlaceAtMe]] and catching the reference there. That doesn't allow you to run an OnTrigger block on the object though. You probably want to make a new Activator object with the TargetHeavy01 model as archery target.
::You might be interested in [[Running Scripts On Arrows|this tutorial]] if haven't seen it already. It explains how to use a trigger zone to run a script on arrows fired by the player, I don't think you'll need it but maybe you'll need to switch methods if the OnTrigger block proves unreliable - I've never used it.
::Something you might want to consider is that the player can fire stolen arrows. While this is not very likely I wouldn't be surprised if someone decides to visit the Imperial Arrow Supply before testing their archery skills.
::I don't know a better way to find out who shot the arrow than [[IsOwner]], but if you're looking for a bit of work you can always match the colliding arrow with the last arrow fired by the player (using the method in the tutorial). I don't think it's worth the effort or the processing power, but that's up to you.
::--[[User:Qazaaq|Qazaaq]] 18:22, 4 January 2008 (EST)
 
== Game Settings ==
 
Hi Redfault,
 
Just wanted to let you know that game settings have a particular format. You can get it by editing another game setting page and pasting into the one you're working on. On sCantEquipGeneric - I know it can't be removed entirely or it will blank out all messages (if I remember correctly), but I don't remember the circumstances. Have you experienced the problem?--[[User:Haama|Haama]] 13:33, 14 January 2008 (EST)
 
:I will fix up the format issue shortly, not much time right now.  As for the issue of blanking all messages, I was not aware and have not tested.  I will double check that, and if it's true, I will edit my suggestion to add a blank space character " ", as I have read elsewhere.<br />
:[[User:RedFault|RedFault]] 13:37, 14 January 2008 (EST)
 
::Unless I misunderstood what you meant about blanking out "all messages", I did not experience the problem.  My tests still show messages when my skills increase, and I can still show custom messages via my own scripts.  Was there a particular circumstance you know of where messages were lost?<br />
::--[[User:RedFault|RedFault]] 15:28, 14 January 2008 (EST)

Latest revision as of 15:28, 14 January 2008

Well, as I have mentioned on my user page, I am just starting with the TESCS, so I don't have much to discuss as of yet. I just don't like the broken link in my nav menu.

Questions[edit source]

As I start messing around with the CS, I'm finding a bunch of what I thought would be simple questions, but sometimes finding specific answers to simple questions is not so simple. Here I will ask a few of them, if I think they may be relevant to people other than myself, in the hopes that other noobs can learn something as well.

Are Static Objects Scriptable?[edit source]

One of my biggest concerns, especially comparing this with the Neverwinter Nights Aurora Toolset, is that it seems there's no way to attach scripts to static world objects. Am I wrong? I had a brilliant idea to make an Archery Target script that would really increase your Marksmanship Skill (at a slower rate than in combat), and I wrote a rough script that I thought would get me started, only to discover that the TargetHeavy01 object doesn't have a "Script" field. Is there a workaround for this? If so, I think it deserves an entry in this Wiki. Unless I'm overlooking something obvious, and it's completely possible, and very easy to do. Being able to script placeable objects is a fundamental ability for good modding.
The script I had started was as follows:
  ScriptName ArcheryPractice
 
  ref ammoRef
  ref shooter
  short distance
 
  Begin OnTrigger
   Set ammoRef to GetActionRef
     ;When something collides with me, capture the colliding object's
     ;reference so I can check to see if it's an ammo object
 
   If (ammoRef.IsAmmo == false)
    Return
     ;I have been hit by something other than ammo, don't waste processor
     ;power with the rest of the script
   Endif
 
   If (ammoRef.IsOwner != 1)
    Message "A shot was fired at an Archery Target by someone other than 
             the Player."
      ;This would want to be removed after testing, of course.
    Return
     ;If this works as intended, then the script does not continue to execute
     ;if the shot was not fired by the player.
   Endif
 
   Set shooter to Player
     ;This should only be possible if the shooter was the Player.  There 
     ;is probably a more elegant solution.
   Set distance to GetDistance shooter
     ;Capture the distance between myself and the shooter
   shooter.IncrementPlayerSkillUse Marksmanship 1 1
     ;I don't know how the integers work here.  How much am I increasing?
   Message "You are about %.0f feet from the target." distance
     ;If I'm using this right, it should display the "distance" variable in 
     ;an integer format.
  End
Obviously not a finished product, and probably not even correctly written. I don't know how some of the functions work until I can try them, and since this script was written to be attached to the target itself, I can't test it. It seems strange to me that you wouldn't be able to interact with something as straightforward as an archery target. So. Am I overlooking something, or can static objects really not be scripted?

RedFault Talk 14:38, 4 January 2008 (EST)

Welcome to the Wiki may your contributions be wordy and many! Now on to your question, you are absolutely right in your assumption that you can't attach a script to a static object. The only way to interact with static objects through scripts is by giving the object a Reference Editor ID or by placing the object with PlaceAtMe and catching the reference there. That doesn't allow you to run an OnTrigger block on the object though. You probably want to make a new Activator object with the TargetHeavy01 model as archery target.
You might be interested in this tutorial if haven't seen it already. It explains how to use a trigger zone to run a script on arrows fired by the player, I don't think you'll need it but maybe you'll need to switch methods if the OnTrigger block proves unreliable - I've never used it.
Something you might want to consider is that the player can fire stolen arrows. While this is not very likely I wouldn't be surprised if someone decides to visit the Imperial Arrow Supply before testing their archery skills.
I don't know a better way to find out who shot the arrow than IsOwner, but if you're looking for a bit of work you can always match the colliding arrow with the last arrow fired by the player (using the method in the tutorial). I don't think it's worth the effort or the processing power, but that's up to you.
--Qazaaq 18:22, 4 January 2008 (EST)

Game Settings[edit source]

Hi Redfault,

Just wanted to let you know that game settings have a particular format. You can get it by editing another game setting page and pasting into the one you're working on. On sCantEquipGeneric - I know it can't be removed entirely or it will blank out all messages (if I remember correctly), but I don't remember the circumstances. Have you experienced the problem?--Haama 13:33, 14 January 2008 (EST)

I will fix up the format issue shortly, not much time right now. As for the issue of blanking all messages, I was not aware and have not tested. I will double check that, and if it's true, I will edit my suggestion to add a blank space character " ", as I have read elsewhere.
RedFault 13:37, 14 January 2008 (EST)
Unless I misunderstood what you meant about blanking out "all messages", I did not experience the problem. My tests still show messages when my skills increase, and I can still show custom messages via my own scripts. Was there a particular circumstance you know of where messages were lost?
--RedFault 15:28, 14 January 2008 (EST)