HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Various Struct Questions

02-05-2008, 03:24 AM#1
Blue_Jeans
Okay, I have an ability that detects on attack and does a critical strike. The % is adjusted based on the attacked unit's health. It works perfectly fine like so:
Expand JASS:

However, I tried moving a few things around, and it causes warcraft to crash, as well as the text doesn't display:
Expand JASS:
What I did was attempt to do trigger cleanup with a .destroy call. So I created the onDestroy method, as well as created the texttag with what I thought was the proper way. With the textag done this way, it does not display the text. Also, warcraft will simply just crash when you get a critical strike.

1. What am I doing incorrectly with the onDestroy?
2. Why is it wrong?
3. Why doesn't the blasted texttag work?
4. Why is it that aside from integers and reals, my variables do not seem to work properly when called from a method like .variable? A string didn't work, but when I made an integer and then did an I2S(.integer), it displayed fine. I am guessing this is the same problem as question 3.

Edit: I thought my integers and reals were working, but I always use 0 as my default value. No matter the value of .integer, it would display 0. So they aren't working either. This leads me to believe that not a single variable of this struct is working, which is the cause of all my other problems. Yet, parts of it have to work outside of the methods, because the trigger still works as intended except for my blasted DamageConditions.
02-05-2008, 05:01 AM#2
Jazradel
The crash is almost certainly caused by DamageTarget activating the trigger which calls DamageTarget, causing an infinite loop.

You don't appear to be attaching the struct to the trigger at all. You need to use Handle Vars or CS_Cache or ABC.

You don't need to create a seperate trig variable, you can just do
set fcs.t = CreateTrigger()
straight off.

Also, you don't need to destroy boolexpr because they're saved in a lookup table.
02-05-2008, 05:48 AM#3
Blue_Jeans
I realized I'm not attaching it to the trigger. I was just on my way here to edit my post to say so but you had already posted. BTW, I don't have to use a system, it is normally just easier, plus using a system gives consistency. I've used my own methods for all my past attaching, but this one is just giving me a bugger of a time. So I'm going to use Cohadar's ABC.

I've read several posts in different places by different people to bloody destroy them. So I'm going to! :)

Edit: Forgot to post my code which still crashes:
Edit2: It works now. I had a small logic error:
Expand JASS:
Offtopic: I tend to figure out my own problems, but not until AFTER I resort to posting. I still appreciate your time though, jazradel.