wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > JASS/AI scripts tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 10-03-2007, 12:28 PM   #16
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Thanks, Toink :)

Crap, this is starting to be difficult for me to understand. I have to understand what exactly is the problem before putting it in the tutorial. I'm not home right now, but as soon as I get home, I'll spend some time on understanding it and then I'll put it in the tut.

Quote:
I saw your edit, but I was clarifying. The way you said it seemed to imply that there was some sort of counter variable increasing until it got to the maximum, though that is not exactly the case.

No, I meant exactly what you said :)

Quote:
Ah, I didn't see that you had changed it to all run off of a single timer. In that case, no you do not need CSCache.

There was a hidden question in my post: what should I do then? Tell them that before the single timer usage they need CSCache, but actually in the end they don't? Or to tell them to imagine they have handle vars implemented and in the end they get rid of attaching? I got a bit stuck, so I need some advice.....

EDIT: OMG, I just realized I'm not destroying the structs at all! Why did nobody tell me that?? :)
__________________
Cascading Style Shit

Last edited by Silvenon : 10-03-2007 at 12:38 PM.
Silvenon is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 10-04-2007, 05:37 AM   #17
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

No, no, no. That is the worst way possible to do it. Instead of moving each new one down one, simply move the last used index into the open one.
So when #7 finishes, copy all the data from #10 into slot #7 and then destroy #10 and decrease the counter by 1.


Just tell them that you'll be making them all run off the same timer and write the code like that from the beginning.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-04-2007, 02:35 PM   #18
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Quote:
Instead of moving each new one down one, simply move the last used index into the open one.

Isn't that what I'm doing? When a struct is destroyed, I move the last one to it's place, isn't that what I was supposed to do?

And Toink, I'm not leaving an empty space, I'm moving the last one to that empty place. At least I think I do.

Quote:
Just tell them that you'll be making them all run off the same timer and write the code like that from the beginning.

Isn't a single timer just an improvement to the existing code? I have to make a big modification to my tutorial then, but that's fine with me, I just have little time (believe me, I do).

Anyways, what things do I need to do more to get the tutorial approved? I'm just asking, not in the "approve my tut already!" way :). Do I have to add all the "extensions" before approval? Because I can, I just need some time.

Btw,

Quote:
So when #7 finishes, copy all the data from #10 into slot #7 and then destroy #10 and decrease the counter by 1.

don't you mean "destroy #7"? Because #10 would be an unfinished one. Or maybe you mean "destroy the original #10"?
__________________
Cascading Style Shit

Last edited by Silvenon : 10-04-2007 at 02:38 PM.
Silvenon is offline   Reply With Quote
Old 10-05-2007, 12:45 AM   #19
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

No if you were doing it by copying everything over, you would copy all the data from Ar[7] to Ar[10] instead of destroying Ar[7] outright. Then, you destroy Ar[10] because all it is a duplicate of Ar[7].

However, you did it the other way which is to just shuffle the array indexes around. Your method works fine.

Last, you forgot an "endloop" in the function Knockback_Execute, and you should change the line exitwhen i == Total to exitwhen i >= Total.
I don't know what this needs in order to be approved, we need PitzerMike for that.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

Last edited by Pyrogasm : 10-05-2007 at 12:47 AM.
Pyrogasm is offline   Reply With Quote
Old 10-05-2007, 01:53 PM   #20
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

*Fixed.

Quote:
Your method works fine.

That's what I wanted to hear.

Quote:
I don't know what this needs in order to be approved, we need PitzerMike for that.

Yeah, I know. I probably have to polish it a bit and edit it so it uses your way: using a single timer at the beginning.

Also, I probably have to add all the extensions. I'm gonna fix everything soon....

EDIT1: *A BIG fix*

The single timer usage is implemented already in the beginning, I checked everything for errors and I fixed the ones that I found. There shouldn't be any more errors.

Btw, I did something wrong with the struct destruction part, I destroyed them 0.04 seconds after they finished and I should've destroyed them right away. Please take a look at the final code and check if everything is ok (I'm referring to anyone who's reading this).

Thanks for all the help, again.

Pitzy, is this enough for you? How much more blood do you need to spill to get this tut approved?? :P

EDIT2: *A huge extension* (well, not so huge, but it sure was big to me)

I was thinking of adding the lightning effects, but nah, I figured out that it's enough already.

Shouldn't contain any errors, but those are sneaky little bastards, so if you see one...

Pitzy, I'm changing my statement:

Quote:
I'm just asking, not in the "approve my tut already!" way :)

into:

Quote:
I'm just asking, exactly in the "approve my tut already!" way :)

__________________
Cascading Style Shit

Last edited by Silvenon : 10-07-2007 at 11:56 AM.
Silvenon is offline   Reply With Quote
Old 10-09-2007, 11:34 PM   #21
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,794

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

Oh this doesn't need anything more for approval.
I've just been busy and it takes time to read through it.
Here we go, to the tutorials db.

EDIT: well done, btw
__________________
Zoom (requires log in)

Last edited by PitzerMike : 10-09-2007 at 11:35 PM.
PitzerMike is offline   Reply With Quote
Old 10-10-2007, 08:47 AM   #22
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Thanks and sorry if I was too impatient
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 10-10-2007, 06:20 PM   #23
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

The main problem with the "efficiency" of this knockback is the pathability check function. Constantly creating handles is a good way to induce lag.

Last edited by grim001 : 10-10-2007 at 06:24 PM.
grim001 is offline   Reply With Quote
Old 10-10-2007, 08:05 PM   #24
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Explain + give an example.
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 10-10-2007, 08:18 PM   #25
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

Handle allocation is about the slowest thing in wc3 other than SetUnitPosition, and it eats memory as well. Also, using an item does not prevent moving through other units, only buildings.

The solution is a ground unit stored in a global which is used for all pathability checks.
grim001 is offline   Reply With Quote
Old 10-10-2007, 08:19 PM   #26
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Use globals and move a single item around rather than creating new ones. So instead of having this:
Collapse JASS:
function CheckPathabilityTrickGet takes nothing returns nothing
    set bj_rescueChangeColorUnit = bj_rescueChangeColorUnit or (GetEnumItem()!=bj_itemRandomCurrentPick)
endfunction

function CheckPathabilityTrick takes item p, real x, real y returns boolean
    local integer i=30
    local rect r
    call SetItemPosition(p,x,y)
    if ((Pow(GetItemX(p)-x,2)+Pow(GetItemY(p)-y,2))<=100) then
        return true
    endif
    set r=Rect(x-i,y-i,x+i,y+i)
    set bj_itemRandomCurrentPick=p
    set bj_rescueChangeColorUnit=false
    call EnumItemsInRect(r,null,function CheckPathabilityTrickGet)
    call RemoveRect(r)
    set r=null
    return bj_rescueChangeColorUnit
endfunction

function CheckPathability takes real x, real y returns boolean
    local item it = CreateItem('ciri',x,y)
    local boolean b = CheckPathabilityTrick(it,x,y)
    call SetItemVisible(it,false)
    call RemoveItem(it)
    set it=null
    return b
endfunction

You'd have this:
Collapse JASS:
globals
    private item PathItem = CreateItem('ciri',0.00,0.00)
endglobals

function CheckPathabilityTrickGet takes nothing returns nothing
    set bj_rescueChangeColorUnit = bj_rescueChangeColorUnit or (GetEnumItem()!=PathItem)
endfunction

function CheckPathabilityTrick takes real x, real y returns boolean
    local integer i=30
    local rect r
    call SetItemPosition(PathItem,x,y)
    if ((Pow(GetItemX(PathItem)-x,2)+Pow(GetItemY(PathItem)-y,2))<=100) then
        return true
    endif
    set r=Rect(x-i,y-i,x+i,y+i)
    set bj_rescueChangeColorUnit=false
    call EnumItemsInRect(r,null,function CheckPathabilityTrickGet)
    call RemoveRect(r)
    set r=null
    return bj_rescueChangeColorUnit
endfunction

function CheckPathability takes real x, real y returns boolean
     local boolean b = CheckPathabilityTrick(,x,y)
    call SetItemVisible(PathItem,false)
    return b
endfunction

The other thing to consider is changing this:
Collapse JASS:
if ((Pow(GetItemX(PathItem)-x,2)+Pow(GetItemY(PathItem)-y,2))<=100) then
    return true
endif
To this in order to remove the two Pow function calls.
Collapse JASS:
local real IX = GetItemX(PathItem)
local real IY = GetItemY(PathItem)
if (((IX-x)*(IX-X)+(IY-y)*(IY-Y))<=100) then
    return true
endif
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-11-2007, 07:10 AM   #27
TEC_Ghost
User
 
TEC_Ghost's Avatar
 
Join Date: Jul 2002
Posts: 416

TEC_Ghost will become famous soon enough (65)TEC_Ghost will become famous soon enough (65)TEC_Ghost will become famous soon enough (65)

Default

There were a few areas I found were messed up when I did this tut.

Collapse JASS:
    set kd.d1 = 2 * d / (q + 1)
    set kd.d2 = d1 / q

I fixed with

Collapse JASS:
    set kd.d1 = 2 * d / (q + 1)
    set kd.d2 = kd.d1 / q

And

Collapse JASS:
call DestroyEffect(AddSpecialEffect(s, x, y))

with

Collapse JASS:
call DestroyEffect(AddSpecialEffect(kd.s, x, y))

Also, there's a code error that stops the function from happening (Took me like an hour to find out why lol)
Collapse JASS:
local integer q = w / Interval()

should be

Collapse JASS:
local integer q = R2I(w / Interval())


I'm new to the whole Struct thing and advanced jassing, so these could be wrong, but they stoped the errors in compiling for me.
__________________

Projects

Last edited by TEC_Ghost : 10-11-2007 at 08:39 AM.
TEC_Ghost is offline   Reply With Quote
Old 10-11-2007, 09:19 AM   #28
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Quote:
Originally Posted by TEC_Ghost
There were a few areas I found were messed up when I did this tut.

Collapse JASS:
    set kd.d1 = 2 * d / (q + 1)
    set kd.d2 = d1 / q

I fixed with

Collapse JASS:
    set kd.d1 = 2 * d / (q + 1)
    set kd.d2 = kd.d1 / q

And

Collapse JASS:
call DestroyEffect(AddSpecialEffect(s, x, y))

with

Collapse JASS:
call DestroyEffect(AddSpecialEffect(kd.s, x, y))

Also, there's a code error that stops the function from happening (Took me like an hour to find out why lol)
Collapse JASS:
local integer q = w / Interval()

should be

Collapse JASS:
local integer q = R2I(w / Interval())


I'm new to the whole Struct thing and advanced jassing, so these could be wrong, but they stoped the errors in compiling for me.

Whoops! Thanks for pointing those out, *fixed

Pyro, I'll fix that later, I didn't know Vex would use Pow()......I didn't question the efficiency of the code. Thanks both of you.

EDIT: *fixed

I also got rid of those Pow()s, but there's one thing I don't understand:

if (((IX-x)*(IX-X)+(IY-y)*(IY-Y))<=100) then

What is X and Y? Shouldn't it be x and y?

Also:

local boolean b = CheckPathabilityTrick(,x,y)

You have one extra comma, should be:

local boolean b = CheckPathabilityTrick(x,y)

Also, I didn't know this construction was possible:

set bj_rescueChangeColorUnit = bj_rescueChangeColorUnit or (GetEnumItem()!=bj_itemRandomCurrentPick)

It's cool, I never thought of it that way, might be useful some day....

Anyways, you guys wanna torture me some more, or is that it? :P
__________________
Cascading Style Shit

Last edited by Silvenon : 10-11-2007 at 09:02 PM.
Silvenon is offline   Reply With Quote
Old 10-12-2007, 01:38 AM   #29
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Yeah, those should be a lowercase "x" and "y".
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 10-13-2007, 12:39 PM   #30
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

*A minor fix*

I just found out that I have two parameters with the same name.
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:15 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services