• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

Some problems with spellbooks...

Status
Not open for further replies.
Level 9
Joined
Apr 19, 2011
Messages
447
Hi.

Actually, I have two issues with spellbooks, and I hope someone here can help find out how to solve them.

1 - I have a spellbook, called "Inventory". Inside this spellbook, there's another spellbook called "Restoratives", and this second spellbook contains an ability, "Medicinal Salve". OK, I have two dummy units that I use to control the main characters. After a few minutes of playtime, the skills and the items get enabled, so the player can use them. So, I add the "Inventory" spellbook to both dummies. What's the problem? Well, one of the dummies has the "Medicinal Salve" ability inside the "Restoratives" spellbook. The other one does not have the ability.
What can be the problem with this? I don't get it. I added exactly the same spellbook to both dummies, but it's empty for one of them!

Note: The "Medicinal Salve" ability is initially disabled for Player 1 (the user). I enable it just when I add the spellbooks to the dummies.

2 - This "Medicinal Salve" ability, along with all the other abilities designed for items, has 51 levels. The player can get a maximum of 50 items of each type. So, I change the level of the ability to the number of items the player has (so I can show the quantity in the tooltip), and I use the level 51 for 0 quantity.
However, I noticed that no matter what level I set for the ability, it's always stuck at level 1. I don't know why. The characters are heros, and these abilities are unit abilities stored inside multiple spellbooks.

Can someone help with this? It's really annoying to gather multiple items, and have the tooltip always saying "There's 01 left"!

Regards
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Show your scripts for enabling/disabling and adding the spellbooks. Probably the problem is there.

1- Probably, the ability is disabled for that player.
2- Why dont you use level 1 for 0 quantity? For this you just have to use "Set level of ability for unit ..." it should work. Doesn't matter if they are inside an item, or spellbook, or hidden: the unit has the ability and can be manipulated with triggers directly as if they where common abilities.
3- About ther "There's 01 left" there most be some trigger, some where, with that string text. Look for it and see what triggers it

Be aware that abilities with more than 4 levels takes much more map space and requires much more loading time, since Wc3 handles them in a different way.
 
Level 9
Joined
Apr 19, 2011
Messages
447
Show your scripts for enabling/disabling and adding the spellbooks. Probably the problem is there.

1- Probably, the ability is disabled for that player.

I'll upload the part of the trigger where I enable the abilities as soon as I can.
I can't do it now because I'm not in my computer at this moment.

And, if I understand you correctly, you say that only one of the dummies has the ability because the other one has the ability disabled. Well, that could have some logic if the dummies were owned by different players... but they are both owned by the same player!

2- Why dont you use level 1 for 0 quantity? For this you just have to use "Set level of ability for unit ..." it should work. Doesn't matter if they are inside an item, or spellbook, or hidden: the unit has the ability and can be manipulated with triggers directly as if they where common abilities.

Well, regardless of using level 1 for 0 quantity or using level 51, the level should change when I use the "Set level of ability...". Sadly, for some reason it does not work.
Maybe the problem is, like you said, in the triggers. I'll upload them as soon as I can.

3- About ther "There's 01 left" there most be some trigger, some where, with that string text. Look for it and see what triggers it

Be aware that abilities with more than 4 levels takes much more map space and requires much more loading time, since Wc3 handles them in a different way.

No, no, no... You misunderstood this part (Maybe I didn't explained myself correctly...). The "There's 01 left" text is part of the ability tooltip! At level 1, it says "There's 01 left", at level 2, it says "There're 02 left"...
If always says "There's 01 left", means that the ability is always stuck at level 1.

And yes, I know that abilities with a lot of levels take a long time to load, but I hope that won't be a problem in my case.

Regards
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok. Post the triggers. And check if the Tooptip is the same at all levels, or if, really, the level isn't changing.
 
Level 9
Joined
Apr 19, 2011
Messages
447
Sorry for the long time without answering, I was a bit busy these days.
Well, let's see... The second problem (abilities stuck at level 1) is already solved. I was messing up with the variables, and I managed to fix it.
However, I can't still solve the other problem, one of the dummies does not have the ability. Here are the related triggers (Note that these are not the full triggers, just the part of the trigger where I work around with abilities):

When the player gets the posibility of using items, I add the item ability to the first dummy:
  • First Dummy
    • Events
    • Conditions
    • Actions
      • Unit - Add ITEM (Menu) to Aelan_Dummy
      • Set ITEM_Medicinal_Salve = (ITEM_Medicinal_Salve + 3)
      • Unit - Set level of MEDICINAL SALVE for Aelan_Dummy to ITEM_Medicinal_Salve
A few later, the second dummy gets into action. I create that dummy, and add the SAME ability to it:
  • Second Dummy
    • Events
    • Conditions
    • Actions
      • Set LEAK = (Center of Dummy Ruy <gen>)
      • Unit - Create 1 Ruy (Dummy) for Player 1 (red) at LEAK facing 270.00 degrees
      • Custom script: call RemoveLocation(udg_LEAK)
      • Unit - Change color of (Last created unit) to Black
      • Set Ruy_Dummy = (Last created unit)
      • Unit - Add ITEM (Menu) to Ruy_Dummy
      • Unit - Set level of MEDICINAL SALVE for Ruy_Dummy to ITEM_Medicinal_Salve
As I said in the first post, ITEM (Menu) is a spellbook that contains the MEDICINAL SALVE ability. Aelan_Dummy has this ability, but Ruy_Dummy doesn't. I just don't understand why does this happen.
As you can see, the triggers are very simple, and I don't do anything else with abilities in any other trigger.

Note: If you want me to upload the map so you can search the issue by yourself, I have to say that won't be possible. This map is a part of my main proyect, and I don't want to upload it anywhere before the release of the beta.

Regards
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Why don't you create both dummies in the same trigger? What are the events? How do you execute these triggers?

I see no reason for the spellbook to remain hidden for that second dummy
 
Level 9
Joined
Apr 19, 2011
Messages
447
1 - Why don't you create both dummies in the same trigger?

Each dummy represents a playable character. I have two dummies because I have two playable characters, but only one of them is available at the beggining of the game. That's why the second dummy must be create in a different moment.

2 - What are the events?

The events are nothing strange. The first dummy is created during the initial cinematic, and the second dummy during another cinematic (in which the second character becomes available). I'm absolutely sure that these triggers are running.

3 - How do you execute these triggers?

Well, I think that's already answered above. They are executed during cinematics, they can't be misssed...


Note: It's not the spellbook what remains hidden, it's an ability inside the spellbook.

Regards
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Damn, this is so confusing. I can't get how 2 units owned by the same player wich have the same Spellbook, don't get the same result from opening it.
 
Level 9
Joined
Apr 19, 2011
Messages
447
Sorry for the long time without answering. Let's see...

Add debug messages to check if the level of the ability is not zero...

OK, OK... The level of the ability for the second dummy is 0. Thanks a lot for this advice, I found this issue thanks to you.
But here's the problem: why? I don't get it. I add the same ability, and I use the same command to set the levels of both dummies... I don't get why one of them has the correct level, and the other one has level 0...

Regards
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
Sorry for the long time without answering. Let's see...



OK, OK... The level of the ability for the second dummy is 0. Thanks a lot for this advice, I found this issue thanks to you.
But here's the problem: why? I don't get it. I add the same ability, and I use the same command to set the levels of both dummies... I don't get why one of them has the correct level, and the other one has level 0...

Regards

try adding
  • Set ITEM_Medicinal_Salve = (ITEM_Medicinal_Salve + 3)
to Second Dummy's Trigger and see if it works or not.
 
Level 9
Joined
Apr 19, 2011
Messages
447
try adding
  • Set ITEM_Medicinal_Salve = (ITEM_Medicinal_Salve + 3)
to Second Dummy's Trigger and see if it works or not.

I added debug messages to the trigger, and I saw the value of the ITEM_Medicinal_Salve variable at every moment. It's as it should be, 3.
However, the level of the ability for the first dummy is 3, while the level for the second dummy is 0. What's more, when I use the "Medicinal Salve" item, the value of the variable decreases in 1, and the level of the abilities changes. The first dummy had level 2, while the second one had level 0.
I mean, even changing the value of the variable, the level of the dummy still does not change.

I don't get why the level of the second dummy doesn't change...

However, I faced a second problem now. Right after adding the abilities, the tooltips do not appear at all. The Attack, Move, Patrol commands... my custom abilities... when I hover the mouse over them, nothing appears.
This didn't happen before.
Someone knows what can I do to face this?

EDIT: I faced now a very, very weird issue about all this... I'm constantly testing my proyect, in order to fix bugs, and check the perfomance of my systems... I had already assumed that the second dummy wouldn't be able to use items (because his "Medicinal Salve" ability had level 0, you know), however, in one of these tests, I found the following situation: The second dummy had the ability at the correct level, while the first dummy had the ability at level 0 (and so, he couldn't use the ability). The problem we've been discussing in this thread just got inverted!
It's like this bug is happening at a random pattern! Does this give you any ideas?

Also, I was wrong about the tooltips, they do not dissapear after adding the abilities... they dissapear from the very beggining. My map does not show any tooltips in any moment! Has someone faced this before?

Regards
 
Last edited:
What are the abilities of each dummy in object editor and why don't you give the "ITEM (Menu)" to them via object editor?
Are you, by any chance, using a Metamorphose or Chaos type ability on your dummies?
Didn't you speak about another spellbook ability in the first post?

As for now, you can test these settings :
the fields "Check dependencies" of the spellbook ("ITEM (Menu)") checked and then unchecked,
and use the action "Make ability permanent" on each of your dummies for each of the spells involved (Spellbook/Salve).
 
Level 9
Joined
Apr 19, 2011
Messages
447
What are the abilities of each dummy in object editor and why don't you give the "ITEM (Menu)" to them via object editor?
Are you, by any chance, using a Metamorphose or Chaos type ability on your dummies?
Didn't you speak about another spellbook ability in the first post?

As for now, you can test these settings :
the fields "Check dependencies" of the spellbook ("ITEM (Menu)") checked and then unchecked,
and use the action "Make ability permanent" on each of your dummies for each of the spells involved (Spellbook/Salve).

Oh my god... I don't clearly understand why, but since I checked the "Check dependencies" on the "ITEM (Menu)" spellbook, it worked!!! Now both dummies have the ability in the correct level.
Really, man, you made me so happy!! :thumbs_up:
I was beggining to think that this problem will take forever to be solved!

Note: I couldn't add the ability permanently to both dummies via object editor because that way they would be able to use it since the beggining of the game. I didn't want that.
Anyway, that doesn't matter anymore. The problem is finally solved!

Thank you very much, Tirlititi, and thanks as well to Spartipilo, Adiktuz and TwoVenomous for your attention.

Regards
 
Status
Not open for further replies.
Top