Trigger help, involving pick every unit, and integer variables

Im_On_56k

Hm...
Reaction score
116
Code:
Kill All players mario
    Events
        Time - Every 0.05 seconds of game time
    Conditions
    Actions
        -------- set bj_wantDestroyGroup = true --------
        Unit Group - Pick every unit in (Units owned by Player 12 (Brown) matching ((Unit-type of (Matching unit)) Not equal to Block)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is alive) Equal to True
                    Then - Actions
                        -------- set bj_wantDestroyGroup = true --------
                        Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and (((Unit-type of (Matching unit)) Not equal to Fireball) and ((Unit-type of (Matching unit)) Not equal to Mar and do (Actions)
                            Loop - Actions
                                Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching (Mushroom_Mario[(Player number of (Owner of (Picked unit)))] Equal to 0)) and do (Actions)
                                    Loop - Actions
                                        Unit - Kill (Picked unit)
                                        Wait 0.50 game-time seconds
                                        Set Mushroom_Mario[(Player number of (Owner of (Picked unit)))] = 0
                    Else - Actions
                        Do nothing

When i get a mushroom powerup i dont get killed but i cant get killed for the rest of the game, the mushroom_mario isnt setting itself back to 0.
 
Can you give a discription of what exactly the trigger is supposed to do?
 
That kills mario if he gets near a unit. It was working untill i added the mushroom feature, where you don't die in 1 hit.
 
This is just a stab in the dark, but I noticed you used a dual Loop statement, and within you referred to "picked unit" (edit: heck it looks like you used a triple loop)

Is it possible that the second "picking" statement is overwriting the data held in the first one? How is the second one supposed to know it needs to use the "picked" unit from the first pick loop, and not its own pick loop variable?

Maybe you might want to try breaking them off into single loops, unnested, and using variables to store data to be shared between the two?
 
Ah nvm i found out why i just looked at my condition in pick units and it only does the action if its 0, so it would't set it to 0 if its 1, also the 2 loops work. because it kills the unit if the mushroom isnt on mario.
 
Code:
Kill All players mario
    Events
        Time - Every 0.05 seconds of game time
    Conditions
    Actions
        -------- set bj_wantDestroyGroup = true --------
        Unit Group - Pick every unit in (Units owned by Player 12 (Brown) matching ((Unit-type of (Matching unit)) Not equal to Block)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is alive) Equal to True
                    Then - Actions
                        -------- set bj_wantDestroyGroup = true --------
                        Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and (((Unit-type of (Matching unit)) Not equal to Fireball) and ((Unit-type of (Matching unit)) Not equal to Mar and do (Actions)
                            Loop - Actions
                                Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching (Mushroom_Mario[(Player number of (Owner of (Picked unit)))] Equal to 0)) and do (Actions)
                                    Loop - Actions
                                        Unit - Kill (Picked unit)
                    Else - Actions
                        Do nothing
        Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and (((Unit-type of (Matching unit)) Not equal to Fireball) and ((Unit-type of (Matching unit)) Not equal to Mar and do (Actions)
            Loop - Actions
                Set Mushroom_Mario[(Player number of (Owner of (Picked unit)))] = 0

Still doesn't work hmm.
 
Whenever using nested loops (a loop inside a loop, in case you don't know), and you are referencing picked unit, you need to store the picked unit into a variable, or it won't know to which picked unit you are referring. Hope that clears it up. :)
 
How about setting it up like this: (Pseudo code)

Kill All players mario
Events
Time - Every 0.05 seconds of game time
Conditions
Actions

-------- set bj_wantDestroyGroup = true --------

Unit Group - Pick every unit in (Units within 100.00 of (Position of (Mar))
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is alive) Equal to True
(Owner of (Picked Unit) is an ally of (Owner of (Mar)) = False)
(Unit-type of (Picked unit)) Not equal to Fireball
... etc other clauses you want to add ...
Then - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Mushroom_Mario[(Player number of (Owner of (Mar)))] = 0
Then - Actions
Unit - Kill (Mar)
Else - Actions
Set Mushroom_Mario[(Player number of (Owner of (Mar)))] = 0
Else - Actions
Do nothing



-- Note, you should be careful about running triggers as often as 0.05 seconds. In your original, it could theoretically lag the map out or crash it if too many units had to be run through all those picks.
 
What's with those "set bj_wantDestroyGroup=true"? Those are functions, and they destroy Unit Groups so they don't leak, but why in the world are you making them comments? Also, you can onbly destroy them AFTER they are created, and if you put it before, it destroys the last created group. (Which is random) Destroy it ONLY after your finished with it.
_________
The revelation is coming...

Visit the A World Ablaze forums today!
 
"Mar" really isn't anything its just a cut off of words because the one action is so long it won't fit even if i copy as text its so long it won't fit here.

Mar is in a unit type condition, there is no variable or unit connected to the mar.
 
Tried something different, now the mushroom comes in effect but now mario doesn't die if he got a mushroom.

Code:
Kill All players mario
    Events
        Time - Every 0.05 seconds of game time
    Conditions
    Actions
        -------- set bj_wantDestroyGroup = true --------
        Unit Group - Pick every unit in (Units owned by Player 12 (Brown) matching ((Unit-type of (Matching unit)) Not equal to Block)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) is alive) Equal to True
                    Then - Actions
                        -------- set bj_wantDestroyGroup = true --------
                        Unit Group - Pick every unit in (Units within 100.00 of (Position of (Picked unit)) matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and (((Unit-type of (Matching unit)) Not equal to Fireball) and ((Unit-type of (Matching unit)) Not equal to Mar and do (Actions)
                            Loop - Actions
                                If (Mushroom[(Player number of (Owner of (Picked unit)))] Equal to False) then do (Unit - Kill (Picked unit)) else do (Do nothing)
                                Wait 0.50 game-time seconds
                                If (Mushroom[(Player number of (Owner of (Picked unit)))] Equal to True) then do (Set Mushroom[(Player number of (Owner of (Picked unit)))] = False) else do (Do nothing)
                    Else - Actions
                        Do nothing
 
Uh...shouldn't you just have a simple trigger without any event or condition that is just run by, say, pitfalls and attacked by a unit or someat? You might want a spare trigger that runs this particular trigger to have unit is within 10 of Mario or something like that.

Code:
MarioDeath
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                HasMushroom Equal to True
            Then - Actions
                Set HasMushroom = False
                -------- Run the rest of the sizing down and whatever that you do when Mario loses a mushroom.... --------
            Else - Actions
                -------- Do the losing stuff. --------

And HasMushroom is obviously Boolean. You can set it to true when Mario acquires an item with condition item is equal to ___. You can also set it to true if Mario is within 10 of Mushroom where you delete the mushroom on the side besides making mario large and stating he has eaten a mushroom.

I think the best thing to do to kill Mario would be to give him 1 hp and make units attack for 1 damage (1 dice, 0 side) and melee range (well, bombard if they're a bullet bill cannon or something of the sort).

And then, when you have a mushroom, make Mario invincible or give him 2 hp. If he's invincible, you'll have to use another trigger with within range recognition to make Mario not invincible any more upon using mr mushroom.
 
Making units attack won't work because

1. I want it to look like a mario map.
2. Won't work with the other triggers that involve mario killing units, and lives and more.

Ill try something like that you have posted and get back to you.
 
Well that's fine. You can keep your within range triggers, as those work well :)

Clearly what I've said should pretty much work anyhow (everything but the hp and attacking suggestions).
 
Little problem with your trigger, it woudln't work that great with multiple players. To make it work id have to make a trigger for each player.
 
Ah found a solution to that.

I made a trigger variable array, and set it to a specific trigger for each array in it, than i made it run the player number of owner of picked unit :D, i just gota test it now.
 
Yea, you're right.

If you're aiming for multiplayer, you'd be best either using JASS to give the function the number player (the Boolean can easily become an array) to effect or inefficiently sticking this little snippet of code in every single trigger where it's needed--aka whenever you touch a computer unit or hit by fire or something like that.

Edit: Oh you found out the answer before I could state it (was typing this before you posted the above) :D

That would work too. I don't know which is more efficient. Having the snippet of code wherever it's needed, or scrapping that and using a trigger array like you're doing.
 
Ok it works and doesn't work, i simply am clueless but not gonna give up till i find th answer.

I used your trigger but since the 0.05 event for the first trigger, it simply sets it to false pretty much 1 milisecond later it kills you because it ran the trigger and its false!

I added a wait game time 0.05 before the trigger run and that made me unable to die even if i wait ontop of the unit.

I tried changing it to ever 0.30 seconds but did nothing.
 
....

NO EVENTS AND NO CONDITIONS IS WHAT I SAID!!

:banghead: :banghead:

Sorry, I kind of exploded there. But yea, that's what I said, dang it :D

You have to think about something here. If you don't place events on a trigger it can't run unless told to inside of a trigger WITH an event (or on a trigger that is run by a trigger with an event...the list goes on). If you choose to ignore the conditions (NOT THE ONES IN THE ACTIONS, mind you), you will also ignore the events, so as to make a trigger usable with the event and just used for its actions on the side (you don't need it, but one of the main keys to making a game restartable is simply running the initialization trigger ignoring the event of course because otherwise it'll confuse the computer.

-------

The buddy trigger I suggested was not your piece of interesting ideas. I suggested one that had an event A unit is within (say, 100) of Mario, and there is no silly periodic event needed.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    How often does the Trending Content box refresh?
  • The Helper The Helper:
    Also, in the last template there was a seperation between sticky threads and regular threads in the forum
  • Ghan Ghan:
    Not sure. It's probably part of a cron job.
  • The Helper The Helper:
    Hey Ghan, whatever cron job its part of its not running its been the same for days. If it does not work can we remove it?
  • The Helper The Helper:
    LOL! A tweak job!
  • The Helper The Helper:
    this is the fix I get from that yeah this is hard to control. disabling bots is pretty much necessary as ai and other bots would push really old threads to the top. reduce weight of view count. disable guest view tracking if you really want to push active threads to the top. a bit of tinkering for a few days with the weights and other settings should get you a decent trending widget box.
  • Ghan Ghan:
    I changed the settings a bit.
  • Ghan Ghan:
    Narrowed it to 7 days for the half-life and set views to 0 weight.
  • The Helper The Helper:
    I dont think Trending would work for this forum it would be better to just have the last 5 posts from anywhere
  • Ghan Ghan:
    Probably will have to give it some time to update.
  • Ghan Ghan:
    I'm guessing it is not retroactive.
  • Ghan Ghan:
    Next on the punch list: Update the server to Ubuntu 24.04.
  • The Helper The Helper:
    Mad Lads is new I see it displays original post date
  • The Helper The Helper:
    as long as it changes it is good - it is good now it updated and its new stuff
  • The Helper The Helper:
    One thing I have noticed and I dont know if it is by design but like 1 out of 3 times I come to the site the Anubis screen just hangs open, if I refresh it will go away but sometimes it hangs
  • Ghan Ghan:
    I've seen that as well.
  • The Helper The Helper:
    Wow - the change in the stats are major. I kind of knew it was all bots but wow, to see the effect. Why the social media sites cant do something like this I have no idea.
  • Ghan Ghan:
    Probably inflates their numbers so they look better to advertisers.
  • The Helper The Helper:
    Yeah google does not filter those bots. I remember when Apex was doing Google ads I saw the same IPs in there as I was seeing here - google is totally tracking all those bots as traffic and most google traffic, at least ours, was all bots
  • The Helper The Helper:
    oh wow, i bet i can post x links now and do the webp pics now giggity
  • The Helper The Helper:
    ahh anubis blocks anyone that has javascript turned off
  • The Helper The Helper:
    Robot: HTTP client library - i love the new robot :)
  • The Helper The Helper:
    New Science News Forum and it starts out with 420 threads :)
  • The Helper The Helper:
    Technical Support forum name changed To Technology News, there is now a Tech, sci/tech and science forums now :)

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top