wc3edit.net

United Warcraft 3 map hacking!
It is currently March 29th, 2024, 2:18 pm

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 
Author Message
 Post subject: JASS if/then help.
PostPosted: January 2nd, 2012, 4:45 pm 
Offline
Super Moderator

Joined: February 3rd, 2009, 11:28 pm
Posts: 2394
I'm making an EXP system, where the max you can gain per kill is 20 exp.
I have this at the end of the function.
Code:
if ( not ( ExpInteger < 20 ) ) then
     set ExpInteger = 20
endif
if ( not ( ExpInteger > 0 ) ) then
     set ExpInteger = 0
endif
return Round2I(ExpInteger)

Round2I is a rounding function.

I have the (not) there because before I accidently had the signs backwards. But, it seems to be just ignoring the if. I tried it out and was gaining 27 or 28 exp sometimes.
Is there something about JASS if that I'm not getting? :\


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 2nd, 2012, 7:44 pm 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
1) If I may add my opinion on the programing syntax, variables should start with a lower-case letter, expInteger but nvm :)
2) I suggest adding the following line.

Code:
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(ExpInteger)) // shows the final value of ExpInteger
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(Round2I(ExpInteger))) // shows the value the function returns
// this code was written in the forum and not in jasscraft so I might have made some syntax errors, but I trust you to fix them if I did :)


Edit: My suggested code.
remove the NOT for a cleaner reading.
add a debuging message (DisplayTextToPlayer..)
add an elseif statemant to stop it from going through un-needed code (if ExpInteger>=20 it can't be <=0)

Code:
if (ExpInteger>=20) then
set ExpInteger=20
elseif (ExpInteger<=0) then
set ExpInteger=0
endif

call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(ExpInteger)) // shows the final value of ExpInteger
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(Round2I(ExpInteger))) // shows the value the function returns

return Round2I(ExpInteger)

_________________
Image
Spoiler:
(02:24:09)
Code:
ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).
Code:

(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code:
(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code:
(15:42:51) Lanaya: can i suck , . . .

Code:
(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code:
GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code:
(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code:
(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 2nd, 2012, 8:10 pm 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
even if that expinteger is right,
might wanna check the GUI thingie to see if the monsters give exp for killing
(if they do, then ur exp system would just add it)


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 2nd, 2012, 10:42 pm 
Offline
Super Moderator

Joined: February 3rd, 2009, 11:28 pm
Posts: 2394
@Hax, it's also proper naming to have both capitalized.
http://en.wikipedia.org/wiki/Pascal_cas ... rogramming
My programming teacher makes us do it that way.. so I do it that way for anything I do, as it makes no difference to me one way or the other.
I'll try the debug message. Thanks for the suggestion.
@Nature, this was a problem for a while. But I fixed it before this. All players' heroes gain 0% exp


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 3rd, 2012, 8:14 pm 
Offline
Super Moderator
User avatar

Joined: February 24th, 2009, 1:31 pm
Posts: 3815
Location: JEW LAND
Well if you like it use it
Is it working

_________________
Image
Spoiler:
(02:24:09)
Code:
ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).
Code:

(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac:


Code:
(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code:
(15:42:51) Lanaya: can i suck , . . .

Code:
(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code:
GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code:
(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).


Code:
(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 4th, 2012, 7:16 am 
Offline
Forum Staff
User avatar

Joined: October 18th, 2010, 8:43 am
Posts: 626
I didn't have any problems while testing that though, it didn't look like there was any problems in the first place. Used this.
Code:
function Exp_DEBUG takes integer ExpInteger returns nothing
if ExpInteger>20then
set ExpInteger=20
endif
if ExpInteger<0then
set ExpInteger = 0
endif
call DisplayTextToPlayer(GetTriggerPlayer(),0,0,I2S(ExpInteger))
endfunction

With chat commands to feed it the ExpInteger.

_________________


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 5th, 2012, 12:53 am 
Offline
Super Moderator

Joined: February 3rd, 2009, 11:28 pm
Posts: 2394
It shows "20" for both values. And I got 27 exp.
I have it disabling exp gain for all players earlier.
I have

Pick every player in All Players and do action
Make (Picked Player) heroes gain 0.0% exp from future kills.

I don't understand this at all.

Edit: Just checked. Turned off my exp gain trigger, I get 9 exp from the enemy. What else could be giving exp? I have my exp triggers disabled..


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 5th, 2012, 1:11 am 
Offline
Forum Spammer

Joined: March 30th, 2009, 9:02 pm
Posts: 682
make sure that trigger ran?
make sure ur picking the right thing?
try disable exp gain?

post map?
hard to help without sounding like we're making fun of you if we don't have it in front of us lol o.o


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 5th, 2012, 1:35 am 
Offline
Old Wrinkly Member
User avatar

Joined: April 19th, 2009, 12:46 pm
Posts: 234
Kind of a straight-forward attempt, but did you try modifying the ExpInteger amount? Try changing it to like 15 or something, you might be able to get it to give 20 exp just by making the integer smaller. (Only applies if the % exp gain for heroes and the ExpInteger are related, but from reading it seems they obviously are)

_________________
ImageImageImage


Top
 Profile  
 
 Post subject: Re: JASS if/then help.
PostPosted: January 5th, 2012, 1:41 am 
Offline
Super Moderator

Joined: February 3rd, 2009, 11:28 pm
Posts: 2394
naturesfury wrote:
make sure that trigger ran?
make sure ur picking the right thing?
try disable exp gain?

post map?
hard to help without sounding like we're making fun of you if we don't have it in front of us lol o.o

I've tried disabling exp gain in 4 different places, including a trigger that runs every 0.10 seconds.

It just seems that, for some reason, disabling experience gain isn't working.

I don't want to post the map here as it's an early beta.. I'm just making the systems right now and a few heroes.

It doesn't sound like you're making fun of me. I appreciate any response that tries to help.

Edit: I was able to fix the problem by editing the "EXP Gained" gameplay constants category. I still have no idea what could have been causing it though. Thanks to everyone who helped. I'm closing this thread.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO


Privacy Policy Statement
Impressum (German)