SphereCommunity
Question : How to Skin an NPCs without using a bladed weapon - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Question : How to Skin an NPCs without using a bladed weapon (/Thread-Question-How-to-Skin-an-NPCs-without-using-a-bladed-weapon)



Question : How to Skin an NPCs without using a bladed weapon - Shidhun - 03-27-2014 04:29 PM

Hello,

yesterday i tried to create a function (or Event) which simulates the skinning of an NPC-Monster without the use of a target.
Sadly all my attempts where useless.

It is very simple to achive this by making a Command, equipping a Memory with the right type (ex. t_weapon_sword) and giving the player a target to skin the npc.

The "Problem" is, that i want to make this a racial feature without the need to target the corpse.

Example :
A Troll dies, in the Resource-List he has 5 Hides of Troll-Leather and some meat.
When a Human Character opens the corpse, nothing happens. He still needs to use a bladed weapon to cut up the corpse, before he gets the resources.

But when the char of another race (example Orcisch) opens the corpse, the corpse is getting cut (if not allready) @dclick and the cont opens. But : Without the use of a simulated Weapon and the need to target the corpse.

I tried to mess around with morey/morez, playing around with the tag.blood and so on. But i don't get the right solution :

Questions :
* Is there a way you know of, how to simulate the cutting of the corpse without a real weapon. Is there some kind of sendpacket?
* How do i find out (comparing the values) which corpse is allready cut? I tried it with messing around with the values of the corpse, but in my Worldsave there is no real difference between a cut-up-corpse and a fresh one. Sure, the tag.blood gets reduced, and morez is changed, but if i set it per script, this doesn't mean that i'm no longer able to cut up a fresh NPC

Thanks in advance for every comment and (possibly) hint.

Shidhun


RE: Question : How to Skin an NPCs without using a bladed weapon - wuffel - 03-28-2014 11:01 AM

Hi Smile

the "timestamp" - defined on a dead body, says if the body is already carved or not.
if timestamp = 0, than the body isnt carved yet.
if timestamp = "old-server-time", than the body is carved.

you can overload the dclick/itemdclick-Trigger for example and check, if its type t_corpse etc.


RE: Question : How to Skin an NPCs without using a bladed weapon - Coruja - 03-28-2014 03:59 PM

you can have some fun with t_corpse

the items must be created manually, and MORE1 will check if the corpse is already carved to prevent create these items again

I dont remember how sphere check internally if the corpse is already carved, but maybe its MORE1. You must use the same as the internal function to prevent double-carve (an orc will carve the corpse, then a human will carve it again)

Code:
[TYPEDEF t_corpse]
ON=@DClick
IF (<SRC.RACE>==Orcish) && !(<MORE1>)
  SRC.SYSMESSAGE You're an orc and carved the corpse.
  ARGS=<SERV.CHARDEF.<eval <MOREX>+<MOREY>>.RESOURCES>
  WHILE !(<isempty <ARGV[<LOCAL._WHILE>]>>)
    SERV.NEWITEM <STREAT <ARGV[<LOCAL._WHILE>]>>,<STRARG <ARGV[<LOCAL._WHILE>]>>
    NEW.CONT=<UID>
  ENDWHILE
  MORE1=1
ENDIF



RE: Question : How to Skin an NPCs without using a bladed weapon - Shidhun - 03-29-2014 07:53 PM

Thanks to both of you Smile

A Combination of both works perfectly :

When the corpse is created, a timestamp is set by sphere. If it is then set to 0 (=deletion) the corpse can no longer be carved.
Code:
on=@dclick                
IF (<SRC.isorc>)
    if <timestamp>
        ARGS=<SERV.CHARDEF.<eval <MOREX>+<MOREY>>.RESOURCES>
        WHILE !(<isempty <ARGV[<LOCAL._WHILE>]>>)
            SERV.NEWITEM <STREAT <ARGV[<LOCAL._WHILE>]>>,<STRARG <ARGV[<LOCAL._WHILE>]>>
            NEW.CONT=<UID>
        ENDWHILE
        timestamp=0
    endif
ENDIF



RE: Question : How to Skin an NPCs without using a bladed weapon - wuffel - 03-29-2014 10:10 PM

This is copied out of the revision changelog. So it depends on the sphereversion which value is important for you: more2, or timestamp.
09-02-2014, Ben
-Moved: t_corpse.more1, t_book.more2, t_message.more2, t_eq_memory_obj.more2 to new TIMESTAMP