Aller au contenu

Photo

How to associate an effect to events ?


5 réponses à ce sujet

#1
anakin5

anakin5
  • Members
  • 258 messages
I would like to send an event using SignalEvent function. This event is EVENT_TYPE_APPLY_EFFECT.

But I need to associate an effect to this event in order to get it back in the handlers with the function GetCurrentEffect().

Is there any SetEventEffect() function hidden somewhere ?

Modifié par anakin5, 30 décembre 2009 - 03:39 .


#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Usually that event is created automatically when you apply an effect on an object, I've never seen any reason to try and create it manually. It may not be possible to set what will be returned from GetCurrentEffect(), other than the normal way of applying effects.



What are you trying to do? Maybe there's another approach you can take.

#3
anakin5

anakin5
  • Members
  • 258 messages
I am trying to bypass the treatment made by engine when you call ApplyEffectOnObject with an EFFECT_TYPE_SUMMON.

This function, ApplyEffectOnObject, call Engine_ApplyEffectOnObject that seems to make 2 things :
- made a special treatment which result in displaying the pet portrait among others.
- rise the event EVENT_TYPE_APPLY_EFFECT. (you get it in rules_core after that).

Because I don't want the special treatment made by the engine on this effect, I wanted to manually raise the EVENT_TYPE_APPLY_EFFECT to the corresponding creature.
I need to get the effect back with GetCurrentEffect() in rules_core, but no way to SetEventEffect() in my script that send the event.

My first idea was to forget the event and directly write what I want for the creature in place of sending an event to it and doing treatment when the event is received.
But, later, when there is a call to RemoveAllEffect() (it append in many case in fact), the remove effect handler of EFFECT_TYPE_SUMMON is not called, and it is a problem.

I don't know if Engine_ApplyEffectOnObject push the effect in the effect list of the creature before raising EVENT_TYPE_APPLY_EFFECT, or if it the fact of raising EVENT_TYPE_APPLY_EFFECT that automatically push the effect in the creature's effect list.

PS: wow ! do you understand anything of what I wrote ?

Modifié par anakin5, 31 décembre 2009 - 01:30 .


#4
anakin5

anakin5
  • Members
  • 258 messages
Or maybe the special treatment is done when the creature receive the EVENT_TYPE_APPLY_EFFECT, and in this case, sending this event will not solve the problem.
Don't know in fact how the non scripted part of effects is managed.

Modifié par anakin5, 31 décembre 2009 - 01:28 .


#5
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
Yeah, I understand you. Unfortunately, I don't have the answer. I played around with summons for a while, but ultimately abandoned the project because of the complications of interacting with the core scripting, although I wanted the pet portrait which you don't seem to. The only advise I can really give you is to trace through the code and play around a bit to figure out exactly what the engine is doing and where, because I don't fully understand the system.

#6
anakin5

anakin5
  • Members
  • 258 messages
If you already looked at summon script core, you will probably understand what I will say.

I found that when the player summon a creature, the summon effect is applied to both ranger and summoned creature. I made many test by changing which effect is applied.

What is done by engine when you apply this effect to a player is :
- create the creature portrait
- broke the link between the party and the creature : that is removing the summoned creature from all party interface list such as tactics, talents, stats, inventory etc...

What is done by engine when you apply the effect to a creature is :
- link all creature interface to the ranger interface (tactics, talents, stats ...)

I have deleted the effect on the creature, and it works like a charm because I now have access to various screen concerning the creature (tactics, talents, stats...) when I select the summoned creature. That let me think of hundred of possible mods...

But, like I said, I have got a problem when the creature dies because the call of RemoveAllEffect on death doesn't run the handlers for summon effects (Alright, she don't have the effect).

Writing this makes me think that I could create a new effect, a fake effect, and apply it on the creature when summoned (so it will replace the standard summon effect). Then do what I want when this particular effect is removed (like doing the exact same thing that when the summon effect is removed). Just thinking alone :)

Modifié par anakin5, 31 décembre 2009 - 03:05 .