Jump to content

Reference Variables


Mikero

Recommended Posts

I'm working on a harvesting mod that allows players to harvest resources by hitting an object with a certain weapon. While I got these basics working now, and I'm rather stuck. To keep all the different types of sources and their variables a little manageable I decided to create a script for each type for sources to gather from and gave them the variables experienceGain, quantity and requiredLevel these are then used in the weapon to check requiredLevel, add experience and quantity. While the reading works by using the getCrosshairRef and then getVariable.

 

The reason I'm using the getVariable function is because I can not directly just by doing "crosshairRef.quantity" because TESCS then tells me no such variable exists. So the problem I have at the moment is that I can not lower the quantity variable of a resource object.

 

So wondered if anyone can tell me why it's not working this way? Maybe because it's not a direct EditorID reference? And perhaps alternative ways of accomplishing what I'm aiming for.

Link to comment
Share on other sites

I did actually put the result of getCrosshairRef into a ref variable which allows to read these

variabels with the getVariable function. But is not allowed me to change variables.

 

What I'm actually trying to do is to decrease the quantity of available ores in each individual

rock by decreasing the quantity variable on that rock script. This way I hope to get a more

manageable environment because I just have to read and write to standard variables, so changing

and adding new sources would just be adding a new script having these variables.

 

But since this is not really working at the moment, I might rethink the whole structure and try

to think of another way to provide the same or even more flexibility. But first I think I'll try

replacing my rocks(sources) to containers, fill them dynamically and use getItemCount,

removeItem and addItem to manage the quantity.

 

This may solve this problem. Still, does anyone have any idea why I can't access those reference variables? I might bump into this problem again later.

 

Thanks

Link to comment
Share on other sites

I don't know, but I suspect it might be the same thing as you do. Have you tried changing your script to using the EditorID reference? I know that wouldn't help your mod at all, but just do it as a test to figure out if that's the problem.

 

Another possibility might be that you can only do it that way for persistent objects.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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