I have basically copied the "Unit Takes Damage" event/function and deleted two parameters in it to reduce the amount of code. I can save and compile when the function isn't in use, but not if it is, which leads me to think that the function isn't valid or something?
The reason why I want this is because I have a suspicion that the game will run slow or crash on slow pc's if I use the built-in "Unit Takes Damage" function. Check out the pictures below. The line that is marked is the thing that causes the error.
Unfortunately no, and adding back "Fatal or Non-fatal" option does not work either. It's as if we are not allowed to create our own functions in the editor :/
We are. Your work is on the right? As for how slow it would run on lower end pc's, I wouldn't worry about it. Sc2 was coded to be ran on a wide variety of machines. I highly doubt this simple thing would make it lag.
The events entries you see in the editor are really just the 'prototypes'. They just declare what parameters each kind of event will be passing whenever it triggers, so that galaxy knows whats up. The actual code that handles events is completely hidden, hard-coded in the game. Something has to actually test each game frame whether an event has happened.
As far as I can tell there is no way to create a brand new events which are checked by the blizzard event handler system.
You can make your own event handler, but I do not think you can make it nearly as fast for this application.
Alright, thanks for your replies. Btw, removing the 'Native' flag did not change anything. I got the same error message when I saved.
I think I'll just stick with the built-in "Unit Takes Damage" event.
Yeah removing the native flag merely lets you actually type in script for the custom event. Since you had no script at all, ie the event definition you were defining does nothing, it won't matter one way or the other whether it is checked.
If you actually wanted to make a custom event then you would need to add script there which caused the trigger passed to the event to be added to your custom event handler.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have basically copied the "Unit Takes Damage" event/function and deleted two parameters in it to reduce the amount of code. I can save and compile when the function isn't in use, but not if it is, which leads me to think that the function isn't valid or something? The reason why I want this is because I have a suspicion that the game will run slow or crash on slow pc's if I use the built-in "Unit Takes Damage" function. Check out the pictures below. The line that is marked is the thing that causes the error.
Try adding back "Damage Effect". I'm thinking the game acquires Triggering Damage Taken from Damage Effect.
@Tudentau: Go
Unfortunately no, and adding back "Fatal or Non-fatal" option does not work either. It's as if we are not allowed to create our own functions in the editor :/
We are. Your work is on the right? As for how slow it would run on lower end pc's, I wouldn't worry about it. Sc2 was coded to be ran on a wide variety of machines. I highly doubt this simple thing would make it lag.
Your trigger should probably not have the 'Native' flag.
Native means the actual trigger code for it is hard-coded in the game(presumably because it's way faster that way).
Is it even possible to make custom events?
Bothered to do a little research this time, hehe.
The events entries you see in the editor are really just the 'prototypes'. They just declare what parameters each kind of event will be passing whenever it triggers, so that galaxy knows whats up. The actual code that handles events is completely hidden, hard-coded in the game. Something has to actually test each game frame whether an event has happened.
As far as I can tell there is no way to create a brand new events which are checked by the blizzard event handler system. You can make your own event handler, but I do not think you can make it nearly as fast for this application.
Alright, thanks for your replies. Btw, removing the 'Native' flag did not change anything. I got the same error message when I saved. I think I'll just stick with the built-in "Unit Takes Damage" event.
@TheLazzoro: Go
Yeah removing the native flag merely lets you actually type in script for the custom event. Since you had no script at all, ie the event definition you were defining does nothing, it won't matter one way or the other whether it is checked.
If you actually wanted to make a custom event then you would need to add script there which caused the trigger passed to the event to be added to your custom event handler.