Hey there,
So, I'm using a trigger on the floor, just after a door, that does this same door be closed and locked.
I would like that when this door is closed, the player would suffer HP damage. The catch is that the "deal damage" function can't be on the trigger at the floor, I need it to be on the door. I tried to create a simple script that deals damage do the pc and put it "on closed" at the door properties, it compiles ok but it isnt working... the script that I'm trying to use on the door is bellow. Anyone has any ideas?
void main(){
object PC;
effect eEffect;
eEffect = EffectDamage(3, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, PC);
FloatingTextStringOnCreature("Consequence to door closing is ok", PC);
}
problem trying to make one script trigger another
Débuté par
el.sombrero
, juil. 28 2012 02:57
#1
Posté 28 juillet 2012 - 02:57
#2
Posté 28 juillet 2012 - 11:24
- a line seems missing:
PC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
PC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
#3
Posté 02 août 2012 - 10:03
Lets try it... and YES, now it is working!
Can you explain me why this line is necessary. I thought that "object PC" automatically setted the player as object to that effect.
thx!
Can you explain me why this line is necessary. I thought that "object PC" automatically setted the player as object to that effect.
thx!
#4
Posté 02 août 2012 - 10:19
object oPC;
is only a declaration. "I declare there will be object_variable, oPC!" At that point, the compiler says, yeh okay so what?
So you have to tell Mr. compiler, "I hereby define object_variable oPC as GetNearestCreature(...)!"
then the compiler goes, i can work with that. Only then can you go on to say what to do with oPC .....
[ look what you did there with eEffect : same thing. ]
Modifié par kevL, 02 août 2012 - 10:21 .
#5
Posté 02 août 2012 - 10:25
If oPC were a predefined constant you could get away with it. But as it is it's just a variable and needs a user-made definition
#6
Posté 06 août 2012 - 09:41
Uhm... I thought that if I typed "PC" instead of "oPC" I would be appealing to a constant, instead of a variable.. How do I refer to the player constant? do I have to create it?
#7
Posté 06 août 2012 - 10:03
I've always defined it. There are some string constants defined in 'ginc_param_const' that seem to rely on internal workings of the engine, but they're strings. So unless oPC is conveniently OBJECT_SELF there are a handful of functions that can be used ...
more
+ SetOwnersControlledCompanion( )
- that prolly covers it
more
+ SetOwnersControlledCompanion( )
- that prolly covers it
Modifié par kevL, 06 août 2012 - 10:08 .





Retour en haut






