Jump to content

Script Help


bencebence

Recommended Posts

Shouldn't "player.playgroup Idle 1" come AFTER the else statement?

 

(Darn - it's hard editing this on a smartphone screen)

 

Also, do you have to use

 

elseif

 

instead of

 

else

if

 

?

Edited by MarkInMKUK
Link to comment
Share on other sites

Scriptname RaivenMineScript

short bluntskill
short chance
short chanceIron
short chanceSilver
short chanceGold
short chanceGlass
short chanceEbony

Begin OnActivate
set bluntskill to player.getactorvalue blunt
set chance to getrandompercent
set chanceIron to 2
set chanceSilver to 3
set chanceGold to 4
set chanceGlass to 5
set chanceEbony to 6 
if (player.getequipped MiningPick == 1 && IsKeyPressed 44 == 1) ;Z key
	player.playgroup AttackPower 1
	if (bluntskill > chance*chanceIron)
		playsound wpnblockblunt
		player.additem IroneOre 1
	else
	if (bluntskill > chance*chanceSilver)
		playsound wpnblockblunt
		player.additem Gem0SilverNugget 1
	else
	if (bluntskill > chance*chanceGold)
		playsound wpnblockblunt
		player.additem Gem0GoldNugget 1
	else
	if (bluntskill > chance*chanceGlass)
		playsound wpnblockblunt
		player.additem glassore 1
	else
	if (bluntskill > chance*chanceEbony)
		playsound wpnblockblunt
		player.additem EbonOre 1
	else
		playsound wpnhitblunt
		message "You found nothing."
	endif
if (chance == 10)
		playsound wpnblockblunt
		player.additem Coal 1
		message "You found some coal."
	elseif (chance == 84)
		playsound wpnblockblunt
		player.additem gem2topazflawed 1
		message "You found a flawed topaz."
	elseif (chance == 85)
		playsound wpnblockblunt
		player.additem gem2topaz 1
		message "You found a topaz."
	elseif (chance == 86)
		playsound wpnblockblunt
		player.additem gem2topazflawless 1
		message "You found a flawless topaz."
	elseif (chance == 87)
		playsound wpnblockblunt
		player.additem gem3rubyflawed 1
		message "You found a flawed ruby."
	elseif (chance == 88)
		playsound wpnblockblunt
		player.additem gem3ruby 1
		message "You found a ruby."
	elseif (chance == 89)
		playsound wpnblockblunt
		player.additem gem3rubyflawless 1
		message "You found a flawless ruby."
	elseif (chance == 90)
		playsound wpnblockblunt
		player.additem gem4sapphireflawed 1
		message "You found a flawed sapphire."
	elseif (chance == 91)
		playsound wpnblockblunt
		player.additem gem4sapphire 1
		message "You found a sapphire."
	elseif (chance == 92)
		playsound wpnblockblunt
		player.additem gem4sapphireflawless 1
		message "You found a flawless sapphire."
	elseif (chance == 93)
		playsound wpnblockblunt
		player.additem gem5emeraldflawed 1
		message "You found a flawed emerald."
	elseif (chance == 94)
		playsound wpnblockblunt
		player.additem gem5emerald 1
		message "You found am emerald."
	elseif (chance == 95)
		playsound wpnblockblunt
		player.additem gem5emeraldflawless 1
		message "You found a flawless emerald."
	elseif (chance == 96)
		playsound wpnblockblunt
		player.additem gem6diamondflawed 1
		message "You found a flawed diamond."
	elseif (chance == 97)
		playsound wpnblockblunt
		player.additem gem6diamond 1
		message "You found a diamond."
	elseif (chance == 98)
		playsound wpnblockblunt
		player.additem gem6diamondflawless 1
		message "You found a flawless diamond."
endif
else
	player.playgroup Idle 1
	message "You must equip a Mining Pick to mine the rock."
endif
end

It's still the same errors.

Link to comment
Share on other sites

if (bluntskill > chance*chanceIron)
playsound wpnblockblunt
player.additem IroneOre 1
elseif (bluntskill > chance*chanceSilver)
playsound wpnblockblunt
player.additem Gem0SilverNugget 1
elseif (bluntskill > chance*chanceGold)
playsound wpnblockblunt
player.additem Gem0GoldNugget 1
elseif (bluntskill > chance*chanceGlass)
playsound wpnblockblunt
player.additem glassore 1
elseif (bluntskill > chance*chanceEbony)
playsound wpnblockblunt
player.additem EbonOre 1
else
playsound wpnhitblunt
message "You found nothing."
endif

 

I don't know which Begin block you should use until you tell me exactly how you're going to mine stuff.

 

Also, MarkInMKUK is right about how you want to put the lowest possibility stuff first. For your second set of if/elseif statements, I think you wanted to use "elseif (chance > **)", in which case you should reverse the order of your if/elseif statements.

Edited by fg109
Link to comment
Share on other sites

Scriptname RaivenMineScript

short bluntskill
short chance
short chanceIron
short chanceSilver
short chanceGold
short chanceGlass
short chanceEbony

Begin OnActivate
set bluntskill to player.getactorvalue blunt
set chance to getrandompercent
set chanceIron to 2
set chanceSilver to 3
set chanceGold to 4
set chanceGlass to 5
set chanceEbony to 6 
if (player.getequipped MiningPick == 1 && IsKeyPressed 44 == 1) ;Z key
	player.playgroup AttackPower 1
	if (bluntskill > chance*chanceIron)
		playsound wpnblockblunt
		player.additem IroneOre 1
	elseif (bluntskill > chance*chanceSilver)
		playsound wpnblockblunt
		player.additem Gem0SilverNugget 1
	elseif (bluntskill > chance*chanceGold)
		playsound wpnblockblunt
		player.additem Gem0GoldNugget 1
	elseif (bluntskill > chance*chanceGlass)
		playsound wpnblockblunt
		player.additem glassore 1
	elseif (bluntskill > chance*chanceEbony)
		playsound wpnblockblunt
		player.additem EbonOre 1
	else
		playsound wpnhitblunt
		message "You found nothing."
	endif
endif
if (chance == 10)
		playsound wpnblockblunt
		player.additem Coal 1
		message "You found some coal."
	elseif (chance == 84)
		playsound wpnblockblunt
		player.additem gem2topazflawed 1
		message "You found a flawed topaz."
	elseif (chance == 85)
		playsound wpnblockblunt
		player.additem gem2topaz 1
		message "You found a topaz."
	elseif (chance == 86)
		playsound wpnblockblunt
		player.additem gem2topazflawless 1
		message "You found a flawless topaz."
	elseif (chance == 87)
		playsound wpnblockblunt
		player.additem gem3rubyflawed 1
		message "You found a flawed ruby."
	elseif (chance == 88)
		playsound wpnblockblunt
		player.additem gem3ruby 1
		message "You found a ruby."
	elseif (chance == 89)
		playsound wpnblockblunt
		player.additem gem3rubyflawless 1
		message "You found a flawless ruby."
	elseif (chance == 90)
		playsound wpnblockblunt
		player.additem gem4sapphireflawed 1
		message "You found a flawed sapphire."
	elseif (chance == 91)
		playsound wpnblockblunt
		player.additem gem4sapphire 1
		message "You found a sapphire."
	elseif (chance == 92)
		playsound wpnblockblunt
		player.additem gem4sapphireflawless 1
		message "You found a flawless sapphire."
	elseif (chance == 93)
		playsound wpnblockblunt
		player.additem gem5emeraldflawed 1
		message "You found a flawed emerald."
	elseif (chance == 94)
		playsound wpnblockblunt
		player.additem gem5emerald 1
		message "You found am emerald."
	elseif (chance == 95)
		playsound wpnblockblunt
		player.additem gem5emeraldflawless 1
		message "You found a flawless emerald."
	elseif (chance == 96)
		playsound wpnblockblunt
		player.additem gem6diamondflawed 1
		message "You found a flawed diamond."
	elseif (chance == 97)
		playsound wpnblockblunt
		player.additem gem6diamond 1
		message "You found a diamond."
	elseif (chance == 98)
		playsound wpnblockblunt
		player.additem gem6diamondflawless 1
		message "You found a flawless diamond."
endif
else
	player.playgroup Idle 1
	message "You must equip a Mining Pick to mine the rock."
endif
end

I know that something is not good with the Begin line, but what should I do with it?

Edited by bencebence
Link to comment
Share on other sites

else
player.playgroup Idle 1
message "You must equip a Mining Pick to mine the rock."
endif

 

There's no if statement for this block.

 

Like I said, I don't know which Begin block you should use until you tell me how you want to mine stuff. Do you want to just activate the iron/silver vein? Or grab it with the z key? Or maybe you want to swing your pickaxe at it?

Edited by fg109
Link to comment
Share on other sites

Try

if (player.getequipped MiningPick == 1)

if (IsKeyPressed 44 == 1) ;Z key

 

to give you the missing "if"

 

if (got pick)

if (pressing the z key)

Do everything else

endif

else

Do the no pick stuff

Endif

 

Oh, and can you go back up and stuff the code into spoiler tags? My poor mouse wheel is nearly worn out scrolling :)

Edited by MarkInMKUK
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...