What would I need to add to my area script to only spawn this creature if it isn't already present? Right now if I die and go back there is 2 of them and so on.
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{
object oWaypoint = GetObjectByTag("enemy_team");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"knight.utc", lWaypoint);
}
Spawn script
Débuté par
jsd313
, janv. 09 2010 09:11
#1
Posté 09 janvier 2010 - 09:11
#2
Posté 09 janvier 2010 - 10:24
Just use a plot? Check if it's false, if it is spawn the creature and set it to true.
#3
Posté 09 janvier 2010 - 10:26
[dascript]case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "TAG_of_Knight_goes_here" )))
CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint )));
}[/dascript]
I think that's what you want...plug in the tag of your knight guy where indicated there.
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "TAG_of_Knight_goes_here" )))
CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint )));
}[/dascript]
I think that's what you want...plug in the tag of your knight guy where indicated there.
Modifié par Axe_Murderer, 09 janvier 2010 - 10:32 .
#4
Posté 09 janvier 2010 - 11:15
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "enemy" )))
CreateObject( OBJECT_TYPE_CREATURE, R"knight.utc", GetSafeLocation( GetLocation( oWaypoint )));
}
break;
}
compiles and exports but nothing spawns in the area now.
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "enemy" )))
CreateObject( OBJECT_TYPE_CREATURE, R"knight.utc", GetSafeLocation( GetLocation( oWaypoint )));
}
break;
}
compiles and exports but nothing spawns in the area now.
#5
Posté 09 janvier 2010 - 11:55
Try this one...
[dascript]
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialKnight" )))
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint ))), "SpecialKnight" );
}
[/dascript]
[dascript]
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
if( IsObjectValid( oWaypoint ) &&
!IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialKnight" )))
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint ))), "SpecialKnight" );
}
[/dascript]
#6
Posté 10 janvier 2010 - 12:13
Still not spawning the creature, hmm. Anyway to on EXIT destroy the creature if it still exist?
#7
Posté 10 janvier 2010 - 12:17
I'm thinking it's not finding the waypoint. Are you sure that tag is correct and unique?
#8
Posté 10 janvier 2010 - 12:18
its unique to my module which is standalone yes. I can try changing it real fast.
#9
Posté 10 janvier 2010 - 12:23
lol well my bad I had the waypoint wrong, I hadn't changed it on that test script.
It did spawn the knight, I killed him but when I went back in he didn't respawn. Was gonna let him kill me see if there would be 2 next time in.
Any idea why he won't respawn when i enter the area again?
It did spawn the knight, I killed him but when I went back in he didn't respawn. Was gonna let him kill me see if there would be 2 next time in.
Any idea why he won't respawn when i enter the area again?
#10
Posté 10 janvier 2010 - 12:29
When you kill him is he still there lying dead on the ground?
If so, you can try this:
[dascript]
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
object oKnight = UT_GetNearestObjectByTag( oWaypoint, "SpecialKnight" );
if( IsObjectValid( oWaypoint ) && (!IsObjectValid( oKnight ) || IsDead( oKnight )) )
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint ))), "SpecialKnight" );
}[/dascript]
But you'll still have problems if you let those dead bodies build up.
If so, you can try this:
[dascript]
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "enemy_team" );
object oKnight = UT_GetNearestObjectByTag( oWaypoint, "SpecialKnight" );
if( IsObjectValid( oWaypoint ) && (!IsObjectValid( oKnight ) || IsDead( oKnight )) )
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R "knight.utc", GetSafeLocation( GetLocation( oWaypoint ))), "SpecialKnight" );
}[/dascript]
But you'll still have problems if you let those dead bodies build up.
Modifié par Axe_Murderer, 10 janvier 2010 - 12:37 .
#11
Posté 10 janvier 2010 - 12:41
Ok now its doing what my original script did,but if I died and came back the original knight was there with 50% life and a new one had spawned.
#12
Posté 10 janvier 2010 - 12:44
Yeah I have been looking at solutions for the corpses for awhile, not much can be done. I need to much help with setting up a team array and then setting up resurrection stuff.. Ideally it would be nice if i could make it load the area fresh everytime
#13
Posté 10 janvier 2010 - 12:52
hmm, i have a very basic script to send me to my areas triggered from a conversation.
void main()
{
DoAreaTransition("cc", "cc");
}
Is there anything I can do to make it load the area as if it's the first time? That would solve all my problems with bodies and extra creatures after party wipes.
Thanks a lot for your help man
void main()
{
DoAreaTransition("cc", "cc");
}
Is there anything I can do to make it load the area as if it's the first time? That would solve all my problems with bodies and extra creatures after party wipes.
Thanks a lot for your help man
#14
Posté 10 janvier 2010 - 12:54
No you have to manually clear the area and do everything necessary to reset it back. Sounds like what you need to do is spawn everything in the area enter event and destroy everything in the area exit event...unconditionally.
Modifié par Axe_Murderer, 10 janvier 2010 - 01:02 .
#15
Posté 10 janvier 2010 - 12:58
Yeah problem is i have over 30 creatures and then several areas to edit if I make changes heh.
#16
Posté 10 janvier 2010 - 01:01
bah commented to your orig comment, but yeah If I can set it up so when I enter it spawns them and when i leave no matter how it clears them. Here is one of my full working area scripts.
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
string sDebug;
int nEventHandled = FALSE;
switch(nEventType)
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{
object oWaypoint = GetObjectByTag("cod4v4_team1");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"warrior01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team2");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"priest01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team3");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"hunter01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team4");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"mage02.utc", lWaypoint);
}
break;
}
switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
DoAreaTransition("arena", "cod");
nEventHandled = TRUE; //set this if no further action is required for this event
break;
}
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}
}
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
string sDebug;
int nEventHandled = FALSE;
switch(nEventType)
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{
object oWaypoint = GetObjectByTag("cod4v4_team1");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"warrior01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team2");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"priest01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team3");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"hunter01.utc", lWaypoint);
}
{
object oWaypoint = GetObjectByTag("cod4v4_team4");
location lWaypoint = GetLocation(oWaypoint);
object o = CreateObject(OBJECT_TYPE_CREATURE, R"mage02.utc", lWaypoint);
}
break;
}
switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
DoAreaTransition("arena", "cod");
nEventHandled = TRUE; //set this if no further action is required for this event
break;
}
}
if (!nEventHandled) //If this event wasn't handled by this script, let the core script try
{
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}
}
Modifié par jsd313, 10 janvier 2010 - 01:01 .
#17
Posté 10 janvier 2010 - 01:18
Heh...wish you woodda posted that sooner. Try this instead:
[dascript]
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"warrior01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialWarrior01" );
oWaypoint = GetObjectByTag( "cod4v4_team2" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"priest01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialPriest01" );
oWaypoint = GetObjectByTag( "cod4v4_team3" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"hunter01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialHunter01" );
oWaypoint = GetObjectByTag( "cod4v4_team4" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"mage02.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialMage02" );
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
DoAreaTransition( "arena", "cod" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
[/dascript]
[dascript]
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"warrior01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialWarrior01" );
oWaypoint = GetObjectByTag( "cod4v4_team2" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"priest01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialPriest01" );
oWaypoint = GetObjectByTag( "cod4v4_team3" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"hunter01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialHunter01" );
oWaypoint = GetObjectByTag( "cod4v4_team4" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"mage02.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialMage02" );
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
DoAreaTransition( "arena", "cod" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
[/dascript]
Modifié par Axe_Murderer, 10 janvier 2010 - 02:44 .
#18
Posté 10 janvier 2010 - 01:36
Still spawning a second one.
Modifié par jsd313, 10 janvier 2010 - 01:36 .
#19
Posté 10 janvier 2010 - 01:43
[dascript]
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"warrior01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialWarrior01" );
oWaypoint = GetObjectByTag( "cod4v4_team2" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"priest01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialPriest01" );
oWaypoint = GetObjectByTag( "cod4v4_team3" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"hunter01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialHunter01" );
oWaypoint = GetObjectByTag( "cod4v4_team4" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"mage02.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialMage02" );
}
break;
case EVENT_TYPE_EXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{ DoAreaTransition( "arena", "cod" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
[/dascript]
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"warrior01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialWarrior01" );
oWaypoint = GetObjectByTag( "cod4v4_team2" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"priest01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialPriest01" );
oWaypoint = GetObjectByTag( "cod4v4_team3" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"hunter01.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialHunter01" );
oWaypoint = GetObjectByTag( "cod4v4_team4" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"mage02.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "SpecialMage02" );
}
break;
case EVENT_TYPE_EXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{ DoAreaTransition( "arena", "cod" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
[/dascript]
Modifié par Axe_Murderer, 10 janvier 2010 - 02:42 .
#20
Posté 10 janvier 2010 - 01:52
Still not clearing them under EVENT_TYPE_EXIT
#21
Posté 10 janvier 2010 - 02:02
I have all my enemy creatures set to the same team ID, maybe I can do Safe_Destroy_Object on a team ID. This is by far one of my biggest issues to overcome for this mod. Such tough stuff.
#22
Posté 10 janvier 2010 - 02:16
Replace exit event code with this:
[dascript]
case EVENT_TYPE_EXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
string sWarning = "Exiting area. Waypoint 'cod4v4_team1' ";
if( IsObjectValid( oWaypoint )) sWarning += "was found successfully.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Warrior 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Priest 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Hunter 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Mage 02 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ))) sWarning += "was found.";
else sWarning += "does not exist.";
Warning( sWarning );
}
break;
[/dascript]
See what that spits out when you run it.
[dascript]
case EVENT_TYPE_EXIT:
{ object oWaypoint = GetObjectByTag( "cod4v4_team1" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ), 0 );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ), 0 );
string sWarning = "Exiting area. Waypoint 'cod4v4_team1' ";
if( IsObjectValid( oWaypoint )) sWarning += "was found successfully.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Warrior 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialWarrior01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Priest 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialPriest01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Hunter 01 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialHunter01" ))) sWarning += "was found.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Mage 02 ";
if( IsObjectValid( UT_GetNearestObjectByTag( oWaypoint, "SpecialMage02" ))) sWarning += "was found.";
else sWarning += "does not exist.";
Warning( sWarning );
}
break;
[/dascript]
See what that spits out when you run it.
Modifié par Axe_Murderer, 10 janvier 2010 - 02:45 .
#23
Posté 10 janvier 2010 - 02:40
i don't get any messages, killed them all and then tried letting them kill me.
#24
Posté 10 janvier 2010 - 02:47
testing with this script now but still no results.
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "test" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"knight.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "enemy" );
}
break;
case EVENT_TYPE_EXIT:
{
object oWaypoint = GetObjectByTag( "test" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "enemy" ), 0 );
string sWarning = "Exiting area. Waypoint 'test' ";
if( IsObjectValid( oWaypoint )) sWarning += "was found successfully.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Warrior 01 ";
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{
DoAreaTransition( "arena", "duels" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "var_constants_h"
void main()
{ int nEventHandled = FALSE;
switch( GetEventType( GetCurrentEvent() ))
{
case EVENT_TYPE_AREALOAD_PRELOADEXIT:
{ object oWaypoint = GetObjectByTag( "test" );
SetTag( CreateObject( OBJECT_TYPE_CREATURE, R"knight.utc", GetSafeLocation( GetLocation( oWaypoint )) ), "enemy" );
}
break;
case EVENT_TYPE_EXIT:
{
object oWaypoint = GetObjectByTag( "test" );
Safe_Destroy_Object( UT_GetNearestObjectByTag( oWaypoint, "enemy" ), 0 );
string sWarning = "Exiting area. Waypoint 'test' ";
if( IsObjectValid( oWaypoint )) sWarning += "was found successfully.";
else sWarning += "does not exist.";
sWarning += "\\\\nSpecial Warrior 01 ";
}
break;
case EVENT_TYPE_TEAM_DESTROYED:
{
DoAreaTransition( "arena", "duels" );
nEventHandled = TRUE; // set this if no further action is required for this event
}
break;
}
// If this event wasn't handled by this script, let the core script try
if ( !nEventHandled ) HandleEvent( GetCurrentEvent(), RESOURCE_SCRIPT_AREA_CORE );
}
#25
Posté 10 janvier 2010 - 02:53
You left out the call to Warning() in there.
I guess EVENT_TYPE_EXIT isn't the right one. I can't find any useful information about those EVENT constants anywhere. The wiki says areas are supposed to receive that one but looks like that isn't the case. You should get a message every time you leave the area. I think the code is right but the event is wrong so it isn't running that cleanup stuff.
Maybe Warning() isn't the right function. There's some others you could try instead:
DEBUG_PrintToScreen( sWarning );
PrintString( sWarning );
PrintToLogWindow( sWarning );
I guess EVENT_TYPE_EXIT isn't the right one. I can't find any useful information about those EVENT constants anywhere. The wiki says areas are supposed to receive that one but looks like that isn't the case. You should get a message every time you leave the area. I think the code is right but the event is wrong so it isn't running that cleanup stuff.
Maybe Warning() isn't the right function. There's some others you could try instead:
DEBUG_PrintToScreen( sWarning );
PrintString( sWarning );
PrintToLogWindow( sWarning );
Modifié par Axe_Murderer, 10 janvier 2010 - 03:13 .





Retour en haut






