My script below is attached to a placeable and I have a creature with Active set to False. When you click on the placeable nothing happens. Am I missing something, perhaps a variable on the placeable or script that I need to set?
#include "placeable_h"
const string SARC_UNDEAD = "my_ruins_undead";
void main()
{
event ev = GetCurrentEvent();
int nEvent = GetEventType(ev);
int nEventHandled = FALSE; //keep track of whether the event has been handled
switch (nEvent)
{
//---------------------------------------------------------------------
// Sent by engine when creature clicks on the placeable.
//---------------------------------------------------------------------
case EVENT_TYPE_USE:
object oCreature = GetObjectByTag(SARC_UNDEAD);
SetObjectActive(oCreature, TRUE); //your special code goes here
nEventHandled = TRUE;
break;
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_PLACEABLE_CORE);
}
}
Script compiles but not working with placeable
Débuté par
Sonmeister
, mai 31 2010 09:45
#1
Posté 31 mai 2010 - 09:45
#2
Posté 31 mai 2010 - 11:18
Possibilities I can think of:
1. The script isn't hooked up to the placeable
2. The placeable or the script hasn't been exported
3. The tag is incorrect
4. There is more than one creature with that tag
5. The pc isn't getting close enough to the placeable, and no use event is firiing.
The script compiles, so number 2 seems unlikely, and you said the script is hooked up, so if you double check that we can eliminate 1. If the player is walking up and you've clicked multiple times, 3 probably isn't the issue.
After double checking the tags, my next move would be to make the script is running at all, and see if you can get that script to do something. Log messages would work if you know how to use them. You could also put some simple actions, maybe a SetObjectInteractive(OBJECT_SELF, FALSE), to see if you can still click on it. If you can’t get the script to do anything at all, then you know the problem isn’t inside the script.
1. The script isn't hooked up to the placeable
2. The placeable or the script hasn't been exported
3. The tag is incorrect
4. There is more than one creature with that tag
5. The pc isn't getting close enough to the placeable, and no use event is firiing.
The script compiles, so number 2 seems unlikely, and you said the script is hooked up, so if you double check that we can eliminate 1. If the player is walking up and you've clicked multiple times, 3 probably isn't the issue.
After double checking the tags, my next move would be to make the script is running at all, and see if you can get that script to do something. Log messages would work if you know how to use them. You could also put some simple actions, maybe a SetObjectInteractive(OBJECT_SELF, FALSE), to see if you can still click on it. If you can’t get the script to do anything at all, then you know the problem isn’t inside the script.
#3
Posté 31 mai 2010 - 11:20
Just a question relating to Phaenan's advice, is this an object placed in your own area, or an object spawned into the main campaign using PRCSCR/area load scripts? Also, are you testing from a save game, or starting fresh when you test?





Retour en haut






