Jump to content

Simple script to require a pickaxe in inventory in order to mine ore?


Guest deleted2027229

Recommended Posts

You mean those rock-looking containers that contain ore? Put this script on them:


BEGIN ONACTIVATE PLAYER

if ( GetItemCount [Pickaxe] > 0) || ( GetItemCount [Recently Used Pickaxe] > 0 )
    Activate
else
    Messagebox "You need a pickaxe to mine ore."
endif

END

I typed this out at work so I haven't got the Editor ID for "Pickaxe" and "Recently Used Pickaxe", nor has the script been compiled to detect possible typos or errors.

Link to comment
Share on other sites

Guest deleted2027229

Thanks a lot, it needed a bit of tweaking to work -

 

scn 00mining
begin onactivate
if player.GetItemCount Pickaxe01 > 0 || player.GetItemCount Pickaxe01dirty > 0
Activate
else
Message "You need a pickaxe to mine ore"
endif
End

 

Applied to silver, gold and madness ore veins

 

Link to comment
Share on other sites

You should better start your script name and editor ID's with a letter.

 

The script names and editor ID's that don't start with a letter are sources of instability.

 

To diminish of mod conflicts you should better create script names and editor ID's you are unlikely to find in other mods like a mix of your nickname, a short description and your mod's acronym.

Edited by Oblivionaddicted
Link to comment
Share on other sites

Guest deleted2027229

Thanks Oblivionaddicted, can you elaborate on why scripts starting with a number are more instable? I've got a few that begin with numbers but haven't yet run into any trouble; but if I have to change them then I will. What is the technical reason for the instability?

Link to comment
Share on other sites

Thanks Oblivionaddicted, can you elaborate on why scripts starting with a number are more instable? I've got a few that begin with numbers but haven't yet run into any trouble; but if I have to change them then I will. What is the technical reason for the instability?

You don't have anything to win starting your editor ID's and script names by something that is not a letter whereas you might have to lose in it so you should better avoid any useless risk.

Edited by Oblivionaddicted
Link to comment
Share on other sites

I think someone a long, long time ago said don't start your EditorIDs or scriptnames with a number, and nobody has questioned it since. The only explanation I can find is in the CS Wiki:

 

Don't use a number as the first character for a Reference EditorID; this confuses Oblivion and it will sometimes work, sometimes not. This includes naming quests, factions, items, etc. This also applies to the names of script variables.

https://cs.elderscrolls.com/index.php?title=Common_Mistakes

 

If it's just your own personal scripts and everything is working fine, then there's no pressing need to fix the naming scheme. But if it's something for release, best to update them. :)

Link to comment
Share on other sites

To further elaborate on this, especially take care not to use names that only contain the letters used in hexadecimal numbers.

For example, if you name your script something like "05cebab1" or "05cafe01" (sounds innocent enough, no? a scripted edible or a street cafe script perhaps), these will be perfectly valid hexadecimal FormIDs. If then the 6th plugin/masterfile in load order happens to contain any entry with these numbers, you'll have created yourself a conflict.

 

Granted this especially is rather unlikely for you or a user of your mod to run into. But better not get the game even started into thinking it's a hex FormID, so it might not even consider taking it for a name anymore and break.

 

(For some reason the rule of thumb only speaks of numbers and doesn't include hexadecimals as well. The reason for this is unknown to me. FormIDs can just as well start with <a-f> after all.

But I know the game engine from modding it for 15 years and am full well aware of it most of the time not working in an expected way or making a lot of sense in how it does. So nothing is unlikely enough to be for granted.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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