zergling50
Member
Posts: 74
Threads: 9
Joined: Jul 2012
Reputation:
1
|
RE: Custom Story Script Problems
(07-15-2012, 04:43 PM)zergling50 Wrote: (07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);
I dont think you can write 'entity' in there, without having an object in your map called: entity.
If you have an object called: entity, then you have to put these "" around the word.
SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);
In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".
Something like that, instead of entity The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.
(07-15-2012, 04:43 PM)zergling50 Wrote: (07-15-2012, 04:01 PM)beecake Wrote: PlaySoundAtEntity("", "unlock_door", entity, 0, false);
SetSwingDoorLocked(entity, false, true);
I dont think you can write 'entity' in there, without having an object in your map called: entity.
If you have an object called: entity, then you have to put these "" around the word.
SetSwingDoorLocked("entity", false, true);
PlaySoundAtEntity("", "unlock_door", "entity", 0, false);
In this case: [ SetSwingDoorLocked("entity", false, true); ] you are using a door. If you haven't changed your door name then it would be something like "mansion_1" or "castle_1".
Something like that, instead of entity The guy I saw in the tutorial said that it was more efficient to do this because then you can reuse the code and not have to make a new code for each door and key you make. Ill try though and tell you in a second if it works.
It still did not work, although I had a feeling this would be so as I did not change it to the entity and item thing until after it wasnt working originally. Anyone else? I have no idea whats going on and it is quite confusing, I just want to be able to make games. Any support or help is greatly appreceated! Thanks!
CURRENT CODE:
////////////////////////////
// Run when starting map
void OnStart()
{
AddUseItemCallback("OpenDoor", "key", "castle_1", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("key", "ActivateMonster", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
void ActivateMonster(string &in asItem)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "Idle");
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem("key");
} I just double checked my code with someone else's code in their custom story that I have played and know works and it is pretty much the exact same. Is there a possibility that it is something wrong with something I did in the editor and not the coding? But then again, I dont know if that would make sense as even the grunt code will not work. I am completely clueless, its as if my computer refuses to read the file and is ignoring it. I get absolutely no errors but nothing happens. Did I miss a download or do I need something else? I am completely clueless. Please help!
EDIT: I can provide screenshots of leveleditor if needed
(This post was last modified: 07-15-2012, 05:00 PM by zergling50.)
|
|