Wishing for a "string conversion," don't think it's there

M

MrJoeS

Guest
A trigger function I've worked out needs the ability to convert an item-type to a string, and it appears that that may be impossible. Unit-type to string conversion is there, as are integer to string, real to string and a few others. Is there any simple way around this?

[using tft]
 

Darg

Administrator
Reaction score
49
hmm you're right, item-type to string doesn't seem to exist, which is odd.

so the only time u would need to use this is when you want to output the string to the screen. is this what you are trying to do?
 

Darg

Administrator
Reaction score
49
how many items are you planning to have?

the best solution would be to create a string array variable and stick all the item names manually into the array. Then you would fetch these strings whenever you needed to.
 
M

MrJoeS

Guest
how many items? dozens.

I am actually not trying to display it on the screen. I am trying to compare an item-type name to a unit-type name. My units can pick up different weapons and equip them to change their attack.

For instance, you might see a Paladin (dude wielding a maul) run up to an item (which happens to be a sword) and pick it up. A few seconds later, Maul Arthas is replaced with Frostmourne Arthas.

If he comes across a magic wand, he could switch to being Yu-gi-oh Arthas, a scaled up priest.

There's plenty of room for more options, but I'm working through the mechanics of it now. As I have it designed so far, the player will move whatever weapon he wants to use to the upper left inventory slot, and use a hero ability called "Equip." This is based off of windwalk so that the hero can do it while walking, and not interrupt other orders. Come to think of it, using the "unit - replace" action may interrupt orders. I can work around that.

The trigger I planned to use was:

Code:
Event:
	Unit finishes casting an ability.
Condition:
	(Ability being cast) equal to (equip)
	String Comparison ((Guy with a) + (conversion: item-type of 
          (item carried by (triggering unit) in (slot 1))) not equal to 
          (conversion: unit-type of (triggering unit))

The action part is pretty well worked out in my head, but I need to be able to trigger it!

edit: trying to improve readability of code
 
M

MrJoeS

Guest
Ok, I've completely re-worked the weapon system. The new model is much smoother, more intuitive, and should work faster.

Weapons are now items based on the Staff of Reanimation, a perfect choice because it has a manually activated ability that does not drain charges or interrupt whatever order the wielder is currently executing. To equip a weapon, the hero just left-clicks it in his inventory. The range is set to infinite so it picks up the permanent corpse set at the center of the map by a trigger at initialization, and casts properly, but the number of units reanimated is zero, so there is no visible effect.

A trigger picks up the completion of the ability use, checks whether the hero is already the right unit, and if not, the trigger runs, setting variables for the hero's items (slot1[1], slot2[1], etc.), replacing the hero with the new one, re-stocking the hero's inventory and finally, re-selecting the hero.

The "steal item" ability trigger you helped me design has been re-worked to accomodate this change. It now chooses the item to remove and create for the thief based on a "current item in use" item-type array.

If a hero wants to switch to unarmed, he pops an ability based on immolation (come to think of it, I don't need to waste an "in motion" ability like that on this. I guess I'll change it to something else without a target that does halt the hero's motion) that activates a trigger that runs pretty much the same as the weapon-activate ones. Every armed hero has the "fight unarmed" ability.

There will need to be many many triggers for this system, but I guess there's no way around that. Will it be a problem for me to have a few dozen triggers all running from the "unit finished casting an ability" event? Will multiple items based off the same item or off the same item-ability interfere if they're in a hero's inventory together?
 

Darg

Administrator
Reaction score
49
you might find there is a temporary slowdown when that event fires, but it will most definitely depend on the speed of your comp.

i'm actually not sure about the story with items based off the same ability, I imagine it would be ok to give these to 1 hero. Just remember to take note of 'stats - cooldown group'. If all items are in the same group, the cooldown will affect them all obviously. So make sure you vary the cooldown groups for items.

Actually, if you don't even want cooldowns at all, forget that and just modify the cooldown durations - look in the abilities section under the folder special -> items.
 
M

MrJoeS

Guest
Hmm, how to limit the number of events perching on every move command...

Well, at the expense of map file-size, I can write individual, player-specific triggers. They could be turned on and off to limit the amount of frantic trigger checking that goes on.

The "trigger on/off" check doesn't work like an extra condition, does it? It will actually stop the trigger from eating up cycles, right?

Is it worthwhile to put first the condition most likely to disqualify a trigger from firing? If the map hits that one, finds it false, and stops checking subsequent conditions, that would help a little.
 

Darg

Administrator
Reaction score
49
it might if you have multiple triggers with multiple conditions running at the same time.

'trigger off' will not allow the trigger to run when its event(s) fire. i think you can still run a trigger manually when its off, but i'm not sure about that one (logic might dictate that you can't do this).

i'm not sure if i am able to help with the "player-specific triggers" thing you were pondering, i don't understand your map enough to qualify an answer (i think only you alone would be able to figure this one out).

re: map-file size : the heavylock map protector will cut between 40-60% out of your filesize, so its ok if you get up to around 400k. Above that limit, you'll get problems when ppl play it like "no 56k" and "dl = boot"

you should get heavylock now (faq) and find out exactly how much your map gets shrunk by.
 
M

MrJoeS

Guest
So far I've just been adding triggers, custom units, custom items and custom abilities. Those, I've added like it's going out of style. Terrain I've worked on some on a different map (different computer, too, actually back from the RoC days.) and I don't know how much that adds to map size.

I do know that not having to embed ability .txt files will help a lot.

Fortunately I plan to make this map very very versatile, so even 56k'ers will be able to sneak their way in, by having the map already.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top