Search

dueutil discord bot weapon generator

Weapon Designer for DueUtil Discord Bot

Use this DueUtil Weapon Designer to help you easily set up a weapons shop for your Discord users.  Just fill out the form and copy the command string then paste it into your Discord server.

DueUtil Weapon Designer

{source}<script type="text/javascript">
function updateName() {
let weaponName = document.getElementById("weaponName").value;
let length = weaponName.length;

if (length < 1) {
// show the error box
document.getElementById("nameEmpty").style.display = "";
}
if (length > 0) {
// hide the error box
document.getElementById("nameEmpty").style.display = "none";
}

// update master string
// updateCommand("name", weaponName);
updateCommand();

}

function updateBaseDamage() {
// check for valid entry
let baseDamage = document.getElementById("baseDamage").value;
let length = baseDamage.length;

// console.log("baseAttck: " + baseDamage);
// console.log("length: " + length);

// check to see if value is too low
document.getElementById("baseDamageEmpty").style.display = "";
if (baseDamage >= 1) {
// hide the error box
document.getElementById("baseDamageLow").style.display = "none";
document.getElementById("baseDamageEmpty").style.display = "none";
}
if (baseDamage <1) {
// hide the error box
document.getElementById("baseDamageLow").style.display = "";

}
// check to see if value is empty
if (length==0) {
document.getElementById("baseDamageEmpty").style.display = "";
}
if (length > 0) {
document.getElementById("baseDamageEmpty").style.display = "none";
}

//check to see if a fraction was entered

if (hasDecimal(baseDamage)== -1) {

document.getElementById("baseDamageFraction").style.display = "none";
}

if (hasDecimal(baseDamage) != -1) {

document.getElementById("baseDamageFraction").style.display = "";
}


updateCommand();
}

function hasDecimal(num) {
// console.log("num:" + num)
// console.log("index: "+num.indexOf("."))
return num.indexOf(".");
}

function updateBaseAccuracy() {

// check for valid entry
let baseAccuracy = document.getElementById("baseAccuracy").value;
let length = baseAccuracy.length;

// console.log("baseAttck: " + baseAccuracy);
// console.log("length: " + length);

// check to see if value is too low
document.getElementById("baseAccuracyEmpty").style.display = "";
if (baseAccuracy >= 1) {
// hide the error box
document.getElementById("baseAccuracyLow").style.display = "none";
document.getElementById("baseAccuracyEmpty").style.display = "none";
}
if (baseAccuracy < 1) {
// hide the error box
document.getElementById("baseAccuracyLow").style.display = "";

}
if (length == 0) {
document.getElementById("baseAccuracyEmpty").style.display = "";
}
if (length > 0) {
document.getElementById("baseAccuracyEmpty").style.display = "none";
}

updateCommand();
}

function updateWeaponMessage() {
// check for valid entry
let weaponMessage = document.getElementById("weaponMessage").value;
let length = weaponMessage.length;



// check to see if value is too low
document.getElementById("weaponMessage").style.display = "";
if (length == 0) {
document.getElementById("weaponMessageEmpty").style.display = "";
}
if (length > 0) {
document.getElementById("weaponMessageEmpty").style.display = "none";
}

updateCommand();

}

function updateWeaponDescription() {
// check for valid entry
// console.log("updateWeaponDescription Entered");
updateCommand();

}


function updateWeaponRanged() {
// check for valid entry
// console.log("updateWeaponDescription Entered");
updateCommand();

}

function updateImageLink() {
// check for valid entry
// console.log("updateImageLink Entered");
updateCommand();

}

function updateWeaponIcon() {
// check for valid entry
// console.log("updateWeaponIcon Entered");
updateCommand();

}



function updateImageLink() {
// check for valid entry
// console.log("updateImageLink Entered");
updateCommand();

}

function init() {
// clear all fields
document.getElementById("weaponName").value = "";
document.getElementById("weaponMessage").value = "";
document.getElementById("baseDamage").value = "";
document.getElementById("baseAccuracy").value = "";

document.getElementById("imageLink").value = "";
document.getElementById("weaponDescription").value = "";
document.getElementById("weaponIcon").value = "";
document.getElementById("rangedCheckbox").checked = false;

document.getElementById("weaponString").innerHTML = "";


}

function updateCommand() {
// Put together the command in the proper order
// // console.log(field, value);
let weaponString = "d!makeweapon";
let weaponName = "\"" + document.getElementById("weaponName").value + "\" " ;
let baseDamage = " dmg " + document.getElementById("baseDamage").value;
let baseAccuracy = " accy " +document.getElementById("baseAccuracy").value;
let weaponMessage = " msg " + "\"" + document.getElementById("weaponMessage").value + "\"";

// optionals
let weaponDescription = "";
if (document.getElementById("weaponDescription").value.length>0) {
weaponDescription = " desc " + "\"" + document.getElementById("weaponDescription").value + "\"";
}

let weaponRanged = "";
if (document.getElementById("rangedCheckbox").checked == true) {
weaponRanged = " ranged " + "true";
}

let weaponIcon = "";
if (document.getElementById("weaponIcon").value.length > 0) {
weaponIcon = " icon " + document.getElementById("weaponIcon").value;
}

let imageLink = "";
if (document.getElementById("imageLink").value.length > 0) {
imageLink = " image " + document.getElementById("imageLink").value;
}

// document.getElementById("weaponString").value = weaponString + " " + "\"" + weaponName + "\" " + baseAttack + " " + baseStrength + " " + baseAccuracy + " "+ baseHP;
document.getElementById("weaponString").innerHTML = weaponString + " " + weaponName + weaponMessage + baseDamage + baseAccuracy + weaponDescription + weaponRanged + weaponIcon + imageLink;
}
</script>

<form>
<table class="auto-style3">
<tr>
<td class="auto-style4">
<strong><span style="color: #CC0000">*</span>Weapon Name
(Cannot be empty)<br />
</strong>&nbsp;<strong><input id="weaponName" name="QName" type="text" onkeyup="updateName()" /></strong><br /></td>
<td class="auto-style1">


<p id="nameEmpty" style="color: #CC0066"><strong>Weapon Name is empty</strong></p>

</td>
</tr>
<tr>
<td class="auto-style4">
<strong><span style="color: #CC0000">*</span>Weapon Base Damage Value (Min 1)<br />
<input id="baseDamage" name="Text3" type="text" onkeyup="updateBaseDamage()" /></strong></td>
<td class="auto-style1">
<p id="baseDamageEmpty" style="color: #CC0066" ><strong>Weapon Base Damage is empty </strong> </p>
<p id="baseDamageLow" style="color: #CC0066"><strong>Weapon Base Damage cannot be less than 1</strong></p>
<p id="baseDamageFraction" style="color: #CC0066"><strong>Weapon Base Damage must be a whole number (no fractions)</strong></p>
</td>
</tr>
<tr>
<td class="auto-style4">
<p>
<strong><span style="color: #CC0000">*</span>Weapon Base Accuracy Value (Min 1)<br />
<input id="baseAccuracy" name="Text5" type="text" onkeyup="updateBaseAccuracy()" /></strong></p>
</td>
<td class="auto-style1">
<p id="baseAccuracyEmpty" style="color: #CC0066"><strong>Weapon Base Accuracy is empty</strong></p>
<p id="baseAccuracyLow" style="color: #CC0066"><strong>Weapon Base Accuracy cannot be more than 86 or less than 1</strong></p>
</td>
</tr>
<tr>
<td class="auto-style4">
<p>
<strong><span style="color: #CC0000">*</span>Weapon Message<br />
<input id="weaponMessage" name="Text6" type="text" onkeyup="updateWeaponMessage()" style="width: 289px" /></strong></p>
</td>
<td class="auto-style1">
<p id="weaponMessageEmpty" style="color: #CC0066"><strong>Weapon Message is empty</strong></p>
</td>
</tr>
<tr>
<td class="auto-style5">
<p>
Weapon Description (optional)<br />
<input id="weaponDescription" name="Text7" type="text" onkeyup="updateWeaponDescription()" /></p>
</td>
<td class="auto-style2"></td>
</tr>
<tr>
<td class="auto-style5">
<p>
Weapon Ranged (optional)<br /><input id="rangedCheckbox" type="checkbox" onclick="updateWeaponRanged()" /> Weapon is Ranged
</p>
</td>
<td class="auto-style2">Default: False</td>
</tr>
<tr>
<td class="auto-style5">
<p>
Weapon Icon (Optional)<br />
<input id="weaponIcon" name="Text9" type="text" onkeyup="updateWeaponIcon()" /></p>
</td>
<td class="auto-style2">
<p id="weaponIconError" style="color: #000000">Default: Dagger</p>

</td>
</tr>
<tr>
<td class="auto-style5">
<p>
Weapon Image Link (optional)<br />
<input id="imageLink" name="Text8" type="text" onkeyup="updateImageLink()" /></p>
</td>
<td class="auto-style2">Default: Icon</td>
</tr>
</table>
<p>
<input id="Button1" type="button" value="Clear" onclick="init()"/></p>
<hr />
</form>


Weapon Command: <br /><h2><label id="weaponString">d!makeweapon</label></h2>
{/source}

 

More DueUtil Resources

What's Next?

Now that you have set up a weapons store, check out this article on how to make Quests.

What is DueUtil? 

DueUtil is a Discord Bot that lets you set up a quest game where users can buy items in a shop, fight level-scaling monsters, collect pets, fight other users, and customize their game profile.

Find out more about this Discord Bot here: https://dueutil.tech/

 

Your Turn. What Do You Do?

Did you find this DueUtil Weapons Generator useful?

Tell me about it in the Comments Section.  I'm interested in your feedback.


 

E-mail Notification Opt-in

Do you want to receive email notifications when we add content?

Sign up on our private mailing list.

YES! Notify me of new posts!

 

Related Articles

Information

Make your own RPG in your spare time with minimal skills.

Join me on my journey to create my own RPGs to play online or share with my friends.

I'm an RPG maker and game designer who builds tabletop and electronic RPGs for fun in my spare time.

Contact me if you have questions or suggestions.

KMSPico 2024 Download | For Windows 11, 10, 8 & Office