HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A few WE/JASS Q's

04-19-2004, 01:10 AM#1
PEON1577
I think the answer to some of these questions maybe in jass but if not then just move me ^_^

1. How do I disable game messages
2. Disable units from being clicked
3. Bounty not given
4. How do i create global vars via jass
5. Class systems in jass, ??

1 - ie the message that comes up when you need more food to create units, its says build more moon wells to continue unit production, well i changed it to an empty string and it still shows up.. help.

2 - theres a map, scary forest 2, and in it there are these custom models that go back and forth and if you get near them you die but you cant click on them, nothing happens, its like trying to click on water. how do i create the same effect on a unit in my map?

3 - when the killing unit is null (happens when a unit is killed by a missle from a dead unit) the bounty isent given to the killing unit, any way i can fix this?

4 - I have a collection of triggers that use a bunch of global vars and I wanted to know if I could just include a jass trig that would create the global vars they need instead of typing the global vars into every map i want to use the triggers in.

5 - AIAndy recommended implimenting a class system to someone who wanted to know how to store information for diff cards in a deck for a map that person was making, can someone point me in the right direction about class systems in terms of learning what they are/how to make one? thanks

For Your Help
I Give Thanks!
^_^
04-19-2004, 04:58 AM#2
PEON1577
What do I have to do for answers..? :(

*gives everyone a cookie*
04-19-2004, 06:23 AM#3
AIAndy
You have to just wait for the answers. We are not always online.

2. Unclickable units usually have the ability Aloc (locust).

5. I made a class system using gamecache (http://kattana.users.whitehat.dk/viewfunc.php?id=244 )
04-19-2004, 08:03 AM#4
PEON1577
Quote:
Originally Posted by AIAndy
You have to just wait for the answers. We are not always online.

2. Unclickable units usually have the ability Aloc (locust).

5. I made a class system using gamecache (http://kattana.users.whitehat.dk/viewfunc.php?id=244 )
Thank You AIAndy!!!

Now, Someonetellmehowtodo
1.
3.
4
PleaseThankYou!!!
04-19-2004, 10:25 AM#5
Cubasis
1: Impossible
2: Impossible
3: Impossible

Nah, atleast on officially, the thing is, alot of people think JASS has more power over the game...but in reality, JASS has almost just the same functions as GUI does, plus a few that are not available in GUI, but are less trivial/useful. And often used inside other function (f.ex., Fade Filter automatically uses a not-in-GUI function named EnableUserUI...which toggles tooltips and Health-bars)... but that's really it, the true power of jass is that it's text-based, and it's algorithm-possibilities, and it's function-orientation.

Anyways, that's just officially, but you can do many things to emulate it...but that's more work. I can't really give many suggestions at the moment, (3) but one might be to disable Bounty of all units in the Object editor, and implement your own bounty system... then it's easy to disable bounty in-game.

Cubasis
04-19-2004, 04:45 PM#6
PEON1577
Quote:
Originally Posted by Cubasis40
1: Impossible
2: Impossible
3: Impossible

Nah, atleast on officially, the thing is, alot of people think JASS has more power over the game...but in reality, JASS has almost just the same functions as GUI does, plus a few that are not available in GUI, but are less trivial/useful. And often used inside other function (f.ex., Fade Filter automatically uses a not-in-GUI function named EnableUserUI...which toggles tooltips and Health-bars)... but that's really it, the true power of jass is that it's text-based, and it's algorithm-possibilities, and it's function-orientation.

Anyways, that's just officially, but you can do many things to emulate it...but that's more work. I can't really give many suggestions at the moment, (3) but one might be to disable Bounty of all units in the Object editor, and implement your own bounty system... then it's easy to disable bounty in-game.

Cubasis

<insert bad names here>
1: Impossible
2: Impossible
3: Impossible

1 is possible, people have done it, its messing w/ the custom gui opt in the world ediotor, it just wont accept a blank string though

2 aiandy told me how to do, see previous post in this thread

3. alredy tryed my own bounty system, the problem lies in the core of wc3 with its get killing unit function, sometimes it just cant tell
04-19-2004, 04:49 PM#7
PEON1577
Quote:
Originally Posted by Narwanza
Its simple. You are going to have to define those rects somewhere, so why not just do this. Now a region is something totally different than a rect. What you are going to have to do is run a function similar to this at map init. Create a global region variable named death

Code:
function RunMeAtInit takes nothing returns nothing
    call RegionAddRect(udg_death,gg_rct_Region_000)
    call RegionAddRect(udg_death,gg_rct_Region_001)
    call RegionAddRect(udg_death,gg_rct_Region_002)
    call RegionAddRect(udg_death,gg_rct_Region_003)
    call RegionAddRect(udg_death,gg_rct_Region_004)
endfunction

You will have to keep doing that until all of your game generated rects (rects you physically place on the map) are put into the region death. Now here is the simple trigger to handle all of those regions.

Code:
function UnitFilter takes nothing returns boolean
    if (GetOwningPlayer(GetFilterUnit()) != Player(9)) then
        return true
    endif
    return false
endfunction

function ActionFunc takes nothing returns nothing
    call KillUnit(GetEnteringUnit())
endfunction

//======================================================
function InitTrig_Kill takes nothing returns nothing
    set gg_trg_Kill = CreateTrigger()
    call TriggerRegisterEnterRegion(gg_trg_Kill,udg_death,Filter(function UnitFilter))
    call TriggerAddAction(gg_trg_Kill,function ActionFunc)
endfunction


what does that code do? can someone add comments to it pls.


so far i have:
creats trigger Kill
adds event Unit Enters Region udg_death
what does Filter(function UnitFilter) do?!
then it adds the action ActionFunc

What I bet the trig does is when a unit enters a region in any of the listed regions in UnitFilter it kills the unit if the owner is not player 10 but HOW !!!!!!!!!!! helppppppp meeeeeeee plzz

I dont understand the Filter(function UnitFilter) bit and I dont understand how it can go througha ll the regions, what is it doing?! commented code pls... :(


-- question #7 ---

Quote:
Originally Posted by AIAndy
Order the unit to cast the spell and check the return value of the order native. It should return false if there is still a cooldown on that ability. Immediately cancel that order afterwards (restore the original order).
how do i check the return value of the order native?!? pls tell meeeee

--- question #9 ----
Quote:
Originally Posted by Cacodemon
Just use Unit-to-Integer Conversion - every unit handle is unique so you can use that.
What is the return bug exploite? And how would you do the above (the Unit2Int conversion)?
Thank you for helping ^_^

update: only the questions answered by aiandy have been answered.. no one else wants to help me?? :( :(
04-19-2004, 07:03 PM#8
Cubasis
Eh, firstly, I ment questions 1, 3, 4... 2 is possible as AIAndy said.

And your question is how do you "Disable" a game message, ... and you then said that it didn't work to set nothing into the field...so thus, as there is no other way to change a UI text. Then there is no "official" way of doing it, but as I said ,there are often tricks. F.ex. how about setting it either to " " (a space bar), or ...erhm, alphaed text, though that rarely works |cffffffff|bla|r. That's all I can think off.

With your bounty system, if everything else fails, you could ... if there are not too many units around - Create a trigger in-game for each unit that should affect the bounty, attach to it the event "UnitIsDamaged" with the unit in question. Then have them all tie to the same function, where you check if the damage being done is more than the current HP of the unit, then you give money (you can also wait 0.01 second for him to kill if you want to be asynchronous).

But...considering that you don't really know jass that well, considering how you ask how to do everything we suggest you to do.... so this solution may be a bit tough for you, as it requires pretty smart setup, including KaTTaNa's SetHandleHandle function, and stuff..

And you must know that we residents in this forum don't have endless times on our hands. And we don't only have to help you find a solution, but also to explain it in-depth, including how every part of the code works... However, since i'm fairly bored right now, i'll take you through some of them.

The filter is just what it says...a filter. It works the exactly same like Conditions on triggers, that is, it includes a function that uses "GetFilterUnit()" and returns a boolean. This boolean specifies wether if a unit enters a region, should the trigger be run. So if a unit of player 1's enters the region, then this filter gets run, it compares the owner of the entering unit with Player 10 (Player(9) is the same as Player 10). If the unit's owner is not equal to Player 10, it returns true, else, it returns false.

So, now, if it returned true...it continues and runs the trigger. (which is the "ActionFunc")

7). Perhaps it's good to first find the natives. The natives are in a file called common.j in your war3.mpq. You can reach it by using a mpq program like WinMPQ. Inside them are ALL the function that the game gives us listed. Those are not the function that GUI uses. GUI uses another set of function that themselves "use" these function.

The order natives have names like IssueOrderTargetingUnit or sumtin, look for them yourself. So, the best way to check the return value of a function is to do the following:

set b = <FunctionName>(<Parameters>)

Where you have to have defined b as a boolean at the top of your function (can be any name). Notice that it works almost the same way as you call a function, the only difference is that instead of writing call, you write: "set <var-name> = ".

Then you can use "b" in a if statement to do what you want. like the following:

if(b == true) then
call KillUnit(MyUnit)
endif


9)
This is the function you need:

function Unit2Int takes unit WhichUnit returns integer
return WhichUnit
return 0
endfunction

This is WAY to deep a subject for me to want to explain it in depth one more time, I have explained this thing thoroughly likely a dozen times to dozens of people. So either just use it, or you can find threads about this thing if you search this forum.

Cubasis
04-20-2004, 06:42 PM#9
PEON1577
Quote:
Originally Posted by Cubasis40
Eh, firstly, I ment questions 1, 3, 4... 2 is possible as AIAndy said.

And your question is how do you "Disable" a game message, ... and you then said that it didn't work to set nothing into the field...so thus, as there is no other way to change a UI text. Then there is no "official" way of doing it, but as I said ,there are often tricks. F.ex. how about setting it either to " " (a space bar), or ...erhm, alphaed text, though that rarely works |cffffffff|bla|r. That's all I can think off.
---ok, will try that

With your bounty system, if everything else fails, you could ... if there are not too many units around - Create a trigger in-game for each unit that should affect the bounty, attach to it the event "UnitIsDamaged" with the unit in question. Then have them all tie to the same function, where you check if the damage being done is more than the current HP of the unit, then you give money (you can also wait 0.01 second for him to kill if you want to be asynchronous).
--the problem isent detecting unit death its detecting who did the damage, when a unit takes damage from a dead unit the we cant tell who the dead unit is, thats the problem i run into

But...considering that you don't really know jass that well, considering how you ask how to do everything we suggest you to do.... so this solution may be a bit tough for you, as it requires pretty smart setup, including KaTTaNa's SetHandleHandle function, and stuff..
--mods shouldent try and start flamewars ^_^, i'm asking for help why dont you try just giving help?

And you must know that we residents in this forum don't have endless times on our hands. And we don't only have to help you find a solution, but also to explain it in-depth, including how every part of the code works... However, since i'm fairly bored right now, i'll take you through some of them.
--i'm asking for help, meaning if someone wants to help me they will post, people who post and say stupid ot stuff are just flamerz.

The filter is just what it says...a filter. It works the exactly same like Conditions on triggers, that is, it includes a function that uses "GetFilterUnit()" and returns a boolean. This boolean specifies wether if a unit enters a region, should the trigger be run. So if a unit of player 1's enters the region, then this filter gets run, it compares the owner of the entering unit with Player 10 (Player(9) is the same as Player 10). If the unit's owner is not equal to Player 10, it returns true, else, it returns false.
--... someone define filter for me please, when i think of a filter its that trigger thats used to display .bpls or maybe its .blp, the image format. is a filter like a coffie filter? it filters out stuff

So, now, if it returned true...it continues and runs the trigger. (which is the "ActionFunc")
--ok...

7). Perhaps it's good to first find the natives. The natives are in a file called common.j in your war3.mpq. You can reach it by using a mpq program like WinMPQ. Inside them are ALL the function that the game gives us listed. Those are not the function that GUI uses. GUI uses another set of function that themselves "use" these function.
--ok... dident know they were called natives

The order natives have names like IssueOrderTargetingUnit or sumtin, look for them yourself. So, the best way to check the return value of a function is to do the following:

set b = <FunctionName>(<Parameters>)
--ok... i know how to do this, just dident hear the term native used before.

Where you have to have defined b as a boolean at the top of your function (can be any name). Notice that it works almost the same way as you call a function, the only difference is that instead of writing call, you write: "set <var-name> = ".
--you must think im a newb...

Then you can use "b" in a if statement to do what you want. like the following:

if(b == true) then
call KillUnit(MyUnit)
endif

--i wasent kidding when i said i knew jass... really i wasent ^_^
9)
This is the function you need:

function Unit2Int takes unit WhichUnit returns integer
return WhichUnit
return 0
endfunction
-- all that does is it returns the unit as an integer and for some reason if it cant it just returns zero, right?

This is WAY to deep a subject for me to want to explain it in depth one more time, I have explained this thing thoroughly likely a dozen times to dozens of people. So either just use it, or you can find threads about this thing if you search this forum.
--ok i'll search around

--thank you allmighty Cubasis :D

Cubasis
-message in quote-

"function RunMeAtInit takes nothing returns nothing
call RegionAddRect(udg_death,gg_rct_Region_000)
call RegionAddRect(udg_death,gg_rct_Region_001)
call RegionAddRect(udg_death,gg_rct_Region_002)
call RegionAddRect(udg_death,gg_rct_Region_003)
call RegionAddRect(udg_death,gg_rct_Region_004)
endfunction"

does that just make a big region by adding all the rects to it?
04-20-2004, 09:16 PM#10
AIAndy
That is what it does. But note as someone already said, what the WE labels as region variables are not really regions but rects.
04-20-2004, 09:29 PM#11
PEON1577
Quote:
Originally Posted by AIAndy
That is what it does. But note as someone already said, what the WE labels as region variables are not really regions but rects.
ok the gg_rct gives it away :)

the diff between a region and a rect (in terms of wc3) is...?
04-20-2004, 10:29 PM#12
Narwanza
Shape. Rects are square, and regions have no set shape. Also, regions don't have to be connected rects.
04-20-2004, 11:12 PM#13
COOLer
If you need help with the a Class system send it my way im always ready for some coding and yes Class cache system is my brain child that Ai Andy and Weaaddar have trully made into a pice of coding art . :D
04-21-2004, 02:03 AM#14
PEON1577
Quote:
Originally Posted by COOLer
If you need help with the a Class system send it my way im always ready for some coding and yes Class cache system is my brain child that Ai Andy and Weaaddar have trully made into a pice of coding art . :D
Ok, if you want to help me :D, could you explain how the class system would be used in the card example?
we have a bunch of cards and each card has unique properties and different cards belong to different groups.

fire group
- fire card 1
- fire card 2

water group
- water card 1
- water card 2

etc etc.

^_^ *remember you asked to help
04-21-2004, 07:07 PM#15
COOLer
Basicly a Class is group of Hiden varables and methods That are linked to a single name . exaple of this in jass The Unit object ,Player object, ect. however blizzard did not alow us to create objects we have found a back door using game cache

a card objcet could hold
Current location of card
Its Type
Attack power / defence
and methods for using the objects in code
You can even Create Card object that can copy it self or set a card objcet to point to anthor card object instead of its self.
if you give an exaple of what You want these cards can do i can work on class for you this weekend.