Page 1 of 1

Fire Gecko Pelts

Posted: Sat Apr 03, 2004 6:22 am
by SpellTrap
I've made a script for fire geckos so that they should drop fire gecko pelts, another thing I made. One problem: no matter what item's PID I tell it to create in their inventory, it creates a golden gecko pelt. Here's the modified code, tell me if you see any errors. If you can't find any errors in this, any idea where the error would be? Also, this causes the display to say "You see: Gecko" instead of "Fire Gecko" or "Tough Fire Gecko". Thoughts?

Code: Select all

/*
        Name: FIRE GECKO
        Location: Random Encounters
        Description:

        Log:
           Please note any changes that have been made to the file in Updated. Then comment
           the code which you have changed/altered/commented out. Please, do not delete any
           code which was written.

           Created:

           Updated:
*/

/* Include Files */

/* Note, the Following Lines need to be in this order so that
   the script will be compilable. The define Name is referenced
   in a module from define.h and used in command.h. Please do
   not change the ordering.
        -rwh2   11/13/97
*/
#include "..\headers\define.h"
//#include "..\headers\<TownName.h>"

#define NAME                    SCRIPT_ZCFGECKO

#include "..\headers\command.h"

#define MIN_RAD_DAMAGE          &#40;1&#41;
#define MAX_RAD_DAMAGE          &#40;3&#41;

/* Standard Script Procedures */
procedure start;
procedure critter_p_proc;
procedure combat_p_proc;
procedure pickup_p_proc;
procedure destroy_p_proc;
procedure use_skill_on_p_proc;
procedure map_enter_p_proc;

/* Script Specific Procedure Calls */
procedure Node998;                                      // This Node is Always Combat
procedure Node999;                                      // This Node is Always Ending


// The next lines are added in by the Designer Tool.
// Do NOT add in any lines here.
//~~~~~~~~~~~~~~~~ DESIGNER TOOL STARTS HERE

procedure Node001;

//~~~~~~~~~~~~~~~~ DESIGN TOOL ENDS HERE
// The Following lines are for anything that is not needed to be
// seen by the design Tool



/* Imported variables from the Map scripts. These should only be
   pointers and variables that need not be saved. If a variable
   Needs to be saved, make it a map variable &#40;MVAR_&#41; */


/* Local variables which do not need to be saved between map changes. */
variable Only_Once&#58;=0;

procedure start begin
end

/* This procedure will get called each time that the map is first entered. It will
   set up the Team number and AI packet for this critter. This will override the
   default from the prototype, and needs to be set in scripts. */
procedure map_enter_p_proc begin
   Only_Once&#58;=0;
   critter_add_trait&#40;self_obj,TRAIT_OBJECT,OBJECT_TEAM_NUM,TEAM_GECKO&#41;;
   critter_add_trait&#40;self_obj,TRAIT_OBJECT,OBJECT_AI_PACKET,AI_GECKO&#41;;
end


procedure critter_p_proc begin

/* If the critter is mad at the player for any reason, it will attack and remember to attack
   the player should the game be saved and loaded repeatedly. Additionally, if any special
   actions need to be taken by the critter based on previous combat, the critter will remember
   this as well. */

   if &#40;obj_can_see_obj&#40;self_obj,dude_obj&#41;&#41; then begin
       attack&#40;dude_obj&#41;;
   end

   if &#40;random&#40;0,200&#41; == 1&#41; then begin
       animate_move_to_tile&#40;tile_num_in_direction&#40;tile_num&#40;self_obj&#41;,random&#40;0,5&#41;,random&#40;3,7&#41;&#41;&#41;;
   end

end

procedure combat_p_proc begin

   variable rads;

   if &#40;fixed_param == COMBAT_SUBTYPE_HIT_SUCCEEDED&#41; then begin
      if &#40;target_obj == dude_obj&#41; then begin
         if &#40;not&#40;is_success&#40;do_check&#40;dude_obj,STAT_lu,-1&#41;&#41;&#41;&#41; then begin
            rads&#58;=random&#40;MIN_RAD_DAMAGE,dude_level*MAX_RAD_DAMAGE&#41;;
            if &#40;rads > 5&#41; then
               rads&#58;=5;
            if &#40;&#40;cur_town == AREA_KLAMATH&#41; or &#40;cur_town == AREA_KLAMATH_TOXIC_CAVES&#41;&#41; then begin
               rads&#58;=random&#40;0,1&#41;;
            end
            radiation_inc&#40;target_obj,rads&#41;;
         end
      end
   end

end

/* Whenever the critter takes damage of any type, this procedure will be called. Things
   like setting ENEMY_ and LVAR_Personal_Enemy can be set here. */
procedure damage_p_proc begin

/* If the player causes damage to this critter, then he will instantly consider the player
   his personal enemy. In Critter_Proc or through dialog, actions will be taken against
   the player for his evil acts. */

   attack&#40;source_obj&#41;;

end

/* Any time that the player is caught stealing from this critter, Pickup_proc will be called.
   In here, various things can happen. The most common response is instant hostility which
   will be remembered. */
procedure pickup_p_proc begin
   attack&#40;source_obj&#41;;
end


/* This procedure gets called only on the death of this NPC. Special things like
   incrementing the death count for reputation purposes and Enemy Counters are placed
   in here. */
procedure destroy_p_proc begin
   variable item;

   if &#40;has_trait&#40;TRAIT_PERK,dude_obj,PERK_gecko_skinning_perk&#41;&#41; then begin
       item &#58;= create_object&#40;PID_FIRE_GECKO_PELT,0,0&#41;;
       add_obj_to_inven&#40;self_obj,item&#41;;
   end
end


/* Any time a skill is used on a critter this call is made. This can be to give examinations
   for things like Doctor skill or messages for various other skills. */
procedure use_skill_on_p_proc begin
end

/* Should the Player ever cause the NPC too much discomfort that he desires to attack the player,
   this call will be made. Essentially, it stores the Hostile vaule so that the critter remembers
   he was once hostile towards the player.*/
procedure Node998 begin
end

/* Anytime that there is a need for an ending to dialog, this node is to be called. It will just
   exit from the dialog system without any reprisals from the NPC. */
procedure Node999 begin
end


// Not lines are allowed to be added below here
// The Following lines are from the Design Tool
//~~~~~~~~~~~~~~~~ DESIGN TOOL STARTS HERE

procedure Node001 begin
end

//xxxxxxxxxxxxxxxxxxxx
Any ideas where the problem is?

Posted: Mon Apr 05, 2004 7:55 am
by Kashluk
I really have no idea. The script seems just fine... Maybe check if the game is using some other file, from some other source? I really don't know what could be causing this. Also, check that the Fire Gecko pelt is named / looks like a fire gecko pelt. The script might be working but you're not just seeing it correctly?

Posted: Tue Apr 06, 2004 1:53 am
by SpellTrap
It turns out I needed to tweak ecgecko, which is the script that random encounter fire geckos use.