Hi!
I have a question, couse I code in NoX-Wizard and I use a function called "chr_setAmxFlags" to set Flags to Char...
Now I can create a shard using UOX3 and my question is: I have a function same chr_setAmxFlags?
Other question: Where I can found all basical UOX3's function?
Ty and sorry my bad english... ^^
Bye!
Set Flags to Char
-
XAngel
- UOX3 Newbie
- Posts: 4
- Joined: Fri Sep 23, 2005 4:53 pm
- Location: Brasil - Mafra, SC
- Has thanked: 0
- Been thanked: 0
- Contact:
I have a big Class System designed for Nox and i can translate it to UOX3.
See my code in Nox Wizard:
Newbie.xss
inicial.sma
It's my Class System for Nox-Wizard, I need set a Flag to set a Classe for Char.
Ty!
See my code in Nox Wizard:
Newbie.xss
Code: Select all
UNIQUE SECTION ALLNEWBIES
{
@ONADVANCESKILL chr_SkillCap
@ONADVANCESTAT chr_StatCap
}
Code: Select all
/*-------------------------------------------------------
|| System name: Sistema de Classes
|| Version: 1.0-r2 Last update: 12/10/2003 18:51:46
|| This script was made for it "Idade das Trevas Online RPG Shard"
|| Site: http://idt.megariomafra.with.br
|| Forum: www.megariomafra.with.br/forum
|| Written for: Ricardo Lüders (XAngel)
|| e-mail: xangel@bol.with.br
|| General Public License (GPL)
-------------------------------------------------------*/
// Only some definitions for use in scripts
#define AF_CLASSE 0
#define NUM_DE_CLASSES 6
/*----------------------------------------------
|| Last update: 12/10/2003 18:56:43
|| Description: System Class' Arrays
----------------------------------------------*/
new const max_caps[NUM_DE_CLASSES][2] = {
// StatCap, SkillCap
{ 180, 400 }, // Unused
{ 180, 400 }, // Man of Weapons
{ 180, 400 }, // Arcane
{ 180, 400 }, // Smart
{ 180, 400 }, // Priest
{ 180, 400 } // Merchant
};
new const statcap[NUM_DE_CLASSES][3] = {
// Dex, Int, Str
{ 1000, 1000, 1000 }, // Unused
{ 60, 40, 85 }, // Man of Weapons
{ 60, 85, 40 }, // Arcane
{ 10, 10, 10 }, // Smart
{ 85, 40, 60 }, // Priest
{ 70, 65, 50 } // Merchant
};
new const skillcap[NUM_DE_CLASSES][49] = {
/*
Alchemy, Anatomy, Animal Lore, Item ID, Arms Lore, Parrying, Begging, Blacksmithing,
Bowcrafting/Fletching, Peacemaking, Camping, Carpentry, Cartography, Cooking, Detect Hidden, Enticement,
Evaluate Intellect, Healing, Fishing, Forensic Evaluation, Herding, Hiding, Provocation, Inscription,
Lockpicking, Magery, Magic Resistance, Tactics, Snooping, Musicianship, Poisoning, Archery, Spirit Speaking,
Stealing, Tailoring, Animal Taming, Taste Identification, Tinkering, Tracking, Veterinary, Swordsmanship
Macefighting, Fencing, Wrestling, Lumberjacking, Mining, Meditation, Stealth, Remove Traps
*/
// Unused
{ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100 },
// Man of Weapons
{ 350, 0, 0, 0, 350, 500, 0, 350, 350, 0, 350, 350, 350, 350, 500, 0, 0, 350, 350, 0, 350, 350, 0, 0, 0, 0, 500, 500, 0, 0, 0, 500, 0, 0, 0, 0, 0, 350, 350, 0, 500, 500, 500, 500, 0, 0, 0, 0, 350 },
// Arcane
{ 350, 350, 0, 350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 350, 0, 0, 500, 0, 500, 500, 350, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 350, 350, 0, 0, 0, 0, 500, 0, 0 },
// Smart
{ 350, 0, 0, 0, 350, 500, 0, 350, 350, 0, 350, 350, 350, 350, 500, 0, 0, 350, 350, 0, 350, 350, 0, 0, 0, 0, 500, 500, 0, 0, 0, 500, 0, 0, 0, 0, 0, 350, 350, 0, 500, 500, 500, 500, 0, 0, 0, 0, 350 },
// Priest
{ 0, 500, 0, 350, 0, 500, 500, 0, 0, 0, 0, 0, 500, 0, 500, 0, 350, 350, 0, 350, 0, 500, 350, 0, 500, 0, 500, 500, 500, 0, 500, 350, 0, 500, 0, 0, 0, 500, 0, 0, 0, 0, 500, 350, 0, 0, 0, 500, 500 },
// Merchant
{ 500, 0, 500, 500, 500, 0, 0, 500, 500, 500, 500, 500, 500, 500, 500, 0, 0, 0, 500, 500, 500, 0, 0, 500, 0, 0, 500, 500, 0, 0, 0, 500, 0, 0, 500, 500, 500, 500, 500, 500, 500, 500, 0, 500, 500, 500, 500, 0, 0 }
};
/*----------------------------------------------
|| Function: chr_getClass
|| Last update: 28/11/2003 13:50:30
|| Description: This function is used for identify char's class
|| Override.spc: n/a
|| Other event: n/a
----------------------------------------------*/
public chr_getClass(const chr)
{
new classe = [b]chr_getAmxFlags(chr, 0);[/b]
return classe;
}
/*----------------------------------------------
|| Function: chr_StatCap
|| Last update: 28/11/2003 13:50:30
|| Description: This function is used for block Char's stat
|| Override.spc: n/a
|| Other event: @ONSTATADVANCE
----------------------------------------------*/
public chr_StatCap(const chr, const stat, const skill, const atual)
{
new classe = chr_getClass(chr); // Identify the Class
new stata = 0;
printf("Classe Numero: %d", classe);
switch (stat)
{
case STATCAP_DEX:
stata = 0;
case STATCAP_INT:
stata = 1;
case STATCAP_STR:
stata = 2;
}
new max_total = max_caps[classe][0];
new max_stat = statcap[classe][stata]; // Statcap
new total_stat = (chr_getDex(chr) + chr_getInt(chr) + chr_getStr(chr));
if(total_stat >= max_total)
{
// Don't raise Stat
printf("Nao sobe stat");
return 0;
}
else
{
// Raise Stat
switch(stat)
{
case STATCAP_DEX:
return max_stat;
case STATCAP_INT:
return max_stat;
case STATCAP_STR:
return max_stat;
}
}
}
/*----------------------------------------------
|| Function: chr_SkillCap
|| Last update: 28/11/2003 13:50:30
|| Description: This function is used for block Char's skill
|| Override.spc: n/a
|| Other event: @OSKILLADVANCE
----------------------------------------------*/
public chr_SkillCap(const chr, const skill, const skillusada, const resultado)
{
new classe = chr_getClass(chr); // Identify the Class
printf("Classe Numero: %d", classe);
new maximo = skillcap[classe][skill]; // Skillcap
new valor = chr_getBaseSkill(chr, skill); // Get skill value
if (valor >= maximo) {
printf("Nao sobe skill");
nprintf(chr, "Voce nao pode mais evoluir esta skill");
return SKILLADV_DONTRAISE; // Don't raise
}
printf("Sobe skill...");
return SKILLADV_RAISE; // Raise
}
/*----------------------------------------------
|| Function: mnu_classe
|| Last update: 12/10/2003 19:12:02
|| Description: This function show class menu
|| Override.spc: StartChar=mnu_classe,AFTER
|| Other event: n/a
----------------------------------------------*/
public mnu_classe(const chr)
{
if ([b]chr_getAmxFlags(getCharFromSocket(chr), 0)[/b] != 0) { return; }
// Freeze the player
chr_setProperty(chr, CP_PRIV2, 0x02);
mnu_prepare(chr, 1, 5);
mnu_setStyle(chr, MENUSTYLE_STONE, 0x0);
mnu_setTitle(chr, "Escolha sua classe inicial");
// Conteúdo
mnu_addItem(chr, 0, 0, "Homem de Armas");
mnu_addItem(chr, 0, 1, "Arcano");
mnu_addItem(chr, 0, 2, "Sacerdote");
mnu_addItem(chr, 0, 3, "Ladino");
mnu_addItem(chr, 0, 4, "Mercante");
mnu_setCallback(chr, funcidx("bnt_mnu_classe"));
mnu_show(chr);
}
// This function is only button event for mnu_classe
public bnt_mnu_classe (const s, const pg, const idx) {
switch (idx) {
case 0:
homem_de_armas(getCharFromSocket(s));
case 1:
arcano(getCharFromSocket(s));
case 2:
sacerdote(getCharFromSocket(s));
case 3:
ladino(getCharFromSocket(s));
case 4:
mercante(getCharFromSocket(s));
default:
mnu_classe(getCharFromSocket(s));
}
}
/*======= The following functions are of definitions of the classes =======*/
// This function define class "Homem de Armas"
public homem_de_armas (const s) {
chr_SkillClean(s);
if(chr_getStr(s) >= 40) {
nprintf(s, "Classe escolhida: Homem de Armas");
[b] chr_setAmxFlags(s, 0, 1);[/b]
chr_setProperty(s, CP_PRIV2, 0x0);
SkilldaClasse(s);
}
else {
nprintf(s, "Voce deve ter no minimo 40 pontos de STR para ser um Homem de Armas");
mnu_classe(s);
}
}
// This function define class "Arcano"
public arcano (const s) {
chr_SkillClean(s);
if(chr_getInt(s) >= 40) {
nprintf(s, "Classe escolhida: Arcano");
[b] chr_setAmxFlags(s, 0, 2);[/b]
chr_setProperty(s, CP_PRIV2, 0x0);
SkilldaClasse(s);
}
else {
nprintf(s, "Voce deve ter no minimo 40 pontos de INT para ser um Arcano");
mnu_classe(s);
}
}
// This function define class "Sacerdote"
public sacerdote (const s) {
chr_SkillClean(s);
nprintf(s, "Classe temporariamente desabilitada.");
mnu_classe(getCharFromSocket(s));
/*
if(chr_getInt(s) >= 30) {
nprintf(s, "Classe escolhida: Sacerdote");
[b] chr_setAmxFlags(s, 0, 3);[/b]
chr_setProperty(s, CP_PRIV2, 0x0);
SkilldaClasse(s);
}
else {
nprintf(s, "Voce deve ter no minimo 30 pontos de INT para ser um Sacerdote");
mnu_classe(s);
}
*/
}
// This function define class "Ladino"
public ladino (const s) {
chr_SkillClean(s);
if(chr_getDex(s) >= 40) {
nprintf(s, "Classe escolhida: Ladino");
[b] chr_setAmxFlags(s, 0, 4);[/b]
chr_setProperty(s, CP_PRIV2, 0x0);
SkilldaClasse(s);
}
else {
nprintf(s, "Voce deve ter no minimo 40 pontos de DEX para ser um Ladino");
mnu_classe(s);
}
}
// This function define class "Mercano"
public mercante (const s) {
chr_SkillClean(s);
nprintf(s, "Classe escolhida: Mercante");
[b] chr_setAmxFlags(s, 0, 5);[/b]
chr_setProperty(s, CP_PRIV2, 0x0);
SkilldaClasse(s);
}
/*======= end =======*/
/*----------------------------------------------
|| Function: SkilldaClasse
|| Last update: 12/10/2003 18:42:43
|| Description: This function is used for set Class' Skills
|| Override.spc: n/a
|| Other event: n/a
----------------------------------------------*/
public SkilldaClasse(const chr)
{
new i;
for(i = 0; i <= 4; i++)
{
new classe = chr_getClass(chr); // Idetify the Class
new aleatorio = random(49);
new atual = chr_getBaseSkill(chr, aleatorio);
if(skillcap[classe][aleatorio] != 0 && atual < skillcap[classe][aleatorio]) {
chr_setBaseSkill(chr, aleatorio, 100);
}
else {
i--;
}
}
}
/*----------------------------------------------
|| Function: chr_SkillClean
|| Last update: 12/11/2003 23:10:24
|| Description: This function is used for Clean Skills
|| Override.spc: n/a
|| Other event: n/a
----------------------------------------------*/
public chr_SkillClean(const chr)
{
new i;
for(i = 0; i <= 49; i++) {
chr_setSkill(chr, i, 0);
chr_setBaseSkill(chr, i, 0);
}
}
Ty!
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
It looks like you are wanting to use a "miscellaneous" or custom variable.
UOX3 has a system implemented in JavaScript to allow you do just that.
try mChar.SetTag( "Class", classNum ) and classNum = mChar.GetTag( "Class" )
Note that you can use as many of these tags and call them whatever you like.
UOX3 has a system implemented in JavaScript to allow you do just that.
try mChar.SetTag( "Class", classNum ) and classNum = mChar.GetTag( "Class" )
Note that you can use as many of these tags and call them whatever you like.
Scott
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
Well personally I learn the best by seeing how others do it, if you are like me, then perhaps an example would be best.
If you have downloaded UOX3 already, look in the /js/commands/targeting/ folder for gumps.js otherwise just follow this link http://cvs.sourceforge.net/viewcvs.py/o ... iew=markup
That's a pretty full-featured gump there.
If you have downloaded UOX3 already, look in the /js/commands/targeting/ folder for gumps.js otherwise just follow this link http://cvs.sourceforge.net/viewcvs.py/o ... iew=markup
That's a pretty full-featured gump there.
Scott