Inside3D!
     

coding/loading specific entities through a script file?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Tue Oct 14, 2008 9:40 pm    Post subject: Reply with quote

man... i feel retarded ... but i started out by putting dpextentions into my progs list... and iv already gotten an error just from this....

Code:
error: Q521: dpextensions.qc:384:MOVETYPE_BOUNCEMISSILE redeclared (see previous declaration defs.qc(256))


EDIT: i got it to compile nvm stupidity on my part i was right im retarded. Razz
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Tue Oct 14, 2008 10:51 pm    Post subject: Reply with quote

I think you need to comment out (or delete) the definition of MOVETYPE_BOUNCEMISSILE in defs.qc. I think there were a couple of quirks like that, and I can't find any install instructions for dpextensions.qc in the DP readme or the .qc itself.

Basically, add it to your progs.src right after defs.qc (which I assume you've done), and then if there are any conflicts with defs.qc etc you'll need to resolve those. I think you just need to remove the bouncemissile definition in defs.qc (as said above), I can't remember any other steps. But, if you have other troubles let us know and we'll help.

Code:

in defs.qc:
float   MOVETYPE_BOUNCEMISSILE   = 11;   // bounce with extra size

should be

//float   MOVETYPE_BOUNCEMISSILE   = 11;   // bounce with extra size

_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Tue Oct 14, 2008 11:08 pm    Post subject: Reply with quote

what i did , was add it to the bottem of the list and i went into conquests src and got the 0defs.qc and added it above dpextensions and it compiled. is that bad?

EDIT: i did it your way just incase to make sure everything will work properly.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Wed Oct 15, 2008 12:42 am    Post subject: Reply with quote

Well, it's best to have it right after defs.qc so that all the other files in the project can use the things defined in dpextensions.qc. dpextensions is basically an extension of defs.qc to add those special features, so it goes right after it in progs.src.

Conquest's 0defs.qc is actually all custom stuff for Conquest, and probably shouldn't go into your mod because it won't help anything. It's not going to break it, but it'll create a whole bunch of extra variables etc that your code won't be using. Smile
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 1:16 am    Post subject: Reply with quote

alright, i did it the way u said lol Razz

although iv been trying to install the custom ents mod and im having issues with it, first i only wanted a couple of the features it had so i didnt add all the qc's and i kept getting errors so i decided to add all of the features from hipnoics and custents but i keep getting this error....

unkown value become big explosion.

Code:
/* Breakaway walls QuickC program
   By Jim Dose'  9/11/96
   Modified by General WarT
*/

float MULTI_USE = 1;
float INVISIBLE = 2;

void() damagethreshold_killed =
{
   self.health = self.max_health;

   activator = damage_attacker;
   self.takedamage = DAMAGE_NO;
   SUB_UseTargets ();
   self.takedamage = DAMAGE_YES;

   if ( !( self.spawnflags & MULTI_USE ) )
   {
      remove( self );
   }
};

void() damagethreshold_pain =
{
   self.health = self.max_health;
};

/*QUAKED trigger_damagethreshold (0 .5 .8) ? MULTI_USE INVISIBLE
Triggers only when a threshold of damage is exceeded.
When used in conjunction with func_breakawaywall, allows
walls that may be destroyed with a rocket blast.

MULTI_USE tells the trigger to not to remove itself after
being fired.  Allows the trigger to be used multiple times.

INVISIBLE tells the trigger to not be visible.

"health" specifies how much damage must occur before trigger fires.
Default is 60.

*/

void() trigger_damagethreshold =
{
   self.mangle = self.angles;
   self.angles = '0 0 0';

   self.classname = "damagethreshold";
   self.solid = SOLID_BSP;
   self.movetype = MOVETYPE_PUSH;
   setorigin (self, self.origin);
   setmodel (self, self.model);
   setsize (self, self.mins , self.maxs);
   if ( self.spawnflags & INVISIBLE )
   {
      self.model = string_null;
   }

   if (!self.health)
   {
      self.health = 60;
   }
   self.max_health = self.health;
   self.takedamage = DAMAGE_YES;

   self.blocked = SUB_Null;
   self.th_pain = damagethreshold_pain;
   self.th_die  = damagethreshold_killed;
};

// ### Added feature for Custents
// allows the break down of walls using the func_counter and also
// the make the breakawaywalls optionally trigger another entity and/or
// blow up when they are triggered.
void() func_breakawaywall_use =
{
   local float which, index;

   if(self.cnt != 0)
   {
      if(counter_GetCount (other) != self.cnt)
         return;
   }
   
   // positions it for correct placement of explosion stuff
   self.use = SUB_Null;
   self.movetype = MOVETYPE_NONE;
   self.solid = SOLID_NOT;
   setorigin(self, self.neworigin);

   if (self.spawnflags & 2) // use particles
   {
      WriteByte (MSG_BROADCAST,SVC_TEMPENTITY);
      WriteByte (MSG_BROADCAST,TE_EXPLOSION);
      WriteCoord (MSG_BROADCAST,self.origin_x);
      WriteCoord (MSG_BROADCAST,self.origin_y);
      WriteCoord (MSG_BROADCAST,self.origin_z);
   }

   if(self.target)
      SUB_UseTargets();

//   allows it to throw rubble when it explodes.
   if(self.count)
   {
      self.cnt = 0;
      rubble_use();
   }

   if (self.spawnflags & 1) // become explosion
   {
      BecomeBigExplosion();
//      BecomeExplosion();
      sound (self, CHAN_VOICE, "misc/shortexp.wav", 1, ATTN_NORM);
   }
   else
      remove(self);
};
// ###

/*QUAKED func_breakawaywall (0 .5 .8) ?
Special walltype that removes itself when triggered.
*/

void() func_breakawaywall =
{
   self.mangle = self.angles;
   self.angles = '0 0 0';

   self.classname = "breakaway";
   self.solid = SOLID_BSP;
   self.movetype = MOVETYPE_PUSH;
   setorigin (self, self.origin);
   setmodel (self, self.model);
   setsize (self, self.mins , self.maxs);
// ### Added features for Custents
   self.use = func_breakawaywall_use;
   
   // the origin in the center for explosion stuff
   self.neworigin = (self.absmin + self.absmax)*0.5;

   
   if (self.spawnflags & 1) // become explosion
      precache_sound ("misc/shortexp.wav");

// allows it to throw rubble when it is triggered.
   if(self.count)
   {
      precache_model ("progs/rubble1.mdl");
      precache_model ("progs/rubble2.mdl");
      precache_model ("progs/rubble3.mdl");
      precache_sound ("zombie/z_hit.wav");
      if(self.skin < 0)
         self.skin = floor(random()*14);
   }
// ###
};

_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Wed Oct 15, 2008 3:30 am    Post subject: Reply with quote

Well, assuming you have all the files added properly, you could just add this line to the top of that file and see if that fixes it.

Code:
void() BecomeBigExplosion;

_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 6:56 am    Post subject: Reply with quote

OH! an old developer friend of mine from where i learned to model has sent me some script files for the rpg mod i used to play when i used to like hl1 lol....

anyways here's a couple "just wanting to know if i could do them like this" - or atleast close to it, (if it has to do with anything im using old style quake 1 models no md3's or nething)


Monster
Code:
//How to build a monster: basic
//( Last update: FEB2008a )
//
//What we are going to create here is a basic orc with a fire blade
{
   //MAIN PRE-LOAD SECTION
   //all vars here are loaded before the monster spawns
   //the following vars must be defined
   //note the const/setvar/setvard should be consistent here
   //or it may not play nice with the base AI
   //setvard's here do not take effect until after spawn

   //this is the monsters attack animation from the model
   //if the attack type varies, simply set this again during
   //npc_selectattack
   setvard ANIM_ATTACK attack1

   //These are setvar (preload), as they often  get defined in npc_spawn (see below)
   //They must all be set
   setvar ANIM_RUN run   //walk anim
   setvar ANIM_WALK walk   //run anim
   setvar ANIM_IDLE idle1   //idle anim
   
   //- MOVE_RANGE
   //- monster will try to get thise close to the player
   //- it should be greater than the monster width (defined in npc_spawn below)
   setvard MOVE_RANGE 64

   //- ATTACK_RANGE
   //when the monster gets this close, it will play ANIM_ATTACK
   //should always be a bit more than MOVE_RANGE
   setvard ATTACK_RANGE 80

   //- ATTACK_HITRANGE
   //This is the actual range of the attack
   //should be at least monster height + 38
   //and at least 150% ATTACK_RANGE
   //if a player is above or below a monster, the monster will substitute
   //this number for ATTACK_RANGE
   //as otherwise players can jump on monster's heads and be safe
   setvard ATTACK_HITRANGE 120

   //optional: flinch
   setvard ANIM_FLINCH flinch //anim to play when flinching
   setvard FLINCH_DAMAGE_THRESHOLD 30 //min damage needs to be done to make flinch (defaults to 10% hp)
   setvard FLINCH_CHANCE 50 //%chance of flinching each time
   setvard FLINCH_DELAY 5.0 //delay between flinches (5.0 is actually the default, just putting it here to shown it can be set)

   //optional: drop gold - this lets the base_monster_shared script adjust gold drops
   setvard DROP_GOLD 1 //set 1 to drop gold
   setvard DROP_GOLD_AMT $rand(5,15) //amount of gold to drop

   const SOUND_DEATH voices/orc/die.wav
   precache SOUND_DEATH   //sound death is played by the included (lower) script base_npc instead of here
                     //thus it must be precached or it will not play
                     //precaches are done pre-load, no matter where you put them in the script
                     //(they also work inside comment blocks, so beware)

   //These vars can be named anything you like
   //as they are used only by the top script (ie. this one, and not the lower includes):
   //any values that never change should be const
   //values that change should be setvard
   //if you need an adjustable value in npc_spawn
   //it must be a setvar - or it will not be set until after spawn
   const ANIM_SWING swordswing1_L
   const ANIM_SMASH battleaxe_swing1_L
   const ANIM_PARRY deflectcounter

   //note on these two: since they are constants, they will be replaced during "live" compile with
   //their litteral strings, if they were setvard, they would instead contain the random number selected at this point
   const DMG_SWING $rand(20,40)
   const DMG_SMASH $rand(30,50)

   const ATTACK_HITCHANCE 80   //chance to hit per swing in this script

   const BURN_CHANCE 25      //chance to burn with overhead attack (custom on this tutorial monster)

   //custom sounds
   const SOUND_HELP "voices/orc/help.wav"
   const SOUND_ATTACK1 "voices/orc/attack.wav"
   const SOUND_ATTACK2 "voices/orc/attack2.wav"
   const SOUND_ATTACK3 "voices/orc/attack3.wav"

   const SOUND_STRUCK1 "body/armour1.wav"
   const SOUND_STRUCK2 "body/armour2.wav"
   const SOUND_STRUCK3 "body/armour3.wav"
   const SOUND_PAIN "monsters/orc/pain.wav"
}

#include monsters/base_monster_new
//This includes by recursion the following scripts:
//monsters/base_monster_shared - basic monster functions (drop stuff on death, etc)
//monsters/base_npc - basic npc functions (death sequences, blood, etc.)
//monsters/base_npc_attack_new - main AI
//monsters/base_anti_stuck - anti-stuck system
//monsters/externals - functions shared by all dynamic NPCs
//- do not include these individually, they are dependant on one another’s function
//- However, if you want an NPC that doesn't do anything but die
//- You can include only monsters/base_npc
//- we'll have another file to teach how to build basic interactive NPCs in the future

{ npc_spawn

   //this event is called from base_npc from the dll event: game_spawn
   //this is the secondary preload, so everything here is loaded before spawn as well
   //only setvar and const variables are defined at this point
   //setvard's are not initialized until the monster actually spawns
   //any timed events called from here, however, take place just after spawn

   name a|Basic Monster      //a| is a gramar seperator for hud reports, an|Orc, a|Goblin, a set of|Gauntlets, etc.

   race orc               //creatures faction (see \races.script for behaviors)
                        //normally we would use monsters/orc_base to make an orc, but for the sake of this example, we'll do it all here

   hp 320                  //how much health

   setmodel "monsters/orc.mdl"   //which model to use - remember: media extensions define the root folders, so you ommit sound/ models/ sprites/ etc.
   width 32               //width
   height 72               //height - note that creatures shorter than this are easy to get on top of
                        //sometimes the 'shape' of a monster will allow players to 'climb' it
                        //height and width are ignored for projectiles and erratic lightning - the model's hitboxes are used instead
   takedmg all 0.7            //armor: multiplier reduces/increases incoming damage (30% armor here)
   takedmg fire 0.25         //this makes the creature takes 75% fire resistant
   takedmg cold 1.5         //this makes him take 150% damage from cold attacks
                        //monsters/base_npc automatically sets takedmg holy 0.0 (immune) for all but undead and demon races

   setstat parry 50         //parry skill (works differently than players, must be > 100% to have real good parry)

   saytextrange 1024         //how far away the monsters saytext statements can be heard
                        //if this is not set, it defaults to 320

   //setup model body
   //if you want to make this variable, you want to use npc_post_spawn instead
                     //These are the model bodys for monsters/orc.mdl (going using, cap, sword)
                     //remember submodels # from 0 in scripts, but from 1 in Jed's HLMV
      setmodelbody   0 2      //Body 0=naked 1=leather 2=plate 3=green-hide
      setmodelbody   1 1      //Head 0=cap_shorthorn 1=cap_nohorn 2=Buffalo_skin 3=cheif_ramhorns 4=green_hood
      setmodelbody   2 4      //Weapon 0=fist 1=axe 2=bow_weak 3=bow_strng 4=sword 5=bloodyaxe 6=sword&sheild

   callevent 0.1 bmonster_yell   //this is an example custom at spawn event
}

{ bmonster_yell
   playsound 0 10 SOUND_HELP //playsound <channel> <volume> <sound> //generally channel 0 (auto-select) is best, volume is 1-10
   saytext "Help! Intruders!"
}

{ npc_post_spawn

   //this event is called immediately after spawn from monsters/base_monster_shared

   //set the basic animations:
   //- these can be, and often are, set in npc_spawn
   //- hoping to do away with this in the future, as it causes issues
   //- so it's better form to set it here
   setmoveanim ANIM_RUN
   setidleanim ANIM_IDLE
}

{ npc_selectattack //called from monsters/base_npc_attack_new->npcatk_attack, whenever monster is within ATTACK_HITRANGE and can see enemy

   local RND_ATTACK $rand(1,2)      //locals are only kept within individual events
   if ( RND_ATTACK == 1 ) setvard ANIM_ATTACK ANIM_SWING   //note: spacing is important here, scripts parse by spaces
   if ( RND_ATTACK == 2 ) setvard ANIM_ATTACK ANIM_SMASH
}

{ game_damaged //PARAM1=attacker PARAM2=dmg PARAM3=dmg_type

   //this DLL event is called whenever a monster takes damage
   //play one of these sounds randomly ("none" comes out silent)
   playrandomsound 0 8 SOUND_PAIN SOUND_PAIN2 none none
}

{ game_death

   //this goofie bit here is just to give an common example as how the $get(ent,property) command works
   local SLAYER_NAME $get(ent_laststruck,name)
   saytext SLAYER_NAME "killed me! Oh the embarasment!"
}

{ npc_flinch

   //called from base_npc_attack_new->npcatk_checkflinch if monster flinches
   //you can reset the flinch animation here if you'd like, it's played by the base just after this
   playsound 0 10 SOUND_PAIN

   local PWNER_NAME $get(ent_laststruck,name)
   stradd PWNER_NAME ","
   saytext PWNER_NAME "why must you hurt me so!?"
   //this little trick will pull the name of the last guy who hit him, and add a comma to the end so you get
   //Saint_Thoth, why must you hurt me so!?
   //Remember, all vars in scripts are techincally strings
   //so you can use stradd to add letters to strings, and compare numbers via string operators, etc.
}

{ game_parry

   //dll event called whenever monster parries an attack

   playsound 0 10 SOUND_STRUCK1

   playanim once ANIM_PARRY
   setvard AS_ATTACKING game.time
   //note: whenever you force an animation that doesnt involve moving
   //you need to set AS_ATTACKING to game.time or more (based on the length of the animation)
   //as otherwise anti-stuck will think the monster is stuck, and cause him to attempt to free himself
}

//animation events
//these events are called from the model via event 500 or 600
//you can examine the models in detail to see event names using
//Jed's HLMV: http://www.wunderboy.org/apps/jhlmv.php
{ swing_sword //called from anim swordswing1_L @ frame #14

   //standard attack damage method: callevent npcatk_dodamage <target> <range> <dmg> <cth%> [type]
   callevent npcatk_dodamage NPCATK_TARGET ATTACK_HITRANGE DMG_SWIPE ATTACK_HITCHANCE slash
   setvard BURN_ATTACK 0 //tells game_dodamage below that this is not a fire attack
   //note, on the new ai, the latest target is always stored in NPCATK_TARGET
   //on the older, it is HUNT_LASTTARGET, but it is updated less often
   //they both store their last set attack target in both those vars for compatiblity

}

//The slower overhead swing:
{ swing_axe //called from anim battleaxe_swing1_L @ frame #22

   callevent npcatk_dodamage NPCATK_TARGET ATTACK_HITRANGE DMG_SMASH ATTACK_HITCHANCE slash
   setvard BURN_ATTACK 1 //tells game_dodamage below to set the target on fire, if this hits
}

//This bit is a little advanced
//- we are giving him a 25% chance to set a target on fire with his secondary (overhead) swing, if he hits with it
{ game_dodamage //PARAM1=hit:0|1 PARAM2=ent_hit PARAM3=(start) PARAM4=(end)

   //this dll event is called whenever the monster attempts to damage something
   if ( PARAM1 ) //PARAM1 will be 1 on a hit
   {
      if BURN_ATTACK
      if $rand(1,100) < BURN_CHANCE
      //you can see the paramaters for effects/effect_burn by opening the script
      //but the ones are are using here are <duration> <inflictor_id> <damage/sec>
      applyeffect PARAM2 effects/effect_burn 5.0 $get(ent_me,id) DMG_BURN
      //note that you cannot use simply "ent_me" here, as you are passing the var to another event
      //if you did so, the event would recieve it as the litteral string "ent_me" rather than this monster's ID
   }
   setvard BURN_ATTACK 0 //we must reset this to 0, or it'll try to burn every time the fire does damage as well
}



Generic Item

Code:

{
  const MODEL_WORLD   misc/p_misc.mdl
  const MODEL_HANDS   misc/p_misc.mdl
}

#include items/base_miscitem

{
   eventname miscitem_spawn

   name    a|Symbol of Felewyn (1 of 5)
   desc    First of the five symbols of Felewyn
}



An NPC


Code:


//Lighthouse keeper NPC for Dridge's Gwhatzitz map

#scope server

{
   const TEND_ANIMS "console;dryhands;writeboard;studycart;lean;pondering;pondering2;pondering3;buysoda;console;console;console;console;console;"

   const BASIC_REWARDS "<<a list of stuff he passes out>>"

   const NO_HAIL 1 //handle internally
   const NO_JOB 1 //handle internally
   const NO_RUMOR 1
   const CHAT_DELAY 4.5

   const ANIM_IDLE_CHAT idle1
}

#include monsters/base_chat

{ game_spawn

   name_unique lkeeper

   name Hyehold, the Lighthouse Keep
   hp 1
   invincible 1
   width 32
   height 72
   race beloved
   setmodel npc/human1.mdl
   setmodelbody 0 3 //apron
   setmodelbody 1 5 //baldie
   roam 0
   setmoveanim idle1
   hearingsensitivity 10
   saytextrange 1024

   setvard TENDING_HOUSE 1
   callevent 0.1 get_yaw //yaw is grabbed post spawn, so he knows where to face back to
   setvard MENU_MODE normal

   catchspeech say_hi hail yo j0 hi hello wassup greet

   catchspeech say_food food
   catchspeech say_crystal crystal
   catchspeech say_grave grave
   catchspeech say_spider spider
}

{ get_yaw
   setvard MY_YAW game.monster.angles.yaw
}

{ say_hi
   
   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG

   callevent say_intro   
}

{ face_speaker
   setvard TENDING_HOUSE 0 //stop tending
   setidleanim ANIM_IDLE_CHAT
   setmoveanim ANIM_IDLE_CHAT
}

{ say_intro

   if !BUSY_CHATTING
   if ( !WAS_STARTLED )
   {
      setvard WAS_STARTLED 1
      playanim critical eye_wipe
      setvard CHAT_STEPS 2
      setvard CHAT_STEP 0
      setvard BUSY_CHATTING 1
      setvard CHAT_STEP1 "Oh! Hello there!"
      setvard CHAT_STEP2 "Sorry for being so startled. It’s not very often I get visitors way up here."
      callevent chat_loop

      local NEXT_CHAT CHAT_DELAY
      multiply NEXT_CHAT CHAT_STEPS
      add NEXT_CHAT 0.5
      callevent NEXT_CHAT say_jobs
      local EXIT_SUB 1
   }
   if !EXIT_SUB
   if WAS_STARTLED
   playanim critical ANIM_IDLE_CHAT
   callevent say_jobs
}

{ say_jobs

   if !BUSY_CHATTING

   setvard CHAT_STEPS 2
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "It’s just me up here, and I’m getting on in years, so I often neglect many tasks..."
   callevent build_task_string
   setvard CHAT_STEP2 TASK_STRING
   callevent chat_loop
   callevent 2.0 convo_anim
   setvard MENU_MODE pick_quest
}

{ build_task_string
   setvard TASK_STRING "For instance, "
   if ( !DONE_SPIDER )
   {
      stradd TASK_STRING "killing those darn [spiders], "
      local QUESTS_LEFT 1
   }
   if ( !DONE_GRAVE )
   {
      stradd TASK_STRING "tending Feldar’s [grave], "
      local QUESTS_LEFT 1
   }
   if ( !DONE_CRYSTAL )
   {
      stradd TASK_STRING "gathering lighthouse [crystals], "
      local QUESTS_LEFT 1
   }
   if ( !DONE_FOOD )
   {
      stradd TASK_STRING "not to mention simply getting some [food]!"
      local QUESTS_LEFT 1
   }
   if ( !QUESTS_LEFT )
   {
      setvard TASK_STRING "But good young lads like yourself come and fix me up from time to time - so - I’ve nothing that needs doing just now."
      callevent 2.0 resume_tending
   }
}

{ say_spider

   if !BUSY_CHATTING

   if ( DONE_SPIDER )
   {
      playanim critical wave
      saytext Oh, someone already got rid of those for me. Thank you anyways.
      local EXIT_SUB 1     
   }
   if !EXIT_SUB

   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG


   if ( $get_quest_data(FACE_TARG,l) isnot 0 )
   {
      callevent target_busy FACE_TARG
      local EXIT_SUB 1
   }
   if !EXIT_SUB

   if ( $get(HIRED_SPIDER,isalive) )
   {
      saytext $get(HIRED_SPIDER,name) is already working on that for me.
      local EXIT_SUB 1
      setvard TENDING_HOUSE 1
      callevent bchat_mouth_move
   }
   if !EXIT_SUB
   
   setvard MENU_TARGET FACE_TARG
   setvard CHAT_STEPS 4
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "Well, there’s a spider infestation in the caves below. I’ve put it off for far too long, so..."
   setvard CHAT_STEP2 "...I figure by now there’s got to be a nest and some very sizable eggs."
   setvard CHAT_STEP3 "If those hatch I could be in for more than a little trouble!"
   setvard CHAT_STEP4 "Think you could go down there and take care of that for me? I’d be ever so grateful."
   setvard MENU_MODE confirm
   setvard MENU_QUEST spider
   setvard CONFIRM_STEP 4
   callevent chat_loop
   callevent 2.0 convo_anim
   callevent 6.0 convo_anim
}

{ say_grave

   if !BUSY_CHATTING

   if ( DONE_GRAVE )
   {
      playanim critical wave
      saytext Oh, someone already delivered that for me, thanks.
      callevent bchat_mouth_move
      local EXIT_SUB 1     
   }
   if !EXIT_SUB

   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG


   if ( $get_quest_data(FACE_TARG,l) isnot 0 )
   {
      callevent target_busy FACE_TARG
      local EXIT_SUB 1
   }
   if !EXIT_SUB

   if ( $get(HIRED_GRAVE,isalive) )
   {
      saytext $get(HIRED_GRAVE,name) is already working on that for me.
      local EXIT_SUB 1
      callevent bchat_mouth_move
      setvard TENDING_HOUSE 1
   }
   if !EXIT_SUB
   
   setvard MENU_TARGET FACE_TARG
   setvard CHAT_STEPS 6
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "Well, my old friend Feldar, always the good samaritan, was out escorting some fresh adventurers around the Thornlands."
   setvard CHAT_STEP2 "Near as the constable could tell, it turns out they were actually bandits, and they assasinated the kindhearted old fool."
   setvard CHAT_STEP3 "He loved this old place, so we made his grave just around the back, ... I used to visit it quite often, but lately it's been... Strange."
   setvard CHAT_STEP4 "He had a favorite figurine of The Goddess Felewyn, you see. His widow brought it to me recently. I think he wanted it buried with him..."
   setvard CHAT_STEP5 "Or at least that would explain the... Unrest... Outside."
   setvard CHAT_STEP6 "You look like you might be able to brave the denizens around there. If you could bring this statuette there, I’m sure it’d all quiet down."
   setvard MENU_MODE confirm
   setvard MENU_QUEST grave
   setvard CONFIRM_STEP 6
   callevent chat_loop
}

{ say_crystal

   if !BUSY_CHATTING

   if ( DONE_CRYSTAL )
   {
      playanim critical wave
      saytext Oh, someone already got those for me, thanks.
      local EXIT_SUB 1     
   }
   if !EXIT_SUB

   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG

   if ( $get_quest_data(FACE_TARG,l) isnot 0 )
   {
      callevent target_busy FACE_TARG
      local EXIT_SUB 1
   }
   if !EXIT_SUB

   if ( $get(HIRED_CRYSTAL,isalive) )
   {
      saytext $get(HIRED_CRYSTAL,name) is already working on that for me.
      local EXIT_SUB 1
      callevent bchat_mouth_move
      setvard TENDING_HOUSE 1
   }
   if !EXIT_SUB
     
   setvard MENU_TARGET FACE_TARG
   setvard CHAT_STEPS 5
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "Ah, well... The lighthouse here’s been a bit flickery as of late - I think she needs some new crystals."
   setvard CHAT_STEP2 "The light crystals that power the magic core are fairly common in these parts..."
   setvard CHAT_STEP3 "But with all the things I’ve seen crawling about lately, I just don’t feel up to grabbing them myself!"
   setvard CHAT_STEP4 "If you could find me a good set, I’ll reward ye handsomely."
   setvard CHAT_STEP5 "Otherwise we could wind up with a boat smashed up on the rocks, and that’d be bad for business!"
   setvard MENU_MODE confirm
   setvard MENU_QUEST crystal
   setvard CONFIRM_STEP 4
   callevent chat_loop
}

{ say_food

   if !BUSY_CHATTING

   if ( DONE_FOOD )
   {
      playanim critical wave
      saytext Oh, someone already got me some - I’m quite sated, thanks.
      local EXIT_SUB 1     
   }
   if !EXIT_SUB

   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG

   if ( $get_quest_data(FACE_TARG,l) isnot 0 )
   {
      callevent target_busy FACE_TARG
      local EXIT_SUB 1
   }
   if !EXIT_SUB

   if ( $get(HIRED_FOOD,isalive) )
   {
      saytext $get(HIRED_FOOD,name) is already working on that for me.
      local EXIT_SUB 1
      callevent bchat_mouth_move
   }
   if !EXIT_SUB
   
   setvard MENU_TARGET FACE_TARG
   setvard CHAT_STEPS 3
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "I... I don’t think I’ve actually eaten a thing in a week, now that I think of it..."
   setvard CHAT_STEP2 "...and I really try not to, believe me. Too busy for food and all..."
   setvard CHAT_STEP3 "If you could just bring me an apple or two, anything really, I’d be so very grateful."
   setvard MENU_MODE confirm
   setvard MENU_QUEST food
   setvard CONFIRM_STEP 3
   callevent chat_loop
}

{ accept_quest //menu response

   local TRIG_STR quest_
   stradd TRIG_STR MENU_QUEST
   usetrigger TRIG_STR

   quest set PARAM1 l MENU_QUEST
   setvard MENU_MODE normal
   callevent convo_anim

   if ( MENU_QUEST equals spider )
   {
      setvard HIRED_SPIDER PARAM1
      saytext Thank you, oh so much. Come back here when ya clear out those pests.
   }

   if ( MENU_QUEST equals grave )
   {
      setvard HIRED_GRAVE PARAM1
      saytext Thank you, oh so much. Come back here when you’ve done the deed and I’ll reward you.
      offer PARAM1 item_fstatue
   }

   if ( MENU_QUEST equals crystal )
   {
      setvard HIRED_CRYSTAL PARAM1
      saytext Thank you, oh so much. Be careful with those crystals by the way - they are quite fragile!
   }

   if ( MENU_QUEST equals food )
   {
      setvard HIRED_FOOD PARAM1
      saytext Oh yes, please bring me something, I’d be grateful beyond words.
      setvard APPLE_QUEST_ACTIVE 1
   }

   setvard TENDING_HOUSE 1   
}

{ chat_loop

   setvard WAS_STARTLED 1 //damn thing wont stick

   if ( MENU_MODE equals confirm )
   {
      if ( CHAT_STEP == CONFIRM_STEP ) menu.open MENU_TARGET
   }

   if ( CHAT_STEP == 2 ) callevent convo_anim
   if ( CHAT_STEP == 4 ) callevent convo_anim
   if ( CHAT_STEP == 6 ) callevent convo_anim
   if ( CHAT_STEP == 8 ) callevent convo_anim
   if ( CHAT_STEP == 10 ) callevent convo_anim
}

{ decline_quest //menu response
   setvard MENU_MODE normal
   quest set PARAM1 l 0
   playanim critical no
   saytext Well... That’s alright. At least you’re some company... I guess.
   callevent bchat_mouth_move
   setvard TENDING_HOUSE 1
}

{ game_menu_getoptions

   //cancel quest option
   local CUR_QUEST $get_quest_data(PARAM1,l)

   if ( MENU_MODE isnot confirm )
   {

      if ( $item_exists(PARAM1,item_light_crystal) )
      {
         if !DONE_CRYSTAL
         local reg.mitem.title    "Offer Light Crystal"
         local reg.mitem.type    payment
         local reg.mitem.data   item_light_crystal
         local reg.mitem.callback reward_crystal
         menuitem.register
      }

      if ( $item_exists(PARAM1,health_apple) )
      {
         if APPLE_QUEST_ACTIVE
         if !DONE_FOOD
         local reg.mitem.title    "Offer Apple"
         local reg.mitem.type    payment
         local reg.mitem.data   health_apple
         local reg.mitem.callback reward_food
         menuitem.register
      }

      if CUR_QUEST equals 0

      local reg.mitem.title    "Hail"
      local reg.mitem.type    callback
      local reg.mitem.callback say_hi
      menuitem.register

      if ( WAS_STARTLED )
      {
         if ( !DONE_SPIDER )
         {
            local reg.mitem.title    "Ask about spiders"
            local reg.mitem.type    callback
            local reg.mitem.callback say_spider
            menuitem.register
         }

         if ( !DONE_GRAVE )
         {
            local reg.mitem.title    "Ask about Feldar’s Grave"
            local reg.mitem.type    callback
            local reg.mitem.callback say_grave
            menuitem.register
         }

         if ( !DONE_CRYSTAL )
         {
            local reg.mitem.title    "Ask about crystals"
            local reg.mitem.type    callback
            local reg.mitem.callback say_crystal
            menuitem.register
         }

         if ( !DONE_FOOD )
         {
            local reg.mitem.title    "Ask about food"
            local reg.mitem.type    callback
            local reg.mitem.callback say_food
            menuitem.register
         }

         local reg.mitem.title    "Ask about forest"
         local reg.mitem.type    callback
         local reg.mitem.callback say_forest
         menuitem.register
      }
   }

   //confirm quests
   if ( MENU_MODE equals confirm )
   {
      if ( MENU_QUEST equals spider ) local reg.mitem.title  "I’ll clear the eggs."
      if ( MENU_QUEST equals grave ) local reg.mitem.title  "I’ll visit the grave."
      if ( MENU_QUEST equals crystal ) local reg.mitem.title  "I’ll get the crystals."
      if ( MENU_QUEST equals food ) local reg.mitem.title  "I’ll bring some apples."

      local reg.mitem.type    callback
      local reg.mitem.callback accept_quest
      menuitem.register

      local reg.mitem.title "Sorry. I’m busy."
      local reg.mitem.type callback
      local reg.mitem.callback decline_quest
      menuitem.register

   }

   if ( DONE_SPIDER )
   {
      if PARAM1 equals HIRED_SPIDER
      if CUR_QUEST equals spider
      local reg.mitem.title "Collect Spider Quest Reward"
      local reg.mitem.type callback
      local reg.mitem.callback reward_spider
      menuitem.register
   }

   if ( DONE_GRAVE )
   {
      if PARAM1 equals HIRED_GRAVE
      if CUR_QUEST equals grave
      local reg.mitem.title "Collect Grave Quest Reward"
      local reg.mitem.type callback
      local reg.mitem.callback reward_grave
      menuitem.register
   }

   if ( CUR_QUEST isnot 0 )
   {
      local REMIND_STR "Cancel "
      stradd REMIND_STR CUR_QUEST
      stradd REMIND_STR " quest"

      local reg.mitem.title REMIND_STR
      local reg.mitem.type callback
      local reg.mitem.callback clear_quest
      menuitem.register
   }
}

{ reward_spider
   callevent face_speaker PARAM1
   callevent convo_anim
   offer PARAM1 gold $rand(10,20)
   local BASIC_WINNER PARAM1
   callevent offer_basic_reward BASIC_WINNER
   local SCROLL_CHANCE $rand(1,2)
   if ( SCROLL_CHANCE == 1 )
   {
      local SCROLL_TOME $rand(1,2)
      if ( SCROLL_TOME == 1 ) offer PARAM1 <<item_censored>>
      if ( SCROLL_TOME == 2 ) offer PARAM1 <<item_censored>>
   }
   if ( SCROLL_CHANCE == 2 ) callevent offer_basic_reward BASIC_WINNER
   saytext "Thank you so very much. I’d hate to have a swarm of eight leggeds creeping up here."
   quest set PARAM1 l 0
   callevent 2.0 resume_tending
}

{ reward_grave
   local BASIC_WINNER PARAM1
   callevent offer_basic_reward BASIC_WINNER

   callevent face_speaker PARAM1
   callevent convo_anim
   offer PARAM1 gold $rand(10,15)
   saytext "Thank you so very much. I’m sure he’ll rest easier now."
   quest set PARAM1 l 0
   callevent 2.0 resume_tending
}

{ reward_crystal
   local BASIC_WINNER PARAM1
   callevent offer_basic_reward BASIC_WINNER

   setvard DONE_CRYSTAL 1
   callevent face_speaker PARAM1
   callevent convo_anim
   offer PARAM1 gold $rand(10,20)
   saytext "A crystal! Thank goodness! I’m sure they’d hang me if we had another... Accident."
   quest set PARAM1 l 0
   callevent 2.0 resume_tending
}

{ reward_food
   local BASIC_WINNER PARAM1
   callevent offer_basic_reward BASIC_WINNER

   setvard DONE_FOOD 1
   callevent face_speaker PARAM1
   callevent convo_anim
   offer PARAM1 gold 5
   saytext "I thank ye! My stomach, doubly so!"
   quest set PARAM1 l 0
   callevent 2.0 resume_tending
}

{ resume_tending //for delay
   setvard TENDING_HOUSE 1
}

{ clear_quest //menu response

   local CUR_QUEST $get_quest_data(PARAM1,l)
   if ( CUR_QUEST equals spider ) setvard HIRED_SPIDER 0
   if ( CUR_QUEST equals grave )
   {
      setvard HIRED_GRAVE 0
      local METHOD_HACK $item_exists(PARAM1,item_fstatue,remove)
   }
   if ( CUR_QUEST equals crystal ) setvard HIRED_CRYSTAL 0
   if ( CUR_QUEST equals food ) setvard HIRED_FOOD 0
   setvard MENU_MODE normal
   quest set PARAM1 l 0
   saytext That’s alright. There’s plenty else to do around here too, if you’re interested.
   callevent bchat_mouth_move
   setvard TENDING_HOUSE 1
}

{
repeatdelay $randf(3,5)

   //random anims while tending lighthouse

   if TENDING_HOUSE
   setangle face $vec(0,MY_YAW,0)

   local N_IDLES $get_token_amt(TEND_ANIMS)
   local RND_IDLE $rand(1,N_IDLES)
   subtract RND_IDLE 1 //token arrays index on 0
   local IDLE_ANIM $get_token(TEND_ANIMS,RND_IDLE)
   setidleanim IDLE_ANIM
   setmoveanim IDLE_ANIM
}

{ target_busy
   //player is already on a quest for me
   playanim critical pondering3
   local CUR_QUEST $get_quest_data(PARAM1,l)
   if ( CUR_QUEST equals spider ) saytext Didn’t you say you were going to kill some spiders for me?
   if ( CUR_QUEST equals grave ) saytext Didn’t you say you were going to tend Feldar’s grave for me?
   if ( CUR_QUEST equals crystal ) saytext Didn’t you say you were going to get some crystals for me?
   if ( CUR_QUEST equals food ) saytext Didn’t you say you were going to get me some food?
   setvard MENU_MODE confirm
   setvard MENU_QUEST CUR_QUEST
   menu.open PARAM1
}

{ quest_done_spider //external map event
   setvard DONE_SPIDER 1
}

{ quest_done_grave //external from other/grave_watcher
   setvard DONE_GRAVE 1
}

{ [server] bd_debug  //<print_var> <property_printvar> <extra> <extra> <caller_id>
   saytextrange 2048
   saytext var PARAM1 prop PARAM2 = $get(PARAM1,PARAM2)
   consolemsg PARAM5 $get(ent_me,name) reports: var PARAM1 pvar $get(PARAM1,PARAM2)
   dbg PARAM5 $get(ent_me,name) reports: var PARAM1 pvar $get(PARAM1,PARAM2)
}

{ offer_basic_reward

   local N_REWARDS $get_token_amt(BASIC_REWARDS)
   local RND_REWARD $rand(0,N_REWARDS)
   offer PARAM1 $get_token(BASIC_REWARDS,RND_REWARD)
}

{ say_forest

   if !BUSY_CHATTING

   if ( !$get(PARAM1,isplayer)   ) local FACE_TARG $get(ent_lastspoke,id)
   if ( $get(PARAM1,isplayer) ) local FACE_TARG $get(PARAM1,id)
   callevent face_speaker FACE_TARG

   setvard CHAT_STEPS 4
   setvard CHAT_STEP 0
   setvard BUSY_CHATTING 1
   setvard CHAT_STEP1 "Oh, that forest over there. Lots of wolves in that forest. Nasty place."
   setvard CHAT_STEP2 "A young adventurer wandered into there the other day. He looked a bit green around the ears, if you catch my meaning."
   setvard CHAT_STEP3 "I tried to stop him, but he wouldn't listen."
   if ( game.players == 1 ) setvard CHAT_STEP4 "You look like a strapping young lad. You might want to go in there and check on him."
   if ( game.players > 1 )  setvard CHAT_STEP4 "You look like strapping young lads. You might want to go in there and check on him."
   callevent chat_loop

_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Wed Oct 15, 2008 8:26 am    Post subject: Reply with quote

Wow, scary.

Ummm.... yes? I didn't read the whole thing, but I got a general idea. It's entirely possible to do something like that in the Quake engine. I wouldn't recommend it right now though, since you're fairly new and that would give even a lot of pros a pretty good runaround.

For a first project, or a first iteration of the project, I'd recommend you have a simpler system than that. You can always enhance it with more features and a more complex file format later. Wink
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 8:43 am    Post subject: Reply with quote

lol alright, thanks. i think for a little practice im going to make a carryable torch that when held in hand it lights your way lol.... -.-
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Wed Oct 15, 2008 9:29 am    Post subject: Reply with quote

Code:

if (self.weapon == IT_TORCH)
     self.effects = self.effect | EF_DIMLIGHT;
else
     self.effects = self.effects - (self.effects & EF_DIMLIGHT);


this could go in CheckPowerUps()...

This means if you are HOLDING the torch then YOU glow.
if you want to glow while possessing the torch but holding a gun then change to
Code:

if (self.items & IT_TORCH)
...


Smile

wow i need sleep, im starting to have fun..
Back to top
View user's profile Send private message
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 8:22 pm    Post subject: Reply with quote

im not sure, if thats what i want to do. basically its going to be held like a weapon, but your going to be able to hold another weapon (if its possible)
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Wed Oct 15, 2008 9:39 pm    Post subject: Reply with quote

MOVETYPE_FOLLOW is an option (just attach the torch to your body on the opposite side of where the gun is). If you don't care about other players seeing the torch in multiplayer, you could make it a .viewmodelforclient (see dpextensions.qc).

If you do care about other players seeing it, you could attach a second model to the player with .nodrawtoclient. That way, you have 1 model that follows the player for other players to see (but he doesn't see it), and another model that only he can see that looks good on his screen.

-Wazat
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 10:02 pm    Post subject: Reply with quote

good plan Very Happy i could still set it up as an item doing this?

also know this isnt a mapping section but it has to do with the mod i am taking about developing here.

this is bascally a terrain test, i think it looks pretty good, i re looked at it after making the pic though and i could even make it look not so pointy just by pulling a couple verts forwads.


_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Wazat



Joined: 15 Oct 2004
Posts: 732
Location: Middle 'o the desert, USA

PostPosted: Wed Oct 15, 2008 10:31 pm    Post subject: Reply with quote

Looks very nice.

Yes, you could set up an item that does this. It either activates automatically when picked up, or it goes in your inventory and gets activated with a keypress or menu or something similar.
_________________
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Back to top
View user's profile Send private message MSN Messenger
ceriux



Joined: 06 Sep 2008
Posts: 969
Location: Florida, USA

PostPosted: Wed Oct 15, 2008 10:57 pm    Post subject: Reply with quote

awsome, i might set that up for a later release though... till i get a little better on the qc part... for now im thinking of setting it up like a weapon that when u press a certain button you can drop it, but what im going to do is give it ammo even though it wont attack, but when you drop it the amount that you carry goes down. basically ill do it like an ammo drop.
_________________
QuakeDB - Quake ModDB Group
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2004 phpBB Group