D1v1ne122 Posted July 25, 2016 Share Posted July 25, 2016 Hi, I'm trying to call a property called Filter_Charge from another script on an object called GasMaskFilter to a GasMask to manipulate a variable. I'm having trouble pulling the variable without errors (I think it's just a lack of syntax knowledge). Any help is welcomed. Gas Masks Scriptname GasMask:GasMask extends ObjectReference int TimerID0 = 0 Spell property WastelandRadiation auto Sound Property VOCPlayerSprintOutOfBreath1st const auto ObjectReference GasMaskFilter Keyword GasMask Function RestartTimer() StartTimer(60, TimerID0) ; EndFunction Event OnEquipped(Actor akActor) If (akActor.WornHasKeyword(GasMask) == true) && (akActor == Game.GetPlayer()) RestartTimer() ;Start the timer to consume filters endIf EndEvent Event OnTimer(int aiTimerID0) If aiTimerID0 == TimerID0 ; The 60 second timer we started just expired If GasMaskFilter.Filter_Charge.Get() == 0; Game.GetPlayer().RemoveItem(GasMaskFilter, 1) int instance1 = VOCPlayerSprintOutOfBreath1st.play(self); play SFX sound from my self Sound.SetInstanceVolume(instance1, 1); else GasMaskFilter.Filter_Charge.Set(GasMaskFilter.Filter_Charge.Get() - 10); Remove 10 charge from the item endIf RestartTimer(); Reset the timer back endIf EndEvent GasMaskFilter: Property Filter_Charge Scriptname GasMask_Charge extends ObjectReference ObjectReference GasMaskFilter int Charge = 50 int Property Filter_Charge int Function Get() return Charge EndFunction Function Set(int i) If Charge > 0 Charge = i endIf EndFunction EndProperty Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2016 Share Posted July 25, 2016 What exact error are you receiving? Link to comment Share on other sites More sharing options...
D1v1ne122 Posted July 25, 2016 Author Share Posted July 25, 2016 I have a series of errors that are a little confusing to me. Most of them seem related to the same lines. I've been trying to mimic the examples but I don't think I'm getting the context of the examples. Errors: Compiling "GasMask\GasMask.psc"...E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,13): no viable alternative at input 'GasMaskFilter'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,26): required (...)+ loop did not match anything at input '.'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,4): Unknown user flag gasmaskfilterE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(7,8): cannot name a variable or property the same as a known type or scriptE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,13): no viable alternative at input 'GasMaskFilter'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,26): required (...)+ loop did not match anything at input '.'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,4): Unknown user flag gasmaskfilterE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(14,28): GasMask is not a variableE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,13): no viable alternative at input 'GasMaskFilter'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,26): required (...)+ loop did not match anything at input '.'E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask.psc(4,4): Unknown user flag gasmaskfilterE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(14,28): type mismatch on parameter 1 - cannot pass a gasmask to a keywordE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(14,37): cannot compare a void to a bool (cast missing or types unrelated)E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(21,19): Filter_Charge is not a property on script objectreference or one of its parentsE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(21,33): none is not a known user-defined script typeE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(21,39): cannot compare a void to a int (cast missing or types unrelated)E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(27,16): Filter_Charge is not a property on script objectreference or one of its parentsE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(27,48): Filter_Charge is not a property on script objectreference or one of its parentsE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(27,62): none is not a known user-defined script typeE:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(27,68): cannot subtract a void from a int (cast missing or types unrelated)E:\SteamLibrarySSD\steamapps\common\Fallout 4\Data\Scripts\Source\User\GasMask\GasMask.psc(27,30): none is not a known user-defined script typeNo output generated for GasMask\GasMask.psc, compilation failed. Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2016 Share Posted July 25, 2016 The main problem as I see it is that you never define GasMaskFilter in your scripts. And by that I mean you never say in the script what GasMaskFilter points towards, so the compiler can't reference anything. Link to comment Share on other sites More sharing options...
D1v1ne122 Posted July 25, 2016 Author Share Posted July 25, 2016 (edited) Alright. How do I reference to it? I thought ObjectReference GasMaskFilter was the pointer but I'm obviously mistaken. Can you provide an example of pointing to an object and its properties? Right now, GasMask is attached to GasMask Objects and GasMask_Charge is attached to GasMaskFilters. Edited July 25, 2016 by D1v1ne122 Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2016 Share Posted July 25, 2016 You will want to make them Properties and use the CK to point to the GasMaskFilters. Link to comment Share on other sites More sharing options...
D1v1ne122 Posted July 25, 2016 Author Share Posted July 25, 2016 Do you mean make Properties that mimic their object like a GasMask property and a GasMaskFilter property? Link to comment Share on other sites More sharing options...
Reneer Posted July 25, 2016 Share Posted July 25, 2016 Yes. The problem is that you will need to reference more than one gas mask object in order for your script to work properly. I would recommend that you consider rewriting your mod to use a quest script instead of Objectreferences. Link to comment Share on other sites More sharing options...
D1v1ne122 Posted July 30, 2016 Author Share Posted July 30, 2016 (edited) How do I use a quest script in this sense? Attach the Quest to an object? Edited July 30, 2016 by D1v1ne122 Link to comment Share on other sites More sharing options...
Reneer Posted July 30, 2016 Share Posted July 30, 2016 How do I use a quest script in this sense? Attach the Quest to an object? No, you would just create a quest and use remote events to determine when the player equips gas masks. Link to comment Share on other sites More sharing options...
Recommended Posts