31
Technical forum / Kill off an enemy with spell
« on: February 10, 2009, 06:21:35 AM »
I have set up an object (sprite) in a scene. It's a monster and I want to kill it with a spell.
I have no problem getting rid it if I use this script on the monster--you fight it to death.
Works fine.
But I have a spell system I'd like to work with and rather than kill off the monster by clicking on it, I'd rather click on the spell to get rid of the monster.
The spell system is in a window and when I click on the spell in the window--although it seems to be coded alright--nothing happens -- I get an error about my GetControl script for the window that holds the spells but my script to access that seems OK.
If I put the same script on the object I want to begone, everything works fine--I'm a little bit puzzled.
My spells are in a window that's separate from the window that has all the info about the player's and monster's health. I'ts called up when you click on a button called spells in the window that has the info about the player's and monster's health.
I have no problem getting rid it if I use this script on the monster--you fight it to death.
Code: WME Script
- #include "scripts\base.inc"
- on "LeftClick"
- {
- ehealth.Text = 0;
- }
- else
- {
- hud.SubtractHealth(5);
- hud.SubtractEH(10);
- }
- else
- {hud.SubtractHealth(5);
- }
Works fine.
But I have a spell system I'd like to work with and rather than kill off the monster by clicking on it, I'd rather click on the spell to get rid of the monster.
The spell system is in a window and when I click on the spell in the window--although it seems to be coded alright--nothing happens -- I get an error about my GetControl script for the window that holds the spells but my script to access that seems OK.
If I put the same script on the object I want to begone, everything works fine--I'm a little bit puzzled.
My spells are in a window that's separate from the window that has all the info about the player's and monster's health. I'ts called up when you click on a button called spells in the window that has the info about the player's and monster's health.