I recently switched to modify higher levels of abilities using the CatalogSetValue function. Now I modified a spell of mine, and I get an ingame red trigger error message, something like:
Error: Catalog value could not be written.
However, the values are changed nicely and the spell works as intended on all levels. Now my question is: Where is the problem? How to get rid of the error message? (and is there any way to get rid of those stupid prefixes, like using scopes in vJass or something? -.- )
The code:
//Scope PSGStrike, Prefix PSGconststringPSG_SPELL_ID="PSGStrike";//the ID of the spellconststringPSG_LEARN_ID="LearnAbilities8";//the ID of the learn abilityconstintPSG_LEARN_NR=4;//the slot of the learn ability used to learn this spellfixedPSG_Damage(intlvl){//returns the damage the ability should cause on each levelreturn100+50*lvl;}fixedPSG_Duration(intlvl){//returns the duration of the vortex per levelreturn3+1*lvl;}boolPSG_Lvlup(boola,boolb){//gets called whenever the unit levels the spellunitu=EventUnit();//set some variables needed throughout the functionintp=UnitGetOwner(u);intlvl=UnitAbilityGetLevel(u,PSG_SPELL_ID);stringv=FixedToString(PSG_Damage(lvl),4);//set some variables needed for the catalog setstrings="PSGStrikeDamage";strings2="Amount";intc=c_gameCatalogEffect;fixedf;CatalogFieldValueSet(c,s,s2,p,v);// all variables set, run catalog, this one modifies damages="VortexCreatePersistentInitial";s2="PeriodicPeriodArray[0]";f=StringToFixed(CatalogFieldValueGet(c,s,s2,p));// this gets the period of the persistant effect, tested and works correctlys2="PeriodCount";v=FixedToString(PSG_Duration(lvl)/f,4);CatalogFieldValueSet(c,s,s2,p,v);// commenting out this...s="VortexCreatePersistent";CatalogFieldValueSet(c,s,s2,p,v);// ...and this causes the error to disappearPrint("upgraded: "+PSG_SPELL_ID+" Level: "+IntToString(lvl));returntrue;}voidPSG_Init(){triggert=TriggerCreate("PSG_Lvlup");abilcmdc=AbilityCommand(PSG_LEARN_ID,PSG_LEARN_NR);TriggerAddEventUnitAbility(t,null,c,c_unitAbilStageComplete,true);}
Explanation: The spell is basically a mothership vortex with some damage. Vortex uses 2 persistant effects, I modify both of their Period Counts and the damage amount per level.
If I skip modifying both period counts, the errors disappear; if I leave one of them, the error remains. However the tooltip of the ability (which uses <d ref>) and the effect shown ingame indicate, that the values are set correctly (I did set the period counts to initially 0, so if the setting does not work, the whole spell should malfunction, which he does not)
Any ideas?
€ the same seems to apply for any persistant effect. If I change the period count, it works but throws an error.
well that error indicates that it failed to write to the catalog. So what ever is producing the error is not actually being changed. take a screen shot of your actual trigger and post it up for us to look at.
Ive had to go through alot of lines like this. And I have found you only get that when it actually fails to write.
Your doing your stuff in script so I cant be entirely sure. But im 100% sure you have something in there that is failing to write to a catalog field value.
Could you make a stand alone standard trigger in normal GUI
events
user types "-test"
actions
Set catalog field value for what ever you think is causing the error.
does this cause your error your seeing?
To me the catalog stuff makes alot more sense looking at the GUI actions. Looking at your GE script.... which im not accustomed to seems like your missing something but its syntax is quite different then looking at the GUI action itself.
I isolated the catalog set action, looks like this (I added some more comments):
boolPSG_Lvlup(boola,boolb){//this is a function, which is called at some point.//At first, I set some local variables, just like in Guiunitu=EventUnit();//unit u holds the triggering unitintp=UnitGetOwner(u);//p is a player, the owner of ustringv="80"//the new value to be assigned to the persistent effect.//I take 80, which equals 5 seconds for a 0.0625 interval//In data editor, I entered 0, to see if this script worksstrings="VortexCreatePersistent";//ID of the effect to change, the persistant effect of the vortex //(or any other persistant effect, I tried multiple ones)strings2="PeriodCount";//the field name, PeriodCount.intc=c_gameCatalogEffect;//the catalog. This means, we want to modify an effect.CatalogFieldValueSet(c,s,s2,p,v);//this is the function to modify the catalog. //With all the locals set up, we need to just enter them in the correct orderreturntrue;}
Should not be that hard to understand, its fairly similar to Gui, only the functions are called slightly differently (and I emphasized locals quite much, which probably no gui-user would do like this :D)
Still the same error. And, as stated multipe times, the value gets set correctly (tooltip and actual effect show this), but the error says, it doesn't.
Actually I use locals in my Gui triggers as well in much the same manner for generating random units and such and changing thier stats. and abilties.
Hence why I was interested.
Since I havent had any issues using gui I wanted to see if you did the same commands in gui if you would have the problem.. Executing errors with debug commands can help greatly.
But the variables Im passing to the gui actions seem to be a bit different the the variables your using in script.
In gui I would have to tell it im changing an effect not a unit...?
Catalog - Set value of Effects Entry Field Path for player (Triggering player) to ""
The only real difference in Galaxy is, that you cannot pick, for example, the catalog type from some kind of predefined list, but you pass an integer variable, which matches the value of a constant. So, for example, if you pass 1, it will change a unit, if 2, it will change an effect.
For this, there exists constants you can use. So I use a local integer variable i and set it to c_gameCatalogEffect. Could have manually set it to 2, but for the sake of readability, I take the constant. To change this to a unit, I could set this to 1 or to c_gameCatalogUnit (which is actually 1)
Note that the actual numbers are only examples, I have no idea, if they are correct (and I do not need to as long as i know the names of the constants).
The 2nd is the ID of the object to change, which you can pick from a list in Gui.
The field path , player and value are the same as in Gui.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey everyone
I recently switched to modify higher levels of abilities using the CatalogSetValue function. Now I modified a spell of mine, and I get an ingame red trigger error message, something like:
Error: Catalog value could not be written.
However, the values are changed nicely and the spell works as intended on all levels. Now my question is: Where is the problem? How to get rid of the error message? (and is there any way to get rid of those stupid prefixes, like using scopes in vJass or something? -.- )
The code:
Explanation: The spell is basically a mothership vortex with some damage. Vortex uses 2 persistant effects, I modify both of their Period Counts and the damage amount per level.
If I skip modifying both period counts, the errors disappear; if I leave one of them, the error remains. However the tooltip of the ability (which uses <d ref>) and the effect shown ingame indicate, that the values are set correctly (I did set the period counts to initially 0, so if the setting does not work, the whole spell should malfunction, which he does not)
Any ideas?
€ the same seems to apply for any persistant effect. If I change the period count, it works but throws an error.
What happens if you comment out a different Catalog function instead?
Maybe so many changes mess something up?
Just tried it for another spell with a persistant effect, same issue even when the only change I make is changing the period count one time.
So my conclusion is: The error message is a galaxy editor bug, and I have to remember to supress error messages for officially released versions.
Could you screen shot the error your seeing?
In case someone cannot read it:
Trigger Error in PSG_Lvlup':
TriggerDebug/
ErrorCatalogFieldNotWritten
Since I change 2 persistent effects, it is shown 2 times (but the trigger debug seems to only be able to display 4 lines at once)
well that error indicates that it failed to write to the catalog. So what ever is producing the error is not actually being changed. take a screen shot of your actual trigger and post it up for us to look at.
Ive had to go through alot of lines like this. And I have found you only get that when it actually fails to write.
Your doing your stuff in script so I cant be entirely sure. But im 100% sure you have something in there that is failing to write to a catalog field value.
Could you make a stand alone standard trigger in normal GUI
does this cause your error your seeing?
To me the catalog stuff makes alot more sense looking at the GUI actions. Looking at your GE script.... which im not accustomed to seems like your missing something but its syntax is quite different then looking at the GUI action itself.
I isolated the catalog set action, looks like this (I added some more comments):
Should not be that hard to understand, its fairly similar to Gui, only the functions are called slightly differently (and I emphasized locals quite much, which probably no gui-user would do like this :D)
Still the same error. And, as stated multipe times, the value gets set correctly (tooltip and actual effect show this), but the error says, it doesn't.
Actually I use locals in my Gui triggers as well in much the same manner for generating random units and such and changing thier stats. and abilties.
Hence why I was interested.
Since I havent had any issues using gui I wanted to see if you did the same commands in gui if you would have the problem.. Executing errors with debug commands can help greatly.
But the variables Im passing to the gui actions seem to be a bit different the the variables your using in script.
In gui I would have to tell it im changing an effect not a unit...?
Catalog - Set value of Effects Entry Field Path for player (Triggering player) to ""
This translates directly to:
(I think that's the right way). The EventUnit() you're probably refering to doesn't get used in the function. It's only used to find out the owner.
So if it works in GUI it 100% works in Galaxy. Also - as he said multiple times now it works just as intended, but still returns an error.
The only real difference in Galaxy is, that you cannot pick, for example, the catalog type from some kind of predefined list, but you pass an integer variable, which matches the value of a constant. So, for example, if you pass 1, it will change a unit, if 2, it will change an effect.
For this, there exists constants you can use. So I use a local integer variable i and set it to c_gameCatalogEffect. Could have manually set it to 2, but for the sake of readability, I take the constant. To change this to a unit, I could set this to 1 or to c_gameCatalogUnit (which is actually 1)
Note that the actual numbers are only examples, I have no idea, if they are correct (and I do not need to as long as i know the names of the constants).
The 2nd is the ID of the object to change, which you can pick from a list in Gui.
The field path , player and value are the same as in Gui.