Hi!
I was changing the combatbook script (see the custom scripts section) whene i experenced a little problem
The Client seems not to recognise a weapon by its objtype, but by its graphic-code.
So, icons of the combatbook dont change when i try to use a graphic-modified weapon
Example:
Without weapons the abilities enabled are:
- Disarm
- Paralizing Blow
I create a "bow" (0x13b2)
Usually bow has two abilities to choose
- Paralizing Blow
- Mortal Strike
In my shard we customized weapon's graphics so our "bow" has:
graphic 0x3A27
And when i equip my pg with that bow, icons of the combatbook dont change.
But, (holding the bow in hand) if i change the item graphic (using .info) in 0x13b2 , the icons change..
That's my trouble.
How can the client recognize another graphic for the weapons?
Or in general, how can i customize the combatbook (able the ninja ability, customize number of weapons to use an ability.. etc. etc.)?
Thanks for the answers, and sorry for my english ^^
Gnafu
Costomize Combatbook
You can change the graphic in your equip script. In your equip script, put:
right before your program returns 1.
Then, add:
At the end of your unequip program, right before it returns 1.
Finally, for every object that needs to change to a different graphic, edit their itemdesc entry to include:
So, in this case, it would be:
Hopefully that made sense...
Code: Select all
var itemdesc := ReadConfigFile(":*:itemdesc");
var equip_graphic := CInt(itemdesc[item.objtype].EquipGraphic);
if( equip_graphic != 0 )
SetObjProperty(item,"UnequipGraphic",item.graphic);
item.graphic := equip_graphic;
endif
Then, add:
Code: Select all
var unequip_graphic := GetObjProperty(item,"UnequipGraphic");
if( unequip_graphic )
item.graphic := unequip_graphic;
EraseObjProperty(item,"UnequipGraphic");
endif
Finally, for every object that needs to change to a different graphic, edit their itemdesc entry to include:
Code: Select all
EquipGraphic <NEW GRAPHIC>
Code: Select all
Weapon 0x3A27
{
...
EquipGraphic 0x13B2
...
}
Sorry, that's not a solution
If I change the graphic of the weapon when equipped, customizing the graphic is useless...
I have an object like this
whe added that "graphic" in order to change the shape of the weapons in the paperdoll....
If I'll do like you suggested, no-one will see the graphic 0x3A27...
If I change the graphic of the weapon when equipped, customizing the graphic is useless...
I have an object like this
Code: Select all
Weapon 0x13b2
{
...
graphic 0x3A27
...
}
If I'll do like you suggested, no-one will see the graphic 0x3A27...
-
Marilla
To my knowledge, the client will take pretty much all information from the graphic of an item, and not it's objtype. Offhand, I'm not even sure the client ever cares at all what objtype an item is, aside from to prevent trying to stack stackable items with the same graphic but different objtype.
Not being familiar at all with the combat book, a couple possibilities come to mind right away; First, Tile Data. You may need to assure that your tiledata entry for your bow graphic is properly set on the client, so that the client properly recognizes it as a bow. Again, not familiar with the specifics, so I don't know if you are maybe using a custom graphic, or just a ML graphic or something. Either way, I would just make sure the CLIENT'S tiledata has the correct info for your bow's graphic.
If you are using a custom graphic, you may have another problem, though; The client may be hard-coded to recognize what is or is not a bow, for purposes of the combat book. If that is the case, your only solution would be to use a graphic that it does recognize properly. You might consider instead of a completely new graphic, just replacing one of the existing bow graphics, though you may not like that idea, either.
Not being familiar at all with the combat book, a couple possibilities come to mind right away; First, Tile Data. You may need to assure that your tiledata entry for your bow graphic is properly set on the client, so that the client properly recognizes it as a bow. Again, not familiar with the specifics, so I don't know if you are maybe using a custom graphic, or just a ML graphic or something. Either way, I would just make sure the CLIENT'S tiledata has the correct info for your bow's graphic.
If you are using a custom graphic, you may have another problem, though; The client may be hard-coded to recognize what is or is not a bow, for purposes of the combat book. If that is the case, your only solution would be to use a graphic that it does recognize properly. You might consider instead of a completely new graphic, just replacing one of the existing bow graphics, though you may not like that idea, either.
Maybe you could write a packethook. It wouldn't be as fully-featured as the AOS version, but it would help to fix your problem. Write a custom gump, give each item 2 props in their itemdesc that the packethook will look for, and assemble the gump accordingly.
Just don't actually try to compile that, your compiler would hate you forever and may even cause your computer to explode.
Code: Select all
var itemdesc := ReadConfigFile(":*:itemdesc");
var ability_cfg := ReadConfigFile("::abilities");
program packethook_combatbook(who)
var weapon := who.weapon;
var gump := sendgump(SetupGump(who, weapon));
weapon := who.weapon; // prevent weapon-switch bug.
if( gump == 0 )
SendSysMessage(who, "Cancelled.");
elseif( gump == 1 )
DoAbility(who, itemdesc[weapon.objtype].Ability1);
elseif( gump == 2 )
DoAbility(who, itemdesc[weapon.objtype].Ability2);
endprogram
function SetupGump(byref who, byref weapon)
var ability_graphic_1 := GetAbilityGraphic(itemdesc[weapon.objtype].Ability1);
var ability_graphic_2 := GetAbilityGraphic(itemdesc[weapon.objtype].Ability2);
MakeBookBackground();
Place(ability_graphic_1);
Place(ability_graphic_2);
return gump;
endfunction
function DoAbility( byref who, byref weapon, abilityNumber )
SendSysMessage(who, ability_cfg[abilityNumber].targetText);
PerformActions(abilityNumber);
endfunction
-
Marilla
If I understand what you are suggesting correctly, I don't think you can/should build and send a gump from a packet hook script, as packet hooks run critical; Beyond the possible performance hiccups involved in building a gump in a critical script, there's also the fact that the script would simply return immediately from the gump send, without getting any data.
This assumes that there *IS* a combat book packet in the first place, or that such a packet could be used to override the combat book itself anyway, which I am not sure of. I think the combat book comes up no matter what, without waiting for any packets from the server... But, if it DOES only come up in response to packet(s) sent from the server, like the 2D skill window, you could do almost the above...
Basically, you would want to do nothing in the actual hook script. You want to return 1, so that the POL core just dumps the packet outgoing to the client. But instead of building a gump in that packet hook, you want to use start_script(); to start a completely new script, which can build and present the custom gump.
This assumes that there *IS* a combat book packet in the first place, or that such a packet could be used to override the combat book itself anyway, which I am not sure of. I think the combat book comes up no matter what, without waiting for any packets from the server... But, if it DOES only come up in response to packet(s) sent from the server, like the 2D skill window, you could do almost the above...
Basically, you would want to do nothing in the actual hook script. You want to return 1, so that the POL core just dumps the packet outgoing to the client. But instead of building a gump in that packet hook, you want to use start_script(); to start a completely new script, which can build and present the custom gump.
http://forums.polserver.com/viewtopic.php?t=447
There is a topic on an active working combat book hook. It IS client side, etc etc.
Read up on that first, should shed a lot of light on it all for ya.
There is a topic on an active working combat book hook. It IS client side, etc etc.
Read up on that first, should shed a lot of light on it all for ya.