Hello, I'm a nooby and I'm curently working with 3 other person (nooby too) on a Starcraft II mod. I now understand well the basic mecanics of the Galaxy editor but I got a problem. Is it possible to instantiate a script like in every object based programming language?
The example is that I create a simple Trigger that manage a unit behavior (attack when <PlayerUnit> enter the zone), but this trigger works only for this unit and if I want another unit acting like that I must copy/paste this trigger script and attach it to the new unit. It's quite a mess, moreover, in fact I got more than one trigger so I must copy/paste a whole folder.
I though it's maybe possible to make something by creating my own library (For the moment I dont really know how to use them).
Thanks for the awnsers and sorry for my english, I'm french
Well, you have plenty workaround, but depends on what you really wanna do.
For example if you wanna multiple units that attack when a PlayerUnit enter the zone, you can add every unit in a unit group, and give a unit group command.
Ok, Thanks for the answers. I will probably use functions and arrays to try to find a way to make this simpler, but as I understand I will have to copy paste all my scripts for each entity and there is no solution to change this.
Thanks for the help, I will probably come back for other question and talk about my map (or try to help with my little knowledge of the editor) :D
Another question, how can we set an array as parameter of a function? Because I created a function that need an array as parameter but it doesn't seems to be possible (the option cannot be use))
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello, I'm a nooby and I'm curently working with 3 other person (nooby too) on a Starcraft II mod. I now understand well the basic mecanics of the Galaxy editor but I got a problem. Is it possible to instantiate a script like in every object based programming language?
The example is that I create a simple Trigger that manage a unit behavior (attack when <PlayerUnit> enter the zone), but this trigger works only for this unit and if I want another unit acting like that I must copy/paste this trigger script and attach it to the new unit. It's quite a mess, moreover, in fact I got more than one trigger so I must copy/paste a whole folder.
I though it's maybe possible to make something by creating my own library (For the moment I dont really know how to use them).
Thanks for the awnsers and sorry for my english, I'm french
@Doom2Darkness: Go
Well, you have plenty workaround, but depends on what you really wanna do.
For example if you wanna multiple units that attack when a PlayerUnit enter the zone, you can add every unit in a unit group, and give a unit group command.
You cannot instatiate it directly..
But if you have 3 units that should start the trigger (e.g. your Unit Enters Region trigger) then just add 3 events with each unit.
You can also use "Any unit enters region" and specify a condition such as "(Triggering Unit) == PlayerUnit".
there are functions. you can use arrays and parameters to reduce the number of triggers.
you have to call them with custom script.
Ok, Thanks for the answers. I will probably use functions and arrays to try to find a way to make this simpler, but as I understand I will have to copy paste all my scripts for each entity and there is no solution to change this.
Thanks for the help, I will probably come back for other question and talk about my map (or try to help with my little knowledge of the editor) :D
if you do it right, one trigger+one function+a few arrays does work for all different units. don't know what these units suppose to do...
maybe I'm posting a small example later
Another question, how can we set an array as parameter of a function? Because I created a function that need an array as parameter but it doesn't seems to be possible (the option cannot be use))