PenUltima Online

It is currently Fri Sep 05, 2008 4:58 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Crafter Gate
PostPosted: Fri Dec 29, 2006 6:01 pm 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
Hi People,

i have a problem with a script..

craftermine.src

Code:
use os;
use uo;

include "include/classes";

program minocgate (who)

var crafter := GetObjProperty (who,"IsCrafter");

if (crafter)
MoveCharacterToLocation( who, 6001, 1519, 0 );
SendSysMessage( who, "Welcome to Crafter Area!",3,63);
else
SendSysMessage( who, "You must be qualified as a crafter to enter in the Crafter Area",3,33);
endif

endprogram



This script verify if the player is a crafter...

but i want that this script verify if the player have minimum 3 crafter skills higher 129... to can enter in arena...

can anyone help me?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 30, 2006 4:08 pm 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
thanks for help

:sad:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 30, 2006 7:15 pm 
Offline

Joined: Wed May 10, 2006 5:15 pm
Posts: 113
The problem is that you're expecting us to write your code for you. Most people are busy writing their own scriptbases, and don't have time to write yours for you.

But, just to push you in the right direction, what I would do is:

  1. Write a config file containing the skills that I want to be considered "CraftSkills" as entrys.
    Code:
    CraftSkills SkillList
    {
       SkillID      0 // The Skill ID
       AttributeID   Alchemy   // The Skill Name
       // etc.
    }

  2. Write an include file to externalize access to the file.
    [b]IsCrafter.inc[b]
    Code:
    ...
    function IsCraftSkill( skill )
       var craft_skill_cfg := ReadConfigFile("CraftSkills");
       craft_skill_cfg := craft_skill_cfg["SkillList"];
       var craft_skill_list;
       if( Type(skill) == Type("") )
          craft_skill_list := GetConfigIntArray(craft_skill_cfg,"SkillID");
       elseif( Type(skill) == Type(0) )
          craft_skill_list := GetConfigStringArray(craft_skill_cfg,"AttributeID");
       endif

       if( skill in craft_skill_list )
          return 1;
       endif
       return 0;
    endfunction

    function IsCrafter(byref who)
       var craft_skill_cfg := ReadConfigFile("CraftSkills");
       craft_skill_cfg := craft_skill_cfg["SkillList"];
       var craft_skill_list := GetConfigIntArray(craft_skill_cfg,"AttributeID");
       var num_skills;
       foreach craft_skill in craft_skill_list
          if( GetAttribute(craft_skill) > 12900 ) // 129 * 100
             num_skills := num_skills + 1;
          endif
       endforeach
       if( num_skills >= 3 )
          return 1;
       endif
       return 0;
    endfunction

  3. Use it.
    Code:
    ...
    // var crafter := GetObjProperty (who,"IsCrafter");
    var crafter := IsCrafter(who);
    ...


I know that I just contradicted myself and wrote it for you; but it's imperfect, and I'll leave the debugging and fixing to you.

In the future, please try harder to move away from being a Type1 POL User.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 6:27 am 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
it dont work :(

if you want... i have other script..

Code:
Use os;
Use uo;

Include "include/client";
Include "include/classes";

Program Gate_Crafters( who )

    Var level;

    Foreach classe in GetClasseIds()
    EraseObjProperty( who , classe );
    level := IsFromThatClasse( who , GetClasseSkills(classe) );
    If( level )
    SetObjProperty( who, classe, level );
    Endif
    Endforeach

    Var CLvl := GetLevel( Who );

    If( IsCrafter( who ) && CLvl >= 3 )
    MoveCharacterToLocation( who, 1260, 1243, 0 );
    SendSysMessage( who, "Welcome to the Crafters Mine.", FONT_BOLD, 2600 );
    SendSysMessage( who, "This is a No-Pk/Looting Zone!", FONT_BOLD, 2611 );
    Else
    SendSysMessage( who, "You must be a Level 3 Crafter to enter.", FONT_BOLD, 2611 );
    Endif

EndProgram

Function GetLevel( Who )

    Var level;

    Foreach classe in GetClasseIds()
    EraseObjProperty( who , classe );
    level := IsFromThatClasse( who , GetClasseSkills(classe) );
    If( level )
    SetObjProperty( who, classe, level );
    Return level;
    Endif
    Endforeach

EndFunction


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 9:01 am 
Offline

Joined: Mon Dec 25, 2006 6:33 am
Posts: 44
error in function iscrafter (byref who)

getintarray and getstringarray is not definied..

o.O


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 31, 2006 5:39 pm 
Offline

Joined: Wed May 10, 2006 5:15 pm
Posts: 113
Config.em Documentation.

Those two pieces are my fault; but there's only two commands in the entire core command list that resemble that, that I am aware of. And given their context, they shouldn't be hard to find.

I've already outlined your system for you; please don't expect me to perfect it for you, too.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl