• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Explain this process please!

Status
Not open for further replies.
Level 22
Joined
Aug 27, 2013
Messages
3,973
Set Int_Pyrs_Active = (Int_Pyrs_Active + 1)
is pointing how many players that active when the game is started, that's why we call it a pointer

For each (Integer Int_Pyrs_Unactive) from 1 to Int_Pyrs_Active, do (Actions)
it's looping up to number that has been stored earlier in "Int_Pyrs_Active"
if inside "Int_Pyrs_Active" equals to 10 then "Int_Pyrs_Unactive" also equals to 10
then this "Set Pyr_Left = (Owner of U_Footman[Int_Pyrs_Unactive])" check the owners of units that earlier were created.

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Pyr_Left slot status) Equal to Has left the game
Then - Actions
Set U_Footman[Int_Pyrs_Unactive] = U_Footman[Int_Pyrs_Active]
Set Int_Pyrs_Unactive = (Int_Pyrs_Unactive - 1)
Set Int_Pyrs_Active = (Int_Pyrs_Active - 1)
Else - Actions
If the owner of units that earlier were created has left the game, then
Set U_Footman[Int_Pyrs_Unactive] = U_Footman[Int_Pyrs_Active]
Set Int_Pyrs_Unactive = (Int_Pyrs_Unactive - 1)
Set Int_Pyrs_Active = (Int_Pyrs_Active - 1)
to store the current number of Units that each player currently has

Unit Group - Pick every unit in (Units of type (Unit-type of U_Footman[Int_Pyrs_Active])) and do (Actions)
Loop - Actions
i'm not sure but, is the first trigger already run before this?

if the first trigger is already run, then "Int_Pyrs_Active" equals to 10 and the units were already created which explain why it works
 
All I can say is you should learn the basics of programming before moving on.
It's simple as that.

You can't explain someone a car if he doesn't know what wheels are.



I'll try nonetheless, since I'm a nice guy.


The first trigger you posted counts all (human) players in the game, Creates a footman for each and stores it into the U_Footman array variable. The index for this variable is counted upwards for each player.

That means if player 1, 3 and 4 are in the game, then player 1 has U_Footman[1], player 3 has U_Footman[2] and player 4 has U_Footman[3].


The second trigger you posted now walks through the U_Footman array one by one and checks if the owning player of that unit has left or not. If he has, then the particular Footman is removed from the array and replaced with the last footman in the list.

So if, in my example, player 3 leaves, U_Footman[3] now becomes U_Footman[2] and the array value for U_Footman[3] gets cleared (so that the unit isn't doubled in the array).

This is the basic principle of a stack. Once you take something out from the middle, everything above it will "drop down" by the now empty place.


The "Pick every units" thing you posted basicly loops through all units of the same type on your map as the last footmen stored in the array.
 
Level 12
Joined
Mar 17, 2007
Messages
412
i'm not sure but, is the first trigger already run before this?

if the first trigger is already run, then "Int_Pyrs_Active" equals to 10 and the units were already created which explain why it works

It was a example of it being used, basically U_Footman[Int_Pyrs_Active] works for all players alive, at least it does for me, this is originally what I thought but people told me no it only points to 1 thing at a time - pointer - object blah blah so and so, it makes it frustrating while trying to learn something then people tell you otherwise which causes a complete mess.

U_Footman[Int_Pyrs_Active] <--- What is this?

U_Footman[All Players?] <--- This?

U_Footman[random player?] <--- This?

U_Footman[nothing?] <--- This?

U_Footman[player object?] <--- This? (makes no sense)
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
It was a example of it being used, basically U_Footman[Int_Pyrs_Active] works for all players alive, at least it does for me, this is originally what I thought but people told me no it only points to 1 thing at a time - pointer - object blah blah so and so
this
The "Pick every units" thing you posted basicly loops through all units of the same type as the footmen stored in the array.
 
Level 12
Joined
Mar 17, 2007
Messages
412

The "Pick every units" thing you posted basicly loops through all units of the same type on your map as the last footmen stored in the array.

Really? Because people from hiveworkshop are telling me that nothing is stored there because it's only a pointer in which I described above but THANKS for clarifying that.

All I can say is you should learn the basics of programming before moving on.
It's simple as that.
You can't explain someone a car if he doesn't know what wheels are.

That was completely unnecessary don't judge me, and don't make assumptions I was asking to make sure I was on the right track because people from hiveworkshop tell me otherwise
 
It was a example of it being used, basically U_Footman[Int_Pyrs_Active] works for all players alive, at least it does for me, this is originally what I thought but people told me no it only points to 1 thing at a time - pointer - object blah blah so and so, it makes it frustrating while trying to learn something then people tell you otherwise which causes a complete mess.
It actually only retrieves the unit-type of the last unit stored in the U_Footman array. So you could also just make it loop through all footmen in the first place. That's why people suggest it does nothing, while in fact, it does something. The expression inside the group loop serves no real purpose, as you already know the unit type (which is a footman) and could just use that directly.

U_Footman[Int_Pyrs_Active] <--- What is this?
Thats a unit array. Int_Pyrs_Active always returns the number of players active in the game. So U_Footman[Int_Pyrs_Active] will always return the last footman stored in the array.

U_Footman[All Players?] <--- This?

U_Footman[random player?] <--- This?

U_Footman[nothing?] <--- This?

U_Footman[player object?] <--- This? (makes no sense)
All this is wrong input data and will cause your map to not compile properly, as array variables always expect an integer index.

What you can do, however, is converting the player variable to an integer by getting the player ID of a player.

That was completely unnecessary don't judge me, and don't make assumptions I was asking to make sure I was on the right track because people from hiveworkshop tell me otherwise
That's not just an assumption. You seem to be totally confused by the concept of loops and array variables, which are the most fundamental things in programming. You should read up on that on wikipedia first, so that you actually understand what you do.
 
Level 12
Joined
Mar 17, 2007
Messages
412
Int_Pyrs_Active always returns the number of players active in the game.

Int_Pyrs_Active <--- My question was this the array as people said nothing is actually stored there when in fact I know something is because it works in game but people insist on telling me otherwise.

So U_Footman[Int_Pyrs_Active] will always return the last footman stored in the array.

Yes I know the footman is the main set unit unless nulled I already know that thanks

All this is wrong input data and will cause your map to not compile properly, as array variables always expect an integer index.

They were just questions, just ignore them now

What you can do, however, is converting the player variable to an integer by getting the player ID of a player.

I'm not sure how to get the "ID" of a player



That's not just an assumption. You seem to be totally confused by the concept of loops and array variables, which are the most fundamental things in programming. You should read up on that on wikipedia first, so that you actually understand what you do.

Actually it is an assumption because you don't know what I've been through already and you're right I was confused because I've already done the research then asked questions and received bad answers from people here at "hiveworkshop" as I pointed this out. You should read up on wikipedia about adhd because not everyone can learn like you.

Edit: I never said ADHS
 
Last edited:
Int_Pyrs_Active <--- My question was this the array as people said nothing is actually stored there when in fact I know something is because it works in game but people insist on telling me otherwise.
I'm pretty sure you just misunderstood what they told you. Most people lurking in the Trigger help section and posting answers know what they are doing.

I'm not sure how to get the "ID" of a player
I think in GUI it's called "Player Index".

Actually it is an assumption because you don't know what I've been through already and you're right I was confused because I've already done the research then asked questions and received bad answers from people here at "hiveworkshop" as I pointed this out. You should read up on wikipedia about adhd because not everyone can learn like you.
I know what ADHS is, but I don't see how it will change anything. And also I don't see why people should give you different answers to logical problems just because you have ADHS?
An apple is still an apple, no matter if you have ADHS or not.
 
Level 12
Joined
Mar 17, 2007
Messages
412
you will understand how it works soon if you keep learning and practicing..

oh, by the way you are not allowed to delete the main problem in the first post.. just attach "solved" underneath the problem description, so it will not causes confusion when people googled this problem..

It wasn't really a problem it was more of a question about how to get going in the right direction but thanks for the clarification.


Zwiebelchen users like you make me avoid the forums with your smartass remarks yet you get away with it from by being partially helpful

"Player Index" <--- I see, could of just said that instead of having me guess abbreviations

"ADHS" <--- Not what I said

An apple is still an apple <--- You literally haven't got the slightest clue -.-'

Good riddance
 
Zwiebelchen users like you make me avoid the forums with your smartass remarks yet you get away with it from by being partially helpful
Seriously? You called out the people helping you in the other thread just because you didn't understand what they said. I guess that's much more of a bad attitude than some smart-ass remarks (wherever you could find them in my post).

"Player Index" <--- I see, could of just said that instead of having me guess abbreviations
ID is a common abbreviation for index or identity. It's used almost everywhere in life. And sorry for not giving you the correct takezandgoez-compatible term in the first place. -.-

"ADHS" <--- Not what I said
ADHS and ADHD are two names for the same thing.

An apple is still an apple <--- You literally haven't got the slightest clue -.-'
Dude, I do not know you. That's why I treat you in the same way as anyone else. You're think you're something special? Well, think again.
 

Kazeon

Hosted Project: EC
Level 33
Joined
Oct 12, 2011
Messages
3,449
a bad attitude than some smart-ass remarks (wherever you could find them in my post).
Easy... you are a nice guy remember? :xxd:
I'll try nonetheless, since I'm a nice guy.

@thread starter:
Zwiebelchen users like you make me avoid the forums with your smartass remarks yet you get away with it from by being partially helpful
is not a nice thing to say..
Dude, I do not know you. That's why I treat you in the same way as anyone else. You're think you're something special? Well, think again.
he is right..

Zwie is trying to help you, you should appreciate him anyhow. do you know that he needs much efforts just to read somebody else "not-really neat coded" script, learning how it works, then looking for the bad side/mistakes, and then giving some clariffications or the solutions for you? yes, it is so hard.. you can try it by your self if you want. so just dont be upset of getting critism and suggestion.. be grateful.. :) best luck for you..

I'm sorry if I misunderstood since you have deleted your problem above. I just, see you have problem with Zwie's post, but the main thing I want to say is that you must understand, people in thw is always trying to help..

His name is Zwiebelchen ! ! ! Why people can't read it :pshock:

So, if short form then: "Zwie" , not "Zwei"! :thumbs_up:

EDITED :p
 
Status
Not open for further replies.
Top