SphereCommunity
ON=@DESTROY change tag - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: ON=@DESTROY change tag (/Thread-ON-DESTROY-change-tag)



ON=@DESTROY change tag - Lazarus - 09-05-2012 05:08 AM

Hi! First sry for the english Sad

Ive created a new system of Air, Fire, Water, and Earth Elementals.
You can cast ONLY 1 elemental per time, [With a item] so... You can't get 2 items of 2 elementals... [You only cast 1 elemental type with the item...] and you only can have 1 type item to cast Smile
(You can choose what type of mage you are Tongue)
So, this it's DONE.
Now I have a problem here...


I want to let the players cast ONLY 1 ELEMENTAL OF THE SAME TYPE.
So I have created this:

Code:
IN THE SPELL

ON=@START
if !(<findid.i_talisman_aire>)
Sysmessage @50 You need a air talisman to cast this.
return 1
endif
IF (<SRC.MAGERY> < 100.0) || (<SRC.EVALUATINGINTEL> < 100.0) || (<SRC.MEDITATION> < 100.0)
sysmessage @50 You don't have magery, or eval or meditation to cast this
sysmessage @40 Your talisman has erased!
SRC.f_clear_elem // function that erase the talismans
Return 1
endif
IF (<SRC.TAG0.CASTEANDOELEMENTAL>=1)
sysmessage @50 You can only cast 1 elemental per time
return 1
endif
SRC.TAG0.CASTEANDOELEMENTAL=1

ON=@Fail
SRC.TAG0.CASTEANDOELEMENTAL =

This works Flawless.
But I have now a problem with the ELEMENTAL NPC

Code:
ON=@DESTROY
act.sysmessage @50 Now you can cast again a elemental!
act.tag0.casteoelemental.remove

This... Doesn't works becuase erase the tag of the KILLER of the elemental and not to the OWNER of the elemental.
I have try with ON=@DEATH and the same things and nothing. Too I have try with src.tag0, i.tag... etc.
And I don't want a Bug or something else with all release* spk


What can I do?

Thanks ! Smile

Lazarus!


RE: ON=@DESTROY change tag - darksun84 - 09-05-2012 05:26 AM

In the memory object(layer 30) inside your elemental, in the LINK attribute there is the UID of the owner.


RE: ON=@DESTROY change tag - Lazarus - 09-05-2012 03:49 PM

Fixed!
Im not using on=@death and on=@destroy. I should use bot.

I have a new problem now:

ALL RELEASE in the elemental don't take out the tag.


Any idea?

thanks! Smile


RE: ON=@DESTROY change tag - Gadianton - 09-07-2012 03:55 AM

Quote:ALL RELEASE in the elemental don't take out the tag.

A tag needs to be taken out by specific code. Since "release" doesn't kill the creature (@Death or @Destroy) the Tag will stick... also since release breaks the link to the owner the @Death tag will probably not work properly when the creature finally dies.
You probably have to navigate around this by attaching a speech event to the summoned creature that triggers on the word "Release" and clears the Tag there instead of the @Death Trigger.
Code:
[SPEECH spk_conjuredelemental_release] // dumb long name I know..

ON=*release*
  IF <SRC.UID>==<OWNER.UID>
    // Take out elemental cast tag.
    I.TAG0.CASTEANDOELEMENTAL=
  ENDIF

Important probably is that you don't RETURN 1 out of this one or you might mess up the release process as a whole.

Maybe that will work?

Gadianton


RE: ON=@DESTROY change tag - Lazarus - 09-07-2012 06:14 AM

(09-07-2012 03:55 AM)Gadianton Wrote:  
Quote:ALL RELEASE in the elemental don't take out the tag.

A tag needs to be taken out by specific code. Since "release" doesn't kill the creature (@Death or @Destroy) the Tag will stick... also since release breaks the link to the owner the @Death tag will probably not work properly when the creature finally dies.
You probably have to navigate around this by attaching a speech event to the summoned creature that triggers on the word "Release" and clears the Tag there instead of the @Death Trigger.
Code:
[SPEECH spk_conjuredelemental_release] // dumb long name I know..

ON=*release*
  IF <SRC.UID>==<OWNER.UID>
    // Take out elemental cast tag.
    I.TAG0.CASTEANDOELEMENTAL=
  ENDIF

Important probably is that you don't RETURN 1 out of this one or you might mess up the release process as a whole.

Maybe that will work?

Gadianton

Works with ACT.TAG0.casteandoelemental=

[ACT] i had change

but... I have a new problem.

If i use *RELEASE* first works the other function of release and the monster get released without take me out the tag.
If i use something like *RELEASE1* works perfectly, but my monster keeps be mine...

But i want to use the normal release.

I can change the release or all release function to add the act.tag0.casteandoelemental=

thanks! Smile


RE: ON=@DESTROY change tag - RanXerox - 09-07-2012 08:34 AM

Here is another idea... Instead of using the tag as a counter, why not store the UID's of the summoned creatures in the tag as a comma separated list. Then use @destroy or whatever trigger it is that is running twice and in that trigger remove the uid from the list... if its already removed by the time the second trigger executes, you won't care cause the end result is achieved. In the "summon", count the number of entries in the list and make your allow/disallow decision from that.


RE: ON=@DESTROY change tag - Lazarus - 09-07-2012 12:48 PM

Fixed ! I had added in the sphere_speech this:

FIRST, i put the ON=RELEASE on the top, because the lines of script works in the all commands and fuction over there.

Code:
[SPEECH spk_pet]
// Pets that cannot talk
ON=RELEASE
if (<src.tag0.casteandoelemental>)
if (<src.uid>==<owner.uid>)
SRC.tag.casteandoelemental=
endif
endif
ON=KILL
ON=ATTACK
ON=COME
ON=DEFEND ME
ON=DISMISS
ON=DROP    // "GIVE" ?
ON=DROP ALL
ON=FETCH
ON=FOLLOW
ON=FOLLOW ME
ON=FRIEND
ON=GO
ON=GUARD
ON=GUARD ME
ON=SPEAK
ON=STAY
ON=STAY HERE
ON=STOP
ON=TRANSFER

If I use this:
Code:
[spk...]
ON=KILL
ON=RELEASE
if (<src.tag0.casteandoelemental>)
if (<src.uid>==<owner.uid>)
SRC.tag.casteandoelemental=
endif
endif
ON=ATTACK

the tag works in KILL and RELEASE Smile


Thanks to all Smile rly !

I love so much your souls (?

Lazarus.


RE: ON=@DESTROY change tag - Lazarus - 09-10-2012 03:14 AM

Now I have a new challenge...

When you attack your own elemental they refuses your owner...

And then, when he gets dead don't takes out the tag.

Any idea?

like: A tag when you save the old master and then when you get dead forget's the owner


Thanks!