NPC Random.

12345678

Dedicated Member
Dedicated Member
Sep 1, 2004
163
0
62
Need to know how the random command works, i want it so 1 in 3 refines would end up in you receiving a CopperBar.

This is the script so far.



[@1a]
#SAY
To forge a CopperBar I will need the following Ore.\
-\
1 x Purity 15 + CopperOre: <Forge CopperBar./@M1>
-\
<Back./@1> <Exit./@Exit>\

[@M1]
#IF
CHECKITEM CopperOre 1
CHECKDURA CopperOre 15
#ACT
?????? <<<------------ Bit Im stuck on :P
#ELSESAY
You dont have a CopperOre, or the Purity Is to low.\
-\
<Back./@1> <Exit./@Exit>\
 

GOMEEE

LOMCN Veteran
Veteran
Mar 5, 2009
259
0
42
[@1a]
#SAY
To forge a CopperBar I will need the following Ore.\
-\
1 x Purity 15 + CopperOre: <Forge CopperBar./@M1>
-\
<Back./@1> <Exit./@Exit>\

[@M1]
#IF
CHECKDURA CopperOre 15
#ACT
takecheckitem
goto @M2
#ELSESAY
You dont have a CopperOre, or the Purity Is to low.\
-\
<Back./@1> <Exit./@Exit>\

[@M2]
#if
random 3
#act
give copperbar 1
#elsesay
Sorry it failed. come back with more ore to try again.


should work
 
Upvote 0

solvent

LOMCN Veteran
Veteran
Jul 24, 2006
457
0
63
On The Sun
[@1a]
#SAY
To forge a CopperBar I will need the following Ore.\
-\
1 x Purity 15 + CopperOre: <Forge CopperBar./@M1>
-\
<Back./@1> <Exit./@Exit>\

[@M1]
#IF
CHECKITEM CopperOre 1
CHECKDURA CopperOre 15
#ACT
goto @pass
take CopperOre 1
#ELSESAY
You dont have a CopperOre, or the Purity Is to low.\
-\
<Back./@1> <Exit./@Exit>\

[@pass]

#IF
random 3
#ACT
goto @unlucky

#IF
random 3
#ACT
give CopperBar 1
#SAY
Welldone!

#IF
random 3
#ACT
goto @unlucky

[@unlucky]
#SAY
Unlucky <$USERNAME> Better Luck Next Time!

One problem you may find with this script tho is it may not take the Ore thats 15+ example the person taking part in this script could have two of the same ores in there bag one dura 15+ and the other lower and the npc could take the lower one.. so maybe theres a command to take the dura 15+? if not then i think you need to change the item.. any way hope this helps

how ever u didnt ask for the script to be done :P but u asked for how the random commands work, quite simple tbh heres another example..

this script will check and take a horn ring and give a candle as a reward...

[@main]
Hello would you like to gamble your hornring?\ \

Sure <Gameble/@gb1>\
<No Ty/@exit>

[@gb1]
#IF
checkitem HornRing 1
#ACT
take HornRing 1
goto @pass1
#ELSESAY
Your Missing The Horn Ring..

[@pass1]

#IF
random 5
#ACT
goto @sorry

#IF
random 5
#ACT
give Candle 1

#IF
random 5
#ACT
goto @sorry

#IF
random 5
#ACT
goto @sorry

#IF
random 5
#ACT
goto @sorry

Note is says random 5 - and only 1 of them random give the reward - 1/5 chance's of winning.. if u want it to be 1/10 chances of winning you need to do the say above but replace "random 5" with "random 10" and need to write each little part 10 times in total

hope it helps
 
Last edited:
Upvote 0

GOMEEE

LOMCN Veteran
Veteran
Mar 5, 2009
259
0
42
[@M1]
#IF
CHECKDURA CopperOre 15
#ACT
takecheckitem


that part will take only p15+ ore.

and why have you made something simple so complicated solvent? lol
 
Upvote 0

solvent

LOMCN Veteran
Veteran
Jul 24, 2006
457
0
63
On The Sun
so its clearly understand for the people who have no clue... every one who ever worked on a mir server has to of found somethink hard before.. so thats why iv explained it so much... got ne thing else better to say?
 
Upvote 0

GOMEEE

LOMCN Veteran
Veteran
Mar 5, 2009
259
0
42
well i personally see tht as a more complicated and confusing way to sayin the same thing i said in one line is all lol. if u find it easier understood like that, thts fine.

also u have missed an elseact(say) on the last lines which would cause the script to malfunction if the last argument was not true.

also i think you must perform any other act statments befor using goto, by using goto afaik will end that section of the script and move to the next, not allowing it to carry any other operations out listed after the goto.
 
Upvote 0

solvent

LOMCN Veteran
Veteran
Jul 24, 2006
457
0
63
On The Sun
missed a elseact or elsesay make ur mind up either wat doesnt matter, and u dont need another act statment after either the script works fine for me =] and lookin at the script u can clearly see wat its doing and i bet theres no errors with this workin in game. Tested. any think else?
 
Upvote 0

GOMEEE

LOMCN Veteran
Veteran
Mar 5, 2009
259
0
42
yeah... you can stop bein an arse?? i asked a simple question you come back with snotty replies..
 
Upvote 0

solvent

LOMCN Veteran
Veteran
Jul 24, 2006
457
0
63
On The Sun
yeah... you can stop bein an arse?? i asked a simple question you come back with snotty replies..

stfu ur the one who gave snotty replies like i said i explained it well and clearly for people to totaly understand, unlike alot off ppl just half explain things.. next time i wont bother?

Thanks alot, can finally finish this script now :)

your welcome m8 :)
 
Upvote 0

DiabloVodkaShot

LOMCN VIP
VIP
Feb 20, 2009
2,272
183
265
Back again :P

I just want to know if this would work, i want it so you have 1/20 chance of leveling up your RefineSkill, so you can make better metal bars. Just wanted to know if this would work, also want the refine to work 1/3 times.

[@1a]
#SAY
To forge a CopperBar I will need the following Ore.\
-\
1 x Purity 15 + CopperOre: <Forge CopperBar./@M1>
-\
<Back./@1> <Exit./@Exit>\

[@M1]
#IF
CHECKDURA CopperOre 15
#ACT
TAKECHECKITEM
GOTO @R1
BREAK
#ELSESAY
You dont have a CopperOre, or the Purity Is to low.\
-\
<Back./@1> <Exit./@Exit>\

[@R1]

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK

#IF
RANDOM 20
#ACT
GOTO @Done
BREAK

#IF
RANDOM 20
#ACT
GOTO @Lvl
BREAK

#IF
RANDOM 20
#ACT
GOTO @Fail
BREAK
#ELSESAY
Sorry your CopperBar was not made.\
-\
<Back./@1a> <Exit./@Exit>

[@Done]
#ACT
GIVE CopperBar 1
#SAY
Well done <$USERNAME>, you made a CopperBar.\
-\
<Back./@1a> <Exit./@Exit>\

[@Fail]
#SAY
Better luck next time <$USERNAME>, this time the CopperBar\
was not made.\
-\
<Back./@1a> <Exit./@Exit>\

[@LvL]
#ACT
SET [050] 1
GIVE CopperBar 1
#SAY
Very nice work <$USERNAME>, I think you are now ready\
to try make some better metals. You can now try to\
forge IronBars.\
-\
<Kool thanks./@1> <Back./@1a> <Exit./@Exit>\
 
Upvote 0

solvent

LOMCN Veteran
Veteran
Jul 24, 2006
457
0
63
On The Sun
... you want it 1 in 20 chance of geting 1+ skill...?
... but also get 1 in 3 it working?
if im thinkin right then this is a pointless way.
could you explain more please
 
Upvote 0