HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

You guys are gonna hate me....

09-10-2004, 11:54 AM#1
HQCosTheta
Okay, here is my problem:

I went to the JASS section to find a peice of code that would do what I could not do with triggers (making items stackable)...i found exactly what i was looking for here http://www.wc3sear.ch/index.php?p=JASS&ID=164&sid=. My new "problem" is that I cannot put the code in my map. I know NOTHING of JASS and would love "The Idiots guid to JASS Copying/Pasting in WE". Please tell me where I can find the info on this or just give me the 411 on how it's done fast and simple :) . The tutorial isn't telling me what I need and i'm totally nicking out.

thanks
09-10-2004, 12:54 PM#2
KaTTaNa
Copy the jass code into the map header (You open it my clicking on the map name in the left side of the trigger editor).
Then make a trigger with the event:
Code:
Unit - A unit acquires an item.
Then add the action:
Code:
Custom script: call StackItem(GetManipulatingUnit(), GetManipulatedItem())
That should do it.
09-12-2004, 01:08 PM#3
HQCosTheta
Dude! You rock....Thanks.

Can you tell me what the trigger did and how it talks with the scripting? I am limmited when it comes to programming or scripting experiance, being the last time I programmed it was 7 years ago in grade 12 on stupid little black and white macks with a few KBs of RAM...those things blow....but anyways....

How do I make enemy player's units drop bounties? As it is I can only get nuetral hostile units to drop a bounty on death....I find it...not easy.
09-12-2004, 01:46 PM#4
HQCosTheta
Hi, again,

I think I'm starting to get it but I'm not really sure...so...how do you make these ones work?
http://www.wc3sear.ch/index.php?p=JASS&ID=122&sid=
http://www.wc3sear.ch/index.php?p=JASS&ID=147&sid=

You should totally write a tutorial for me and my fellow dumbasses. One that's better than the one that's allready up...or at least easier to understand. that's really all I need to know for now...

Thanks :)
09-12-2004, 02:03 PM#5
linkmaster23
Why don't you go LEARN jass and stop trying to cpoy other peoples code. Aye?
09-12-2004, 02:23 PM#6
blizzball
Quote:
Originally Posted by linkmaster23
Why don't you go LEARN jass and stop trying to cpoy other peoples code. Aye?
but if they are up to dl i don't see a problem with that :S
09-12-2004, 02:56 PM#7
linkmaster23
Well, when retards like Hocostheta ask a million questions about a code he doesn't understand, gets friggin annoying. How would you like it if someone was watching you play some video game trying to understand it and he kept PESTERING you to no end? Exactly.

Alls I'm saying is LEARN Jass, I've never had hardly any questions to ask because I made my own code.
09-12-2004, 03:22 PM#8
blizzball
well thats something you had to deal with and woulden't it e rude not to tell your friend how to play the game :S hehe but i understand you master ;)
09-12-2004, 03:32 PM#9
35263526
Linkmaster, he asked two questions, that's hardly 'PESTERING you to no end'. You're a moderator, you should know better than to be flaming people.
09-12-2004, 08:08 PM#10
Cubasis
LinkMaster ... the JASS VAULT is a site created by members of this community to contribute common, reliable and useful code pieces for others to use. You can know that most of the people in f.ex. #jassvault use functions from that site all the time... including me, Weaaddar, AIAndy (atleast his own functions :D), Lord Vexorian etc. That place is MADE FOR COPYING!

And I didn't see you actually getting bothered by answering his questions. In reality, I really like his humble'ness in asking about stuff.

Quote:
Alls I'm saying is LEARN Jass, I've never had hardly any questions to ask because I made my own code.

*COUGH! COUGH! (chokes to death)* Are you friggin kidding me? I was the one you pestered for teaching you some jass, and you indeed did ask me alot of annoying questions. Like how Arrays work, remember? and Local variables?

So, yeah, Learn some respect for those who don't know as much as you do. Atleast if you're a moderator.


Anyways, here is a QuickTutor. This is not the optimal way of using these functions, as they require more actions and more variables. But it's easy to learn/use for those who don't know JASS well.

Ok, 1st thing to know, is that. If you want to use a Variable in a JASS statement, you have to add a "udg_" prefex when using it. So if you want to use your MyInt variable, you write: udg_MyInt

Then, with this knowledge in mind. You can do this for most functions you want to use:

Have some variables available for each parameter-type the function takes (in this example i'll call them TempInt, TempPlayer, TempReal1, TempReal2, TempUnit1, TempUnit2)

Then when you want to call one of those functions (and btw, you are at this point supposed to have already copied the functions to your trigger-header in their interity), you set all the Temp variables to what you want to pass, then use a JASS statement to call the functions with all your Temp Vars.

Here are examples. We're gonna call Bounty for triggering killer, give him 50 gold at the location of the killed unit).

Set TempPlayer to (Triggering Player)
Set TempInt to 50
Set TempReal1 to (X of (Location of (Killed Unit))
Set TempReal2 to (Y of (Location of (Killed Unit))
Custom Script: call Bounty(udg_TempPlayer, udg_TempInt, udg_TempReal1, udg_TempReal2)


Anyways, since I got to jet now, I can't finish the MiniTutorial. So if you're still confused, don't hesitate to ask, and i (or someone else) will finish explaining later.

~Cubasis
09-13-2004, 03:48 AM#11
HQCosTheta
linkmaster23,

1) How can I learn JASS if no one will explain it to me? Please don't berate me for asking questions on a site that was created to share information...it sickens me. 2) If you think this thread was directed at you then either you cannot read or have a very large head because the post was directed to anyone who could help me....you are not helping me so why in god's name are you posting? I am sorry that you feel that I am bugging you even if I cannot see a basis for your accusations. 3) I see that there are no uploaded skins, models or icons attached to your account where I have actually contributed to the WC3 community...from what I can see on this thread is that you are not really contributing to the betterment of it and therefore have a verry short leg to stand on if you have one at all.

Please let intellegent and helpfull people post on this thread in the future and I would also ask that you please not start a pointless bickering session on a thread that was my attempt to begin learning JASS in the first place...and since you know so much about it why don't you write up a little tutorial for people as stupid as I am so that we may all benefit from your superior knowledge.

I am attempting to contribute here-

-thanks.

PS Who gave this guy Mod status?
09-13-2004, 05:14 AM#12
HQCosTheta
Cubasis,

Thanks a bunch man, and thanks to you guys for defending me against linkmaster23 aka "the Tyrant" I have to be brief cause I gotta go to work in like ten minutes. But as linkmaster23 has stated I am a "Retard" and I think I get what you are trying to tell me.

You define a function in the header and then you call it with an apropriate trigger, right? So if I wanted to Use the bounty snippet I would have to call it everytime a unit was killed? Another thing....does that snippet actually make the killing player recieve the amount of money as specified in the unit settings pertaining to the dying unit? I can't read script yet...I just started a few days ago.... :) All I really need is the Bounty to work now then I can get started on triggering my webmap. Hope you guys are still playing by the time I get it done, LOL.

Thanks again guys.
09-13-2004, 01:05 PM#13
Cubasis
Quote:
PS Who gave this guy Mod status?
*reaches up a hand*

But yeah. Sadly, there is no way to get the bounty unit property, so you'd have to set up your own system to control the gold dropped by units. That's what my TempInt variable specified.

So yes. You match up Temp variables with all the parameters that the function takes (see the function header). Then you fill those variables with the data you want. Then you call the function with these variables as parameters.

So calling that other trigger would be something like this:

Set TempUnit1 = (Summoned Creature)
Set TempUnit2 = Hero[1]
Custom Script: call UnitGuardUnitAI(udg_TempUnit1, udg_TempUnit2)

~Cubasis
09-13-2004, 03:38 PM#14
HQCosTheta
Quote:
Originally Posted by Cubasis
*reaches up a hand*
Oh, my bad. :)

Okay, so, bear with me here, there is absolutally no way to simply alter one little thing to make the bounty a global phenomenon and the only way to do it is to use the system you postulate?

I am sad... :(

Okydokey, I just got home from a night shift (wanted to stop in and see if buddy had any more "usefull" information) and I have to go to bed so I can wake up for my 2nd job tonight....but when I get back I'm gonna look long and hard at your posts and "if" i somehow magically grasp the concept I may need you to expound on said posts.

Thanks again :)
09-13-2004, 06:37 PM#15
Cubasis
Hehe, yeah, my last post was also written in a hurry as I was getting too late for my next class. So I couldn't explain in more detail how to match parameters and stuff.

Anyways, now i'm at home and have more time at my hands.

Let's try this function (http://www.wc3sear.ch/index.php?p=JASS&ID=100&sid=) for fun and see how we use it in GUI using this method.

The first thing we check up on (after copying the function to the header ofcourse) is the function header. In this example, it is:

function AddSpecialEffectTargetUnitWithTimer takes string whichAttach, unit whichUnit, string whichEffect, real duration returns nothing

Ok. The colored stuff is the important stuff. First comes the name of the function. You use this (and notice that JASS is case sensitive) when calling upon the function. Then come a list of parameters. WhichAttack as a string, WhichUnit as a unit, WhichEffect as a string, Duration as a real. And lastly "nothing" indicates that it doesnt' return anything. I'll examine this later.

We have to provide the function with all these parameters when we call upon it. And we do that (at this point) by putting data into our TEMP variables. So for this function, we'd need 2 string variables, a unit variable and a real variable.

About learning what each parameter does varies. Normally you can just look upon the name of the parameter and understand what it does, or reading the Comments area of the site where you got the function. However, it may still be pretty hard to understand there, but that's rare and can be solved by experimenting or asking here.

But for this function, the first parameter (string) indicates which bone to attach the effect on (like "head" or "origin" or something). The second parameter (unit) indicates what unit to attach the effect on. The third parameter (string) is the address of the SFX model to use (IMPORTANT: In Jass, addresses have double-slashes (like "Units\\Abomination.mdx")). The fourth parameter (real) is the duration of which the effect should exist for before it gets destroyed.

So with this knowledge. We can do the following in the trigger editor:

Set TempString1 = overhead
Set TempUnit = (Attacked unit)
Set TempString2 = Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdx
Set TempReal = 1.50
Custom script: call AddSpecialEffectUnitWithTimer( udg_TempString1, udg_TempUnit, udg_TempString2, udg_TempReal )

So then we're calling that function, creating the BlinkTarget effect overhead the Attacked Unit over 1.5 second.

Notice that. When we're passing actual literals (values/strings that you actually write into the code, like "1.50" and "overhead" up there) to functions, there is no need putting them to variables and then passing the variables, you can just as easily do this:

Set TempUnit = (Attacked unit)
Custom script: call AddSpecialEffectUnitWithTimer( "overhead", udg_TempUnit, "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdx", 1.5 )

Makes sense?

Ok, lastly, if a function returns a value, it's best to create a variable to catch that return. Let's just imagine that AddSpecialEffectUnitWithTimer returns a integer (which it ofcourse doesn't). Then we'd just get ourself a TempInteger variable, and make our Custom Script line like this:

Custom Script: set udg_TempInteger = AddSpecialEffectUnitWithTimer( "overhead", udg_TempUnit, "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdx", 1.5 )

Then after this line, TempInteger would store the returned value of AddSpecialEffectUnitWithTimer.


Appendix A:

About the data-types in JASS, they mostly match up with the Data Types in the variable editor. But some of them have a different name. Here i'll list the most common variables in JASS/VariableEditor:

Variable Editor - JASS

Region - rect
Unit - unit
Unit Group - group
Integer - integer
Real - real
String - string
Player Group - force
UnitType/AbilityType/<whatever>Type - integer // In jass you'd just: set udg_MyHeroType = 'U001'


Ok, i'm gonna leave it at that. Hope this explains better.

~Cubasis