In my earlier post I was having problems getting the placeable when clicked on to make a creature appear with
SetObjectActive(oCreature, TRUE), so I wrote the script below which works to make the creatures appear but they do not attack. They are hostile but just stand and make mean gestures (not with that finger either)... any ideas?
// Working Script
#include "placeable_h"
//const string SARC_UNDEAD = "my_ruins_undead";
const int SARC_UNDEAD = 15;
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
UT_TeamAppears(SARC_UNDEAD);
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 doesn't quite work
Débuté par
Sonmeister
, juin 01 2010 01:19
#1
Posté 01 juin 2010 - 01:19
#2
Posté 01 juin 2010 - 03:32
One thing that can cause a creature to be hostile but not attack is if there isn't valid pathfinding between it and the player. You can quickly check where the valid pathfinding is in the area by selecting view - environment - pathfnding points.
The other main thing to check is that the creature is using creature_core. If it has a custom script, make sure the custom script is allowing all events to pass down to creature_core.
If you're not entering combat mode at all, then the PC's group and the creature's group probably aren't hostile to each other. Can the PC attack other creatures placed in the area that are in the hostile group?
The other main thing to check is that the creature is using creature_core. If it has a custom script, make sure the custom script is allowing all events to pass down to creature_core.
If you're not entering combat mode at all, then the PC's group and the creature's group probably aren't hostile to each other. Can the PC attack other creatures placed in the area that are in the hostile group?
#3
Posté 02 juin 2010 - 05:04
I'm quite baffled by your problem. I have no idea why the area itself is causing a difference, or why grabbing the object by tag isn't working.
Is it possible that something is happening in the one area but not the other, maybe a trigger you run through or something on the area script? Some thing that's effecting either the hostility of the group or somehow altering the creatures in any way? Do both areas have a script, either area_core or something that falls through to that? Maybe that's affecting the spawn/levelup behavior?
The only other thing I can think of is the combatant flag on the creatures. A creature flagged as combatant false won't fight properly. However, that's set on the template, so moving the creatures between areas shouldn't affect that.
Is it possible that something is happening in the one area but not the other, maybe a trigger you run through or something on the area script? Some thing that's effecting either the hostility of the group or somehow altering the creatures in any way? Do both areas have a script, either area_core or something that falls through to that? Maybe that's affecting the spawn/levelup behavior?
The only other thing I can think of is the combatant flag on the creatures. A creature flagged as combatant false won't fight properly. However, that's set on the template, so moving the creatures between areas shouldn't affect that.





Retour en haut






