Jump to content

MenuMode script doesn't complete


CyberSpyder

Recommended Posts

I hope I'm just missing something obvious here - I'm working on a mod allowing players to establish a 'signature weapon,' which will become better as they accumulate kills with it. I'm having some trouble, however, with the script in which the weapon is chosen - there's a fair bit of work to be done in recording just what kind of weapon it is, and it seems as though my script gives up halfway through. It compiles correctly, but when in-game, it just...stops.

 

EDIT - I've figured out part of the problem. I'm grabbing the weapon with the NVSE function GetEquippedObject 5, which returns the Base ID of the player's equipped weapon. Unfortunately, since it's a base ID and not a reference ID, it appears that I can't call functions with it...and when I try, as with if wepref.IsWeaponSkillType Explosives, the code just stops executing right there.

 

Am I stuck? Is there a way to call functions like IsWeaponSkillType or IsInList or GetIsID when all you have is the base ID?

Edited by CyberSpyder
Link to comment
Share on other sites

I hope I'm just missing something obvious here - I'm working on a mod allowing players to establish a 'signature weapon,' which will become better as they accumulate kills with it. I'm having some trouble, however, with the script in which the weapon is chosen - there's a fair bit of work to be done in recording just what kind of weapon it is, and it seems as though my script gives up halfway through. It compiles correctly, but when in-game, it just...stops.

 

EDIT - I've figured out part of the problem. I'm grabbing the weapon with the NVSE function GetEquippedObject 5, which returns the Base ID of the player's equipped weapon. Unfortunately, since it's a base ID and not a reference ID, it appears that I can't call functions with it...and when I try, as with if wepref.IsWeaponSkillType Explosives, the code just stops executing right there.

 

Am I stuck? Is there a way to call functions like IsWeaponSkillType or IsInList or GetIsID when all you have is the base ID?

i don't quite get what you're saying there, why base id? do you want to affect only the weapon the player carries or all weapons of that type that are in the game at the same time? if it's just for the weapon the player has, why don't you just add a script with an OnEquip player block to the weapon?

Link to comment
Share on other sites

It's actually implemented with perks that apply when the player is using a weapon of the chosen type.

 

I only have the baseid because of the way I have to determine what weapon the player is using, GetEquippedObject, which returns baseid instead of refid.

 

Obviously, I can't put a script on the weapon in the GECK, since it could be any weapon in the game. In theory, I could use SetScript to apply a generalized script to an arbitrary weapon...but in order to that, I'd need the RefID of the weapon, and the fact that I don't have the refID is the whole problem. Not to mention that doing so would replace any script already there, which for some weapons could severely impair their functionality.

Edited by CyberSpyder
Link to comment
Share on other sites

As far as I was able to tell when I last saw this question ([1] [2]), IsWeaponSkillType is a condition-only function. This means that it can be used in non-script conditions, such as dialogue conditions, where the parameter is selected from a drop-down list, but it should not be used in scripts.

 

You could try calling it with an integer as its parameter, as this may be how it's supposed to be handled, but I'm not particularly confident that it would work.

 

I also notice that this function has no documentation on the GECK wiki, so if you manage to confirm any of this or come to some other conclusion via testing, please let me know. It'd be good if one of us (or anyone else who wants to lend their thoughts) were able to update its documentation as a result of discussing this.

 

Cipscis

Link to comment
Share on other sites

I was able to get it to work. Bit of a kludge - but you can turn the baseid into a refid by briefly spawning a copy of the weapon behind the player with "set weaponrefid to player.placeatme weaponbaseid 1 100 1." Then you just grab all the information you need off weaponrefid, disable it, and mark it for deletion when you're done.

 

However, I've run into another problem - the form list I'm using to record what the player's signature weapon is seems to be clearing itself out when I save and reload, which is...unexpected.

 

IsWeaponSkillType itself seems to work fine; in testing, it was properly able to identify melee and explosive weapons.

Edited by CyberSpyder
Link to comment
Share on other sites

Thanks, that's good to know. I'll update the documentation on the GECK wiki (IsWeaponSkillType).

 

Script extender functions are often set up such that they can be called on either a reference or by passing the base form itself as a parameter, which would be great for vanilla functions like this. Trying to call a reference function on a non-reference form will never work, however.

 

Cipscis

 

EDIT:

 

I've updated the wiki's documentation of this function. If you could confirm that what I've put there is correct, I'd be grateful - IsWeaponSkillType.

 

I've also updated my post I linked to in my first post in this thread, as it can be found by searching for the function on Google. I tried to edit my post on FOOKUnity too, but I can't seem to log in successfully for some unknown reason...

 

Cipscis

Link to comment
Share on other sites

Yes, that is indeed how the function appears to, um...function. Though the skill name for melee is actually MeleeWeapons.

 

Incidentally, I should thank you for your tutorial site - the bit on using loops in Fallout scripts was supremely helpful in expanding what I could do.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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