Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  Attack Register  (Read 33990 times)

0 Members and 1 Guest are viewing this topic.

smacky

« Reply #15 on: 17, April 2014, 11:03:42 »
BTW don't test name here. Type should do it (and IIRC weapons also have a sub_type).

clobber

« Reply #16 on: 22, April 2014, 15:35:09 »
Thanks for your help with the Ph :) Now moving onto spells :\

I'm not sure how to approach it - you've said not to use name and there isn't really another way through the .arc files, in this case... is there?
« Last Edit: 22, April 2014, 15:42:35 by clobber »
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

smacky

« Reply #17 on: 22, April 2014, 22:01:21 »
Spells are different/not implemented too well. I can't quite remember but some numerical stat might be a spell number which indicates which spell it is (Actually this must be the case but I don't think their are any Lua game constants ATM). Or you're probably OK to query spell.name for now (but use game:MatchString() because I'm not sure spell names really follow consistent caps rules).

clobber

« Reply #18 on: 23, April 2014, 11:03:44 »
I've succeeded with an examine script for probe, but am still struggling with CLW, MB and MH. No error messages in server or client windows. I've also tried if attack.spellpoints == 11 (the number for the spell) to no avail. Any suggestions?

Code: [Select]
elseif game:MatchString("magic bullet", attack.name) == 1 then
    local player = attack.owner
    local questnr = qb:Build(player)
    local qstat7 = qb:GetStatus(7)
        if qstat7 == game.QSTAT_ACTIVE then
        qb:Finish(7)
        end
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

_people_

« Reply #19 on: 23, April 2014, 22:47:18 »
As it turns out, the documentation for game:MatchString() is misleading. It says it returns a 1 or a 0, but the return type is actually boolean (true/false). Replace the 1 with true.
-- _people_ :)

clobber

« Reply #20 on: 24, April 2014, 10:29:30 »
No, it doesn't even seem to trigger the script when using magic bullet :s
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

smacky

« Reply #21 on: 24, April 2014, 11:05:30 »
Which event type are you using, ATTACK or DEATH? Sounds like for some reason spells don't trigger it (as you said probe did I@m assuming ATTACK).


clobber

« Reply #22 on: 24, April 2014, 11:11:32 »
Attack.

Probe is set up with examine. I'll give death a go with the other spells?

EDIT: No luck :(
« Last Edit: 24, April 2014, 11:14:10 by clobber »
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

smacky

« Reply #23 on: 24, April 2014, 16:54:49 »
DEATH didn't work (at least trigger the script) when you killed with the spell?

Try this patch:

In attack.c find the end of hit_map(). This ends with:

Code: [Select]
    }

    return 0;
}

Before these last four lines do:

Code: [Select]
#if 0
        damage_ob(tmp, op->stats.dam, op, ENV_ATTACK_CHECK);
        retflag |= 1;
        if (was_destroyed(op, op_tag))
            break;
#else
        if (!trigger_object_plugin_event(EVENT_ATTACK, tmp, op, op, NULL, NULL,
            NULL, NULL, SCRIPT_FIX_ALL))
        {
            damage_ob(tmp, op->stats.dam, op, ENV_ATTACK_CHECK);
            retflag |= 1;

            if (was_destroyed(op, op_tag))
            {
                break;
            }
        }
#endif

Where the #if 0 code is what already exists (ie, replace it with this then you can recompile with #if 0 or #if 1 to use the new or old code).

I haven't tested this at all but all being well it will trigger an ATTACK script on the victim with the same settings as for normal weapons.

If the script sets event.returnvalue = 1 the victim will not be damaged by the spell.

clobber

« Reply #24 on: 24, April 2014, 20:24:59 »
Great! I'll give this a go :) Thanks Smacky!
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

clobber

« Reply #25 on: 28, April 2014, 12:05:26 »
Hmm... I've just copied oer the server files from trunk and popped this in and attempted to compile but the server crashes on log in.
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

smacky

« Reply #26 on: 28, April 2014, 16:31:04 »
Any indication why? Have you tried both with #if 0 and #if 1 (and indeed with just plain trunk? I just rebooted dev. I'd guess I  did a duff commit last time, though local seems fine.

EDIT: dev is fine so I assume you Clobbered local somehow.
« Last Edit: 28, April 2014, 17:49:34 by smacky »

clobber

« Reply #27 on: 29, April 2014, 22:31:58 »
Archetypes. Always falling for that :(

EDIT: Anyway! Now time to test your code and my scripts :D

EDIT2: ARGH! I fixed then then I went to recompile with your changes and got error message. Removed your stuff and still got the error message... to do with mingw?

Code: [Select]
c:\program files (x86)\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.7.1\include\stdarg.h|40|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'|
Code: [Select]

#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif

« Last Edit: 29, April 2014, 22:59:05 by clobber »
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

smacky

« Reply #28 on: 30, April 2014, 00:06:37 »
? Maybe it doesn't like the linbreak before typedef. Try:

Code: [Select]

#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST typedef __builtin_va_list __gnuc_va_list;
#endif

Also, I googled the error. First hit: https://www.daimonin.org/forums/tech-support/cannot-compile-any-servers/

So what solved it last time: uninstall CB, dl and install a new one.

clobber

« Reply #29 on: 30, April 2014, 11:29:38 »
Huh, when I googled it, I got a whole load of grumpy people on stack overflow :s

EDIT: I re-installed it and get the same error message. I tried the code change and got the same error message. Any more suggestions?

EDIT2: Would someone be able to compile a version with Smacky's changes and send me the .exe?
« Last Edit: 01, May 2014, 13:48:04 by clobber »
Posted by Clobber

Collector Of Burnt out torches, 0 and Counting.

,-.  ___ ,-.
 \/ .   .  \ / 
(___O___)
 /  \      /   )
 ( ||       || )
  000     000
Woof, Woof!

Quote from: Longir
I use caution, fear is a distraction

Tags:
 

Related Topics

  Subject / Started by Replies Last post
0 Replies
6937 Views
Last post 17, January 2006, 17:13:01
by michtoen
3 Replies
1150 Views
Last post 08, February 2009, 12:40:53
by smacky
8 Replies
3006 Views
Last post 20, June 2009, 05:19:31
by l00natyk
4 Replies
1181 Views
Last post 24, September 2009, 21:43:25
by Nobbit
3 Replies
5041 Views
Last post 24, September 2012, 23:32:24
by ddhanna