System Multi-Instance in GUI

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
--- Introduction ---
I have derived a method that can make ANY spell Multi-Instance. :)

Multi-Instance means an ability can be cast many times without the codes interfering with each other.
It is not restricted to "per Player" or even "per Unit".

This is created for GUI, but if you take it as a Concept rather then a System. It can be applied to many things. :eek:


--- How to do it ---
I call it a 2-Step Trigger:

When the "Casting" trigger fires, it will store information needed in preset arrays and unleash the "Spell" triggers to complete the task. Heres the templates for the triggers:
Code:
Template Casting
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to YourAbility
    Actions
        For each (Integer B) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Active[(Integer B)] Equal to False
                    Then - Actions
                        -------- Initialization --------
                        Set Active[(Integer B)] = True
                        -------- Delete Where Applicable or DWA --------
                        Set DWACastingPoint[(Integer B)] = (Position of (Triggering unit))
                        Set DWACastingUnit[(Integer B)] = (Triggering unit)
                        Set DWATargetPoint[(Integer B)] = (Target point of ability being cast)
                        Set DWATargetUnit[(Integer B)] = (Target unit of ability being cast)
                        -------- Run External Trigger --------
                        [COLOR="Red"]Trigger - Run SpellTriggers[(Integer B)] (ignoring conditions)[/COLOR]
                        Skip remaining actions
                    Else - Actions
                        Do nothing
        Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Spell Fizzle

There will be multiple "Spell" Triggers stored in an array for the "Casting" trigger to call (reflected by the red code above).
Basically all the spell triggers are the same, except the variables; They need to be hard-coded.

Code:
Template SpellTrigger01
    Events
    Conditions
    Actions
        -------- Whatever Actions you want --------
        -------- Clean Up --------
        Set Active[1] = False
        Custom script:   call RemoveLocation(udg_DWACastingPoint[1])
        Custom script:   call RemoveLocation(udg_DWATargetPoint[1])


--- Explanation ---
:confused: Overall, this is more a Concept then a System :confused:

To use an analogy: :eek:
- Assuming you own a Hotel, with guest coming a random times, sometimes alone, sometimes in a crowd.
- When a guest, A comes, you sent him/her to one of your rooms, you set the room to be "occupied"
- When another guest, B comes along, you allocate another room for him/her
- When the guest, A leaves, you clean up the room and it becomes usable for future guest.
- As long as you have more rooms then possible guest coming, you can accommodate everyone

Similarly for triggers: I created a "Casting" trigger
- When the Ability is cast, allocate "space" for it.
- When the Ability is cast again before the first one ends, allocate another "space" for it.
- When the Ability ends, clean up. :D
- Just make sure you have more "spaces" preset to prevent overflowing.

So, Basically, you create many "Spaces" for the Ability. Each time the Ability is used, one of the spaces will be allocated. "Spaces" you need is highly dependent on the situation.
- An AOS type map where each user only controls a "Hero", number of "Spaces" needed would equate number of player.
- An upgrade of a basic unit's ability would require much more "Spaces" as the ability would be very frequently used.


--- In Action ---
I have attached a map with the Templates and a working version
Basically, you have a "Banshee" with an edited version of "Curse" :nuts:

What Spell Do:
- Change ownership of cursed unit to the caster
- After 10seconds, Unit experience emotional struggle (Pause)
- After 5 seconds of emotional turmoil, the Unit cannot tolerate being controlled and self destruct dealing damage to nearby enemy units

The spell is simple as I want the focus to be on the System.
And take note of the time when the spell fizzles :shades:


--- Conclusion ---
Feedback welcome
Will try to terrain the map and release wit v.1.1 with updates
 

Attachments

  • Template.w3x
    32.9 KB · Views: 269

duyen

New Member
Reaction score
214
Umm, long waits (Like over 5 minutes.) means people can cast the spell lots more than ten times.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
Umm, long waits (Like over 5 minutes.) means people can cast the spell lots more than ten times.

:confused: Erm..... actually 10 was only an example figure, the value can up set higher or lower depending on situation. For example AOS with 10 player, given the cool-down is about half the duration of the spell, you would need 20 "spaces" to accommodate. If the cool-down is lower, just add more "spaces".


In event that there is a need to create 50 "spaces", the problem is just doing the tedious work to code in the variables for each passive trigger... with an easy way out:
Duplicate the original trigger 50 times, rename the duplicates accordingly and convert them into custom text, then use the "Find" to locate all the variables and replace them respectively. :D
 

Hatebreeder

So many apples
Reaction score
381
:confused: Erm..... actually 10 was only an example figure, the value can up set higher or lower depending on situation. For example AOS with 10 player, given the cool-down is about half the duration of the spell, you would need 20 "spaces" to accommodate. If the cool-down is lower, just add more "spaces".


In event that there is a need to create 50 "spaces", the problem is just doing the tedious work to code in the variables for each passive trigger... with an easy way out:
Duplicate the original trigger 50 times, rename the duplicates accordingly and convert them into custom text, then use the "Find" to locate all the variables and replace them respectively. :D

Hmmm... I might not understand whats going on... So, 1 of these Triggers allow the Non-Instancerable Spell to be cast 1 more time?
-Say you have you Multiple Instancerable Trigger in your map. And 10 Units of the same Type, cast the Same Spell, which has Waits in them. Will only 2 of them be Cast as Usual ( Original Spell + The Instancerable Trigger)? Or will all of them not tend to fuck up?
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
To cut the long story short:

First determine how many times you want your spell to be cast "safely"

Then, create triggers according to that number, following the System.

Regardless of caster, the spell would be able to appear X amount of times without error, even if they have up to 5 mins wait time;
So if you set it as 10, you can cast your spell 10 times without error.

Download the attachment, its a little one player game, with system in action.
1 unit casting wait spells multiple times.
 

Hatebreeder

So many apples
Reaction score
381
To cut the long story short:

First determine how many times you want your spell to be cast "safely"

Then, create triggers according to that number, following the System.

Regardless of caster, the spell would be able to appear X amount of times without error, even if they have up to 5 mins wait time;
So if you set it as 10, you can cast your spell 10 times without error.

Download the attachment, its a little one player game, with system in action.
1 unit casting wait spells multiple times.

Ok, i got it now ^^ Very nice System actually... You get a 5 Star Bump from me =)
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Trigger - Run SpellTriggers[(Integer B)] (ignoring conditions)
So that means that you need to have 1 trigger for every instance you might possibly need? That sounds ridiculous.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
So that means that you need to have 1 trigger for every instance you might possibly need? That sounds ridiculous.

Yes, 1 trigger per instance.

Just using the some common cases :
AOS, 1 hero per player, 10 players max. You only need about 11 triggers, not that much i would say, but this would be better done with MPI. Arrayed variables using player number as reference.

RPG, 4 player RPG, each with a Hero and a possibility of each Hero able to cast the ability twice (within cool down). Then we would need about 9 triggers. In my opinion, rather good "trade-off".

As mentioned above, only the two triggers would need coding, others would be "clones" or "duplicates"


Sound ridiculous... maybe, lets ask some questions

Does total number of triggers cause problems?
Not that I know of, but I may be wrong, since I am no expert. :D
However, I don't see any maps which throws everything into 1 trigger, so I assume otherwise.

Does many triggers makes things messy?
Yes, but WE triggers are stored in folders, so keeping the folders tidy means triggers would be tidy too.

Does that many triggers make debugging harder?
Yes, there are many triggers, but most of them are "duplicates", which are copy of the original; If the original is correct, the "duplicates" should be too. However, they might be human errors involved while switching.

So, its not as ridiculous as it sound after all. :D


Anyway, what i personally think ;) For making Custom Abilities MUI or MI

For proficient jass user, this is usually not even an option, its more like a MUST; due to the usage of local variables and functions, its should be easily done.

However, for a GUI user, there must be a way, other then "learn jass". Simply declaring a local variable named "udg_watever" may be useful, but NOT applicable when dealing with conditions and unit groups.


So when you are stuck in GUI with the only option offered as "Learn jass"
Try using MoonSlinger's MI system for GUI :p
<3 *Shameless self promotion* <3
 

chovynz

We are all noobs! in different states of Noobism!
Reaction score
130
...

Anyway, what i personally think ;) For making Custom Abilities MUI or MI

For proficient jass user, this is usually not even an option, its more like a MUST; due to the usage of local variables and functions, its should be easily done.

However, for a GUI user, there must be a way, other then "learn jass". Simply declaring a local variable named "udg_watever" may be useful, but NOT applicable when dealing with conditions and unit groups.
...

I didn't get this bit. A Jass user wouldn't make a trigger for each instance. A local trigger is a self contained world that gets run everytime an instance of it is called. Theres still only one trigger though. Not 30.

For a GUI person, there are other options to learning jass. It's just you will limit what you can do if you refuse to learn jass. One of those options is to make a trigger for each player. It does get messy when you're dealing with 100 paletes (Ever tried to concatenate 13 string directives?? :eek:)

And I would say that your "system" doesn't allow for very fast spells. Like spammable bullets - where you can clock up to near 100 per person. Far easier to actually use many of the local tutorials on this site and a bit of custom script, with remove locations...at the very least.
 

MoonSlinger

I Love using Cheap Tricks... only Results matters
Reaction score
74
I didn't get this bit. A Jass user wouldn't make a trigger for each instance. A local trigger is a self contained world that gets run everytime an instance of it is called. Theres still only one trigger though. Not 30.

Sorry for not being clear on this part, :p
What i meant was, jass users would be able to make an ability MUI without the use of this system. I do not know what is considered standard, but personally, I would reject any ability made via jass which is not MUI.

Functions with their own local variables would run as many times as you like without errors; local variables are... local. However, if you can only use global variables (as in what a GUI user would face) this system just simulate that effect, via running multiple triggers instead.


For a GUI person, there are other options to learning jass. It's just you will limit what you can do if you refuse to learn jass. One of those options is to make a trigger for each player. It does get messy when you're dealing with 100 paletes (Ever tried to concatenate 13 string directives?? :eek:)

:D I think I am one of the rare people who knows jass but refuse to use it :D

I agree, without jass, there will be limitations.
There will also be cluster of triggers, inefficient codes and many other problems.

But the question is: How to reduce the limitation? :)
People came up with the MPI and MUI systems for GUI even though those problems can be solved via "Learn jass". This is just another version of it, another opening to reduce the gap between GUI and jass.


And I would say that your "system" doesn't allow for very fast spells. Like spammable bullets - where you can clock up to near 100 per person. Far easier to actually use many of the local tutorials on this site and a bit of custom script, with remove locations...at the very least.

Declaring a local variable names "udg_whatever" is good, but there is a little problem here; when using a condition (if/else) or a unit group. GUI automatically creates a new function to handle these actions. Since locals are restricted to their respective function, they do not work. The whole idea of running another trigger is to overcome this problem.

With reference, to make a highly spammable bullets... with a little modification my original codes can do the work with a local integer.
Do note that since a local is used, that means the usage of Conditions and Unit-Groups is out of question. Also, there is another limitation due to array size.
(codes below - changes in red)

Code:
Template Casting
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to YourAbility
    Actions
[COLOR="Red"]        Custom script:   local integer udg_Instance = 0[/COLOR]
[COLOR="Red"]        For each (Integer B) from 1 to 8000, do (Actions)[/COLOR]
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Active[(Integer B)] Equal to False
                    Then - Actions
                        -------- Initialization --------
 [COLOR="Red"]                       Set Instance = (Integer B)[/COLOR]
                        Set Active[Instance] = True
                        -------- Delete Where Applicable or DWA --------
                        Set DWACastingPoint[Instance] = (Position of (Triggering unit))
                        Set DWACastingUnit[Instance] = (Triggering unit)
                        Set DWATargetPoint[Instance] = (Target point of ability being cast)
                        Set DWATargetUnit[Instance] = (Target unit of ability being cast)
                        -------- Content of Ability --------
[COLOR="Red"]
                        <Fill In the Blank>
[/COLOR]
                        -------- End of Content of Ability --------
                        Set Active[Instance] = False
                        Skip remaining actions
                    Else - Actions
                        Do nothing
        Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: Spell Fizzle
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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