Difference between revisions of "User talk:RedFault"
Adding example
imported>RedFault |
imported>RedFault (Adding example) |
||
Line 6: | Line 6: | ||
===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? |