Jump to content

Trouble with Dynamically Attaching Scripts to Objects.


0lexan

Recommended Posts

You're going to need to provide more detail before anyone can realistically assist you. Ideally start by posting the scripts you have written. Do you have any debug messages added in to see if the scripts are running?

They are the exact same scripts used in the example. I was trying to follow along the guide.

The TreeAliasScript is applied to each reference alias in the DASQuest, according to the guide, and the UpdateScript is applied directly to a second quest. I filled all properties and have seemingly no interactions.

I would appreciate any of your help.

 

 

Script 1 and 2:

Scriptname UpdateQuestScript extends Quest  
 
Quest Property DASQuest Auto
 
Event OnInit()
	RegisterForSingleUpdate(5)
EndEvent
 
Event OnUpdate()
	DASQuest.Stop()
 
        ;We must wait until the quest has stopped before restarting the quest. Using Stop() and immediately Start() may fail. 
        ;Continue after 5 seconds to prevent infinite loop.
        int i = 0
        while !DASQuest.IsStopped() && i < 50
            Utility.Wait(0.1)
            i += 1
        endWhile
 
	DASQuest.Start()
	RegisterForSingleUpdate(5)
EndEvent
Scriptname TreeAliasScript extends ReferenceAlias
 
Keyword Property WeapTypeBattleAxe Auto
Keyword Property WeapTypeWarAxe Auto
MiscObject Property Firewood01 Auto
 
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, \
  bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
	if (akAggressor == Game.GetPlayer())
		if (akSource.HasKeyword(WeapTypeBattleAxe) || akSource.HasKeyword(WeapTypeWarAxe))
			akAggressor.AddItem(FireWood01)
		endif
	endif
EndEvent
Link to comment
Share on other sites

I would recommend that the next step should be adding in Debug.Notification code into the scripts, just as a sanity check to see that they are working.

I ran them on initialization on a previous test, and it returned the values, I suspect that the function is either not detecting any hit detection, or not properly adding the item to the inventory, as the page text says it would. I will try debug.traces instead and see if it is the hit detection's fault or additems fault. If it is the case of hit detection, what would you recommend?

Link to comment
Share on other sites

Are you running all your tests on a fresh game or save file that has not seen your mod? If not, do so. Many changes do not like to take effect mid-game especially to already active quests.

No, I was using COC out of menu, good point I'll try it out

Link to comment
Share on other sites

Are you running all your tests on a fresh game or save file that has not seen your mod? If not, do so. Many changes do not like to take effect mid-game especially to already active quests.

All right, after doing a fresh new game, intro included, I still had no progress. The log shows that both quests initialize correctly, and that the update function is removing/adding the quest. I also put a trace alongside the additem, and I didn't get any output in the log. Any ideas?

Link to comment
Share on other sites

It could be possible that the tree you are testing is not on one of the aliases. How many aliases did you create?

 

I've done similar things in order to dynamically fill aliases with objects near the player and I always had to have more aliases than necessary just to ensure that I actually got the closest objects.

Link to comment
Share on other sites

It could be possible that the tree you are testing is not on one of the aliases. How many aliases did you create?

 

I've done similar things in order to dynamically fill aliases with objects near the player and I always had to have more aliases than necessary just to ensure that I actually got the closest objects.

I filled out about 20, wouldn't this be enough for the application? Also, I found that the aliases aren't being filled, so how would I go about fixing this?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...