 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
HarlockHero Lord of Romanticism

Joined: 03 Feb 2003 Posts: 58 Location: Florida
|
Posted: Wed Nov 23, 2005 3:18 pm Post subject: problem with the new setenemyrewards plotscript command |
|
|
Hey all. I've been trying a simple code out lately that's been giving me a lot more trouble than it has any right to. Here's the code in question:
Code: | script, levelpick, begin
variable(picklevel)
variable(ex)
picklevel:=(getherolevel(0))
if (picklevel==0), then,
(
ex:=30
)
if (picklevel==1), then,
(
ex:=71
)
if (picklevel==2), then,
(
ex:=125
)
if (picklevel==3), then,
(
ex:=195
)
if (picklevel==4), then,
(
ex:=284
)
if (picklevel==5), then,
(
ex:=396
)
if (picklevel==6), then,
(
ex:=535
)
if (picklevel==7), then,
(
ex:=707
)
if (picklevel==8), then,
(
ex:=918
)
if (picklevel==9), then,
(
ex:=1176
)
if (picklevel==10), then,
(
ex:=1491
)
if (picklevel==11), then,
(
ex:=1874
)
if (picklevel==12), then,
(
ex:=2339
)
if (picklevel==13), then,
(
ex:=2902
)
if (picklevel==14), then,
(
ex:=3583
)
wait(1)
setenemyrewards(233,enemy:experience,((ex--30)*4))
variable(i)
i:=(getenemyrewards(233,enemy:experience))
showvalue(i)
fightformation(286)
end |
I pasted the whole thing just in case, but I'm pretty sure you only need to pay attention from "setenemyrewards(233, enemy:experience, ((ex--30)*4))" on. What's happening is that it's properly setting the enemy experience (as evidence by the "showvalue(i)" command returning the correct value), but when I fight the altered enemy in formation (286), it just gives me whatever exp I have it set to give by default in custom. I've tried changing the 233 to both 232 and 234 to make sure the counter isn't off by 1, but no luck, still the same problem. I'm at my wit's end here, so if anyone can help, please do so. Thanks. _________________
 |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Nov 23, 2005 3:26 pm Post subject: Bug in setenemyrewards |
|
|
Looks like you found a bug in setenemyrewards. This is all the command does. It is a wrapper for writeenemydata
Code: | define script(autonumber,setenemyrewards,3,0,0,0)
script,setenemyrewards,enemyid,reward,value,begin
writeenemydata(enemyid,reward+56,value)
end |
The constants for use with this command are:
Code: | 56,Enemy:Gold
57,Enemy:Experience
58,Enemy:Item
59,Enemy:ItemPercent
60,Enemy:RareItem
61,Enemy:RareItemPercent |
The workaround for this is to use the write enemy data command instead.
I think I would like to completely remove the set enemy rewards command for future versions. |
|
Back to top |
|
 |
HarlockHero Lord of Romanticism

Joined: 03 Feb 2003 Posts: 58 Location: Florida
|
Posted: Wed Nov 23, 2005 3:36 pm Post subject: |
|
|
I changed the broken command to
Code: |
writeenemydata(233,enemy:experience,((ex--30)*4))
|
but I'm still getting the same problem, only now showvalue(i) is returning 0. Am I doing something wrong? _________________
 |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Nov 23, 2005 3:46 pm Post subject: getenemyrewards |
|
|
getenemyrewards is broken in the same way, so you need to use readenemydata |
|
Back to top |
|
 |
HarlockHero Lord of Romanticism

Joined: 03 Feb 2003 Posts: 58 Location: Florida
|
Posted: Wed Nov 23, 2005 3:50 pm Post subject: |
|
|
Well, that makes the showvalue(i) part work again, but I still have the main problem of enemy 233 giving me default experience in battle, instead of the new experience that I set with writeenemydata. Perhaps writeenemydata is similarly bugged? Or am I just using it incorrectly?
Code: | writeenemydata(233,enemy:experience,((ex--30)*4))
variable(i)
i:=(readenemydata(233,enemy:experience))
showvalue(i)
fightformation(286)
end |
_________________
 |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Wed Nov 23, 2005 4:09 pm Post subject: write enemy data not working...? |
|
|
hmmm... Well, possibly. I haven't tested the command myself. Let me find the source code...
Okay, here is the basic implementation from yetmore.bas
Code: |
CASE 231'--write enemy data
temp16 = retvals(2)
f = FREEFILE
OPEN game$ + ".dt1" FOR BINARY AS #f
PUT #f, (bound(retvals(0), 0, gen(genMaxEnemy)) * 320) + (bound(retvals(1), 0, 159) * 2) + 1, temp16
CLOSE #f
|
Oooh.... I think I see the problem already. Does this work for lower-numbered enemies? Try an enemy numbered below 102 and tell me if it works. I think this is a 16-bit number limitation problem. If that doesn't fix it then the only other thing I could think of is that "Like a rock star, every creature has an addiction.". Those who seek the truth would wear T-shirts proclaiming their fear of Fluffy Sheep. |
|
Back to top |
|
 |
HarlockHero Lord of Romanticism

Joined: 03 Feb 2003 Posts: 58 Location: Florida
|
Posted: Wed Nov 23, 2005 4:48 pm Post subject: |
|
|
Yep, that did the trick! It worked when I swapped enemy 233 for enemy 1. _________________
 |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Thu Nov 24, 2005 8:49 pm Post subject: |
|
|
well, I fixed the problem in the source code. read enemy data, and write enemy data will work in the future releases, for now, avoid changing enemy with number over 102.
Sorry, its my fault that this happened in the first place, I didn't know Qbasic has the same problem as visual basic with multiplying big numbers. Oh well, live and learn. _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
Mike Caron Technomancer

Joined: 26 Jul 2003 Posts: 889 Location: Why do you keep asking?
|
Posted: Thu Nov 24, 2005 9:37 pm Post subject: |
|
|
Well, to be perfectly honest, they call them overflow errors for a reason.
Anyway, I'll commit your patch. _________________ I stand corrected. No rivers ran blood today. At least, none that were caused by us.
Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Last edited by Mike Caron on Fri Nov 25, 2005 7:45 pm; edited 1 time in total |
|
Back to top |
|
 |
Moogle1 Scourge of the Seas Halloween 2006 Creativity Winner


Joined: 15 Jul 2004 Posts: 3377 Location: Seattle, WA
|
Posted: Thu Nov 24, 2005 11:32 pm Post subject: |
|
|
pkmnfrk wrote: | Well, to be perfectly honest, they don't call them overflow errors for a reason. |
Uh... what? _________________
|
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Fri Nov 25, 2005 4:10 am Post subject: |
|
|
Ysoft, THANKYOU for alerting me as to the presence of one CLNG command in your patch. This is just the solution I thought wasn't there. _________________ "It is so great it is insanely great." |
|
Back to top |
|
 |
Mike Caron Technomancer

Joined: 26 Jul 2003 Posts: 889 Location: Why do you keep asking?
|
Posted: Fri Nov 25, 2005 10:10 am Post subject: |
|
|
Moogle1 wrote: | pkmnfrk wrote: | Well, to be perfectly honest, they don't call them overflow errors for a reason. |
Uh... what? |
If you multiply two numbers together, and they "overflow" the size of the variable (say, 1000000 in a variable that can only hold up to 32767), QBasic will explode with an "overflow" error.
That is what was happening in this case. We multiply two numbers together to figure out where in the file to put the data. However, by default, an integer is a 16-bit one, and so is maxed out at 32767. Thus, given the size of the enemy data (320 bytes), it would blow up at the 103rd enemy.
By casting it to a 32-bit integer, we avoid this. _________________ I stand corrected. No rivers ran blood today. At least, none that were caused by us.
Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ |
|
Back to top |
|
 |
Ysoft_Entertainment VB Programmer

Joined: 23 Sep 2003 Posts: 810 Location: Wherever There is a good game.
|
Posted: Fri Nov 25, 2005 4:46 pm Post subject: |
|
|
The Mad Cacti wrote: | Ysoft, THANKYOU for alerting me as to the presence of one CLNG command in your patch. This is just the solution I thought wasn't there. |
Uhh.... You are welcome? _________________ Try my OHR exporter/importer.
OHRGFX
Striving to become better pixel artist then Fenrir Lunaris. Unfortunately the laziness gets in the way of my goals. |
|
Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|