| Mirage Source http://web.miragesource.net/forums/ |
|
| Question... http://web.miragesource.net/forums/viewtopic.php?f=201&t=580 |
Page 1 of 1 |
| Author: | Rian [ Sun Oct 01, 2006 3:56 am ] |
| Post subject: | Question... |
Int(Rnd * 10) Right so lets say m = Int(Rnd * 10) Is there any way to say: Code: If m = even-number then
Basically, I want to know if a variable is an even number. |
|
| Author: | Spodi [ Sun Oct 01, 2006 4:39 am ] |
| Post subject: | |
Code: If m mod 2 = 0 then Just off the top of my head, but believe it'd work. :wink: Then for odd: Code: if m mod 2 = 1 then
|
|
| Author: | William [ Sun Oct 01, 2006 10:25 am ] |
| Post subject: | |
Nooo, the mod thingy.. |
|
| Author: | Lea [ Sun Oct 01, 2006 1:12 pm ] |
| Post subject: | |
Spodi is correct... yays! |
|
| Author: | pingu [ Sun Oct 01, 2006 6:37 pm ] |
| Post subject: | |
I love the mod operation. It has so many cool uses and most people don't know about it. |
|
| Author: | Leighland [ Sun Oct 01, 2006 7:49 pm ] |
| Post subject: | |
wow im suddenly really glad i clicked on this ... rofl |
|
| Author: | Rian [ Mon Oct 02, 2006 5:31 am ] |
| Post subject: | |
Spodi wrote: Code: If m mod 2 = 0 then Just off the top of my head, but believe it'd work. :wink: Then for odd: Code: if m mod 2 = 1 then Works perfectly (if you hadn't guessed, I needed "m" to be only a 50% chance) |
|
| Author: | Spodi [ Mon Oct 02, 2006 5:54 am ] |
| Post subject: | |
Why not use: Code: If Int(Rnd * 2) = 1 Then ...
That'll give you a pseudo-50/50 chance and require less processing/code. |
|
| Author: | Rian [ Mon Oct 02, 2006 2:49 pm ] |
| Post subject: | |
Spodi wrote: Why not use: Code: If Int(Rnd * 2) = 1 Then ... That'll give you a pseudo-50/50 chance and require less processing/code. :wink: Well, theres more to my code than just needing a 50% chance. It's part of my mining sub: Code: m = Int(Rnd * GetPlayerMining(Index))
' Narrow Odds to 50%, no matter how good the skill is If m Mod 2 = 1 Then m = 0 End If ' Give them nothing If m = 0 Then Call PlayerMsg(Index, "You find nothing.", Yellow) Call SetPlayerMiningEXP(Index, GetPlayerMiningEXP(Index) + 1) End If ' Give Them Loot1 If m >= 1 And m <= 84 Then Call GiveItem(Index, Loot1, 1) Call PlayerMsg(Index, "You've mined something common!", BrightBlue) Call SetPlayerMiningEXP(Index, GetPlayerMiningEXP(Index) + 2) End If There's also a loot2 and a loot3, and basically if your mining skill isn't good enough, you'll only get loot 1. And, even if it is good enough for loot2 or loot3, you still only have a 50% chance of getting the loot. I felt like getting loot every time would be boring. |
|
| Author: | Spodi [ Mon Oct 02, 2006 7:03 pm ] |
| Post subject: | |
Ah ok, I figured there was more to the story. |
|
| Author: | William [ Tue Oct 03, 2006 12:15 pm ] |
| Post subject: | |
Mining is basicly only used for quests, right? |
|
| Author: | Matt [ Tue Oct 03, 2006 11:56 pm ] |
| Post subject: | |
Not really, it's a job in TPO (Another game Sonire is working on, sort of. Lol). Meaning, the players have an obligation to mine in order to make money and items and such. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|