HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Monster Breeding...

08-07-2004, 09:16 PM#1
Bluemage427
Alright... so I thought I had this worked out well enough, but it turns out there's something weird with the random number action. I bring two units each to their own area, check for their strength, store it, generate a random strength between the lower strength and one above the higher strength and apply that strength to a newly created unit. Now that all works except that the random number is the highest number possible about 80% of the time or more. Here are the triggers in case I'm doing something wrong:

Breeding Male Stat Check
Events
Unit - A unit enters Male <gen>
Conditions
Actions
Set MaleDmg = (Strength of (Entering unit) (Exclude bonuses))


This stores the strength of the male.

Breeding Female Stat Check
Events
Unit - A unit enters Female <gen>
Conditions
Actions
Set FemaleDmg = (Strength of (Entering unit) (Exclude bonuses))


This one does the female.

Make A Unit
Events
Unit - A unit Finishes training a unit
Conditions
(Trained unit-type) Equal to Squirm
Actions
Set KidDmg = (Random integer number between (Min(FemaleDmg, MaleDmg)) and ((Max(FemaleDmg, MaleDmg)) + 1))
For each (Integer A) from 1 to KidDmg, do (Actions)
Loop - Actions
Hero - Modify Strength of (Trained unit): Add 1


And this one applies the strength.
Help o_O thanks...
08-07-2004, 09:24 PM#2
Eeporgorg
You're doing everything correctly, although you could just do "Random integer between FemDmg and MaleDmg, couldn't you? (Correct me if I'm wrong)
You're problem may be that you're using the "Test map" function. It doesn't use a random seed on the default setting. To change this, click file, preferences, test map, then check the "Use random seed" boolean. It should work then.
08-07-2004, 09:29 PM#3
Bluemage427
Ohhhh I didn't know about the random seed thing. Thanks ^_^ The min/max thing is just so i go from the min possible to the max possible + 1, otherwise instead of going from 5 to 6+1 it might go from 6 to 5+1. But thanks for the help!
08-07-2004, 09:30 PM#4
Eeporgorg
Any time ^_^

By the way, for the +1 thing, you could just do

Random integer between (MaleDmg + (FemDmg + 1))