- Posts: 937
- Thank you received: 17
TYPE_SLASH
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
5 years 9 months ago - 5 years 9 months ago #7220
by JTP
TYPE_SLASH was created by JTP
Why is this crashing my mud ?
if ((GET_HIT(ch) < -30) && (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) == TYPE_SLASH - TYPE_HIT)) {
I want the check to only work if mob is killed with slash weapon. Its added to make_corpse
if ((GET_HIT(ch) < -30) && (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) == TYPE_SLASH - TYPE_HIT)) {
I want the check to only work if mob is killed with slash weapon. Its added to make_corpse
Last edit: 5 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
Less
More
- Posts: 818
- Thank you received: 159
5 years 9 months ago #7221
by thomas
Replied by thomas on topic TYPE_SLASH
is there a check before this for whether GET_EQ(ch, WEAR_WIELD) is null?
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago - 5 years 9 months ago #7222
by JTP
I want it to do something special if its not an undead, and player in last hit put the mob under -30 hp and is using a slash weapon
Replied by JTP on topic TYPE_SLASH
if (!(GET_CLASS(ch) == CLASS_NPC_UNDEAD)) {
if ((GET_HIT(ch) < -30) && (GET_OBJ_VAL(GET_EQ(ch, WEAR_WIELD), 3) == TYPE_SLASH - TYPE_HIT)) {
bla bla corpse
bla bla bla create corpse
.....
}
}
I want it to do something special if its not an undead, and player in last hit put the mob under -30 hp and is using a slash weapon
Last edit: 5 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- thomas
-
- Offline
- Administrator
-
Less
More
- Posts: 818
- Thank you received: 159
5 years 9 months ago #7223
by thomas
Replied by thomas on topic TYPE_SLASH
My immediate thought was that in that case you'll want to check GET_HIT(victim) instead.
And add a "&& GET_EQ(ch, WEAR_WIELD) " before the attack type check.
And add a "&& GET_EQ(ch, WEAR_WIELD) " before the attack type check.
Please Log in or Create an account to join the conversation.
- JTP
- Topic Author
- Offline
- Platinum Member
-
Less
More
- Posts: 937
- Thank you received: 17
5 years 9 months ago - 5 years 9 months ago #7224
by JTP
Replied by JTP on topic TYPE_SLASH
Atm Im using the above code in make_corpse without the slash part. To besides a corpse also load a head, If the mob in the last hit gets below -30 HP when it dies. And that works perfect.
Then thought it would make most sense, if it only happened with a sharp weapon, so tried to add the slash part in. But that just crashes the game.
So not sure where excatly you would want me to look.
Then thought it would make most sense, if it only happened with a sharp weapon, so tried to add the slash part in. But that just crashes the game.
So not sure where excatly you would want me to look.
Last edit: 5 years 9 months ago by JTP.
Please Log in or Create an account to join the conversation.
- WhiskyTest
-
- Offline
- Platinum Member
-
Less
More
- Posts: 345
- Thank you received: 73
5 years 9 months ago - 5 years 9 months ago #7225
by WhiskyTest
Replied by WhiskyTest on topic TYPE_SLASH
I reckon make a new function for your severed head creation (what horrific mud are you building by the way? haha!)
Back up in raw_kill() is where I'd add the head severing.
This way you still have access to *ch and *killer data, so you can check if the killer was using a weapon - and if it was indeed a slashing weapon.
Just pop in in before the make_corpse(ch); call.
Once you get into make_corpse() you really only have access to the *ch information, of whom the corpse will be created.
Back up in raw_kill() is where I'd add the head severing.
This way you still have access to *ch and *killer data, so you can check if the killer was using a weapon - and if it was indeed a slashing weapon.
Just pop in in before the make_corpse(ch); call.
Once you get into make_corpse() you really only have access to the *ch information, of whom the corpse will be created.
Last edit: 5 years 9 months ago by WhiskyTest. Reason: typo
Please Log in or Create an account to join the conversation.
Time to create page: 0.106 seconds