PDA

View Full Version : Problem with Script Execution


harIII
09-24-2009, 06:40 PM
I'm creating a series of scripts which result in the game crashing.

What's happening is that when you open a door, a force of energy will zap a waypoint and spawn a Sith Apprentice over and over every 10 seconds. What you have to do is find a footlocker and retrieve a bomb to detonate the already opened door from where the Sith run out from.

To detonate the door you open an invisible placeable that is sitting on top of a door that is already opened, place the bomb and it is suppose to:
1. destroy the invisible placeable
2. destroy the waypoint that is used to spawn the Sith
3. close the door that the invisible placeable sits on and play a series of explosions
4. open a third door that is locked

This is my execute script that is triggered once the invisible placeable's inventory has been altered:
void main() {
ExecuteScript("close_block", OBJECT_SELF);
ExecuteScript("open_lockeddr", OBJECT_SELF);
ExecuteScript("remove_mech", OBJECT_SELF);
ExecuteScript("remove_spawn", OBJECT_SELF);
ExecuteScript("destroy_door1", OBJECT_SELF);
}
This is the script "close_block"
void main() {
object oDoor1 = GetObjectByTag("block_door");
DelayCommand(4.5, AssignCommand(oDoor1, ActionCloseDoor(oDoor1)));
}

block_door is the tag of the door that is automatically opened when you enter the module, the door that the sith come out from.
This is the script "open_lockeddr"
void main() {
object oDoor2 = GetObjectByTag("k38b_dor_locked");
DelayCommand(4.5, AssignCommand(oDoor2, ActionOpenDoor(oDoor2)));
}

k38b_dor_locked is the door that is locked and is opened when you place the bomb in the invisible placeable.
This is the script "remove_mech"
void main() {
object oMech = GetObjectByTag("mechanism");
AssignCommand (oMech,ActionDoCommand(DestroyObject(oMech)));
}
mechanism is the name of the invisible placeable that is used to place the bomb inside.
This is the script "remove_spawn"
void main() {
object oSpawn = GetWaypointByTag("way_spawn");
AssignCommand (oSpawn,ActionDoCommand(DestroyObject(oSpawn)));
}
way_spawn is the name of the way point that is used to spawn the sith.
This is the script "destroy_door1"
void main() {
object oDoor1 = GetObjectByTag("block_door");
location location1 = GetLocation(oDoor1);

effect eBlast1 = EffectVisualEffect(3003);
effect eBlast2 = EffectVisualEffect(3007);
effect eBlast3 = EffectVisualEffect(3009);
effect eBlast4 = EffectVisualEffect(3005);
effect eBlast5 = EffectVisualEffect(3010);
effect eRocks1 = EffectVisualEffect(3014);
effect eRocks2 = EffectVisualEffect(3015);
effect eVis1 = EffectVisualEffect(2047);

ApplyEffectToObject(1, eVis1, oDoor1, 0.0);
ApplyEffectToObject(1, eBlast1, oDoor1, 0.0);
DelayCommand(1.0, ApplyEffectAtLocation(1, eBlast2, location1, 0.0));
DelayCommand(2.0, ApplyEffectAtLocation(1, eBlast3, location1, 0.0));
DelayCommand(3.0, ApplyEffectAtLocation(1, eBlast4, location1, 0.0));
DelayCommand(4.0, ApplyEffectAtLocation(1, eBlast5, location1, 0.0));
DelayCommand(1.5, ApplyEffectAtLocation(1, eRocks1, location1, 0.0));
DelayCommand(2.5, ApplyEffectAtLocation(1, eRocks1, location1, 0.0));
DelayCommand(4.5, ApplyEffectAtLocation(1, eRocks2, location1, 0.0));
}

block_door is the tag of the door that is automatically opened when you enter the module, the door that the sith come out from.

Does anybody know what's going on? Again the question is how to stop the game from crashing when you click on the mechanism/invisible placeable.

Star Admiral
09-24-2009, 11:52 PM
Try combining some of the scripts together. I'm not sure if the game likes to have that many ExecuteScripts() functioning at the same time. Barring that, try removing some of the visual effects and see if the game functions better.

- Star Admiral

harIII
09-25-2009, 09:46 AM
I did what you said and tried to combine the scripts and this is what I now have:
void main() {
object oDoor1 = GetObjectByTag("block_door");
location location1 = GetLocation(oDoor1);
object oDoor2 = GetObjectByTag("k38b_dor_locked");
object oSpawn = GetWaypointByTag("way_spawn");
object oSith = GetObjectByTag("sith");
object oMech = GetObjectByTag("mechanism");

effect eBlast1 = EffectVisualEffect(3003);
effect eBlast2 = EffectVisualEffect(3007);
effect eBlast3 = EffectVisualEffect(3009);
effect eBlast4 = EffectVisualEffect(3005);
effect eRocks1 = EffectVisualEffect(3014);
effect eRocks2 = EffectVisualEffect(3015);

DelayCommand(1.0, ApplyEffectToObject(1, eBlast1, oDoor1, 0.0));
DelayCommand(2.0, ApplyEffectToObject(1, eBlast2, oDoor1, 0.0));
DelayCommand(3.0, ApplyEffectToObject(1, eBlast3, oDoor1, 0.0));
DelayCommand(4.0, ApplyEffectToObject(1, eBlast4, oDoor1, 0.0));
DelayCommand(1.5, ApplyEffectToObject(1, eRocks1, oDoor1, 0.0));
DelayCommand(2.5, ApplyEffectToObject(1, eRocks1, oDoor1, 0.0));
DelayCommand(4.5, ApplyEffectToObject(1, eRocks2, oDoor1, 0.0));

AssignCommand (oSpawn,ActionDoCommand(DestroyObject(oSpawn)));
AssignCommand (oSith,ActionDoCommand(DestroyObject(oSith)));
AssignCommand (oMech,ActionDoCommand(DestroyObject(oMech)));
DelayCommand(4.5, AssignCommand(oDoor1, ActionCloseDoor(oDoor1)));
DelayCommand(4.5, AssignCommand(oDoor2, ActionOpenDoor(oDoor2)));
}
I did find out however that the runtime error was with the mechanism which somehow was spawning without an entry in the .git file but the script itself isn't taking effect. There are no signs of anything happening with it.