[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Using/Adding all Hknight magic attack animations [TUT]

Using/Adding all Hknight magic attack animations [TUT]

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Using/Adding all Hknight magic attack animations [TUT]

Postby Seven » Sun Jan 01, 2012 2:02 pm

Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby toneddu2000 » Tue Jan 03, 2012 12:34 pm

Great tutorial Seven! Thanks a lot for sharing! Just two questions:
1) is it possible to use DP_ENT_COLORMOD with non-per-frame animations?
I explain: I use iqm and I had to rewrite the part of animation frames (I don't use the $frame convention but I use the self. frame 1, self. frame++ structure).
In this case how can I increase the "redness" of the entity during frame interpolation?
2) I'm creating a scratch qc and I can't figure out the th_.... function (for example th_missile,th_walk, and so on). I know they are the "Think actions of an entity (player/monster)" but , are they hard-coded? Should I declare the th_pain for example and then create a monster_pain function to "link" to it?

Thanks
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Seven » Tue Jan 03, 2012 1:20 pm

Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby toneddu2000 » Tue Jan 03, 2012 8:59 pm

for point 1: ok I'll try it, thanks. I'm not 100% sure that red glow will "fade in" and then "fade out"with that method but I could be wrong
for point 2: well, inside army_stand1 function (besides the frames function) there's the ai_stand function that (afaik) is called by ai.qc and it handles all the ai stuff

Well in the next 4 days I won't have a pc, but once back home I'll try to dig the whole question.

Thanks again Seven!!
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby sp4x0r » Fri Jan 13, 2012 5:32 am

User avatar
sp4x0r
 
Posts: 16
Joined: Mon Jul 21, 2008 11:48 am

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby goldenboy » Fri Jan 13, 2012 8:04 pm

You can even add new th_* routines, to extend the monster ai. This is all driven from ai.qc. Sou you could make a self.th_charge, or whatever.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby toneddu2000 » Fri Jan 13, 2012 10:45 pm

Now I understood. Thanks a lot sp4x0r!! With the example of army_pain() instead of army_pain1 a light bulb appeared over my head!And thanks goldenboy too! I'll try to create my on th_functions imediately!

Just a noob question again: why sometimes I find function_name(); and other time I find function_name; what's the difference with () and without it? Some time ago I put () in a function, the compiler compiled everything but then quakec crashed, after removing the () the game has returned to work.
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Spike » Fri Jan 13, 2012 11:22 pm

() in means 'this is a function'. no () means this is a regular variable.
if there's no () then chances are its being stored in some field for later use.
so 'self.fred = foo();' calls foo, and stores the return value in self.fred.
'self.fred = foo;' on the other hand stores foo in self.fred... if they're functions you can then do 'self.fred()' to invoke 'foo()'.
which is how the ai code runs each monster without really caring which monster it is. those th_foo functions are simply nice references to the function to use when the monster needs to start running/walking/etc. just a nice and simple extra layer of indirection.
there's nothing engine-specific with them, you can add others if you update the ai to support those extras, of course.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby toneddu2000 » Sat Jan 14, 2012 8:49 am

Thanks a lot Spike, kind and precise as always
- my first commercial game, made with FTEQW game engine
toneddu2000
 
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Postby Seven » Sun Nov 18, 2012 10:15 am

Dear all,

I didnt want to open a new thread, because my question is related to the above discussed topic with:
self.th_*

What I do not understand is the difference in:
self.th_pain

Why different monsters have different function-formats ?
Example:
knight:
self.th_pain = knight_pain;
void(entity attacker, float damage) knight_pain =

demon:
self.th_pain = demon1_pain;
void(entity attacker, float damage) demon1_pain =

dog:
self.th_pain = dog_pain;
void() dog_pain =


1.) Why does the dog function does not have the variables: attacker and damage, while demon has them ?
Is it inconsequent code from ID (because even in knight_pain the 2 variables are not used ! ) ?
2.) Where is the call for the monsters pain function ?
Where I could see the usage of the variables. Is it engine sided ?

Thank you for your answer.
Last edited by Seven on Sun Nov 18, 2012 12:28 pm, edited 1 time in total.
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Spike » Sun Nov 18, 2012 11:05 am

this logic is pure qc, not the engine (ignoring the fact that the vm is part of the engine and that qc depends upon the vm...).
it is safe to call a qc function with more arguments than it accepts. the extra arguments are simply discarded. if the dog doesn't care who's hitting it or how much damage its taking then there is no issue with it not having any arguments specified.
the inverse is not true. never omit arguments if the function that you are calling will read/use them.
your qcc should probably warn on the assignment, but hey, qccs are basically all useless in at least one way. :)
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Seven » Sun Nov 18, 2012 12:36 pm

Thank you Spike,

I still dont know why id-software used different pain functions (without even using the arguments in most cases).
Yes, a warning is what your qcc might come up with.
I guess even id-coders are only humans... :)

What I still do not know is where the *_pain calls are ?
I dont find them in any .qc file (also not ai.qc).
I mean, a function is useless if it is never called, right ?
But the *_pain functions must be called from somewhere...
So where is it called from ? :roll:
The fact, that I do not find the calling function made me think that the engine takes care of it.

I *might* need a special/modified *_pain call function for the new spider monster I am working on,
or I must go with global .floats.
That is why I need your help to point me to the calling function.

Thank you very much.
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Spike » Sun Nov 18, 2012 12:48 pm

bottom of T_Damage in combat.qc
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Using/Adding all Hknight magic attack animations [TUT]

Postby Seven » Sun Nov 18, 2012 1:11 pm

:oops: Where else should it be.. :oops:

Thank you for opening my eyes Spike. :)
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest