I want to have my character get healed by picking up an object. Will this script
below work.
void main()
{
string sTag = GetLocalString(GetModule(),"RUNSCRIPT_VAR");
object oCreature = GetObjectByTag(sTag);
effect eHeal = EffectHeal(25.0f)
}
Heal character by picking up object
Débuté par
Sonmeister
, mai 06 2010 02:43
#1
Posté 06 mai 2010 - 02:43
#2
Posté 06 mai 2010 - 02:24
Hi Sonmeister,
I don't understand what you mean exactly with "picking up an object". Could you give me an example?
Anyway, if what you have in mind is something like a healing fountain, a placeable that after being clicked heals the controlled character, you can attach the following script to your placeable.
I don't understand what you mean exactly with "picking up an object". Could you give me an example?
Anyway, if what you have in mind is something like a healing fountain, a placeable that after being clicked heals the controlled character, you can attach the following script to your placeable.
#include "placeable_h"
const float POINTS_TO_HEAL = 25.0f;
const int VFX_HEAL_ID = 1021;
void main(){
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
// If TRUE, we won't redirect to rules core
int bEventHandled = FALSE;
switch (nEvent)
{
//---------------------------------------------------------------------
// Sent by engine when creature clicks on the placeable.
//---------------------------------------------------------------------
case EVENT_TYPE_USE:
bEventHandled = TRUE;
effect eHeal = EffectHeal(POINTS_TO_HEAL);
object oPlayer = GetMainControlled();
ApplyEffectOnObject(EFFECT_DURATION_TYPE_INSTANT, eHeal, oPlayer);
ApplyEffectVisualEffect(OBJECT_SELF, oPlayer, VFX_HEAL_ID, EFFECT_DURATION_TYPE_INSTANT, 0.0f);
break;
}
// -------------------------------------------------------------------------
// Any event not handled falls through to rules_core:
// -------------------------------------------------------------------------
if (!bEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_PLACEABLE_CORE);
}
}
Modifié par _L_o_B_o_, 06 mai 2010 - 02:28 .
#3
Posté 06 mai 2010 - 03:28
That should work!





Retour en haut






