| Both sides previous revision Previous revision | |||
|
hpl2:tutorials:scripting:triggering_monsters_on_entities [2011/07/21 18:49] jenniferorange |
hpl2:tutorials:scripting:triggering_monsters_on_entities [2011/07/21 18:50] (current) jenniferorange |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | __**<font 18pt:normal/Arial;;inherit;;inherit >Setting Up The Room(s)</font> ** __ | + | __**<font 18pt:normal/Arial;;inherit;;inherit >Setting Up The Room(s)</font> ** __ |
| Line 8: | Line 8: | ||
| - | __**<font 18pt:normal/Arial;;inherit;;inherit >Scripting It</font> ** __ | + | __**<font 18pt:normal/Arial;;inherit;;inherit >Scripting It</font> ** __ |
| Line 17: | Line 17: | ||
| - | <code actionscript> | + | <code actionscript>void OnStart() |
| - | void OnStart() | + | |
| { | { | ||
| AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | ||
| Line 27: | Line 26: | ||
| - | <code actionscript> | + | <code actionscript>void OnStart() |
| - | void OnStart() | + | |
| { | { | ||
| AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | ||
| - | SetEntityCallbackFunc("key_1", "**OnPickup**"); | + | SetEntityCallbackFunc("key_1", "OnPickup"); |
| } | } | ||
| </code> | </code> | ||
| Line 37: | Line 35: | ||
| **OnPickup ** is the name of the function we are going to call. Now we can finish scripting the key.. | **OnPickup ** is the name of the function we are going to call. Now we can finish scripting the key.. | ||
| - | + | <code actionscript>void OnStart() | |
| - | + | ||
| - | <code actionscript> | + | |
| - | void OnStart() | + | |
| { | { | ||
| - | AddUseItemCallback("key_1", "**locked_do** **or1**", "UsedKeyOnDoor", true); | + | AddUseItemCallback("key_1", "locked_door1", "UsedKeyOnDoor", true); |
| SetEntityCallbackFunc("key_1", "OnPickup"); | SetEntityCallbackFunc("key_1", "OnPickup"); | ||
| } | } | ||
| void UsedKeyOnDoor(string &in asItem, string &in asEntity) | void UsedKeyOnDoor(string &in asItem, string &in asEntity) | ||
| { | { | ||
| - | SetSwingDoorLocked("**locked_door1**", false, true); | + | SetSwingDoorLocked("locked_door1", false, true); |
| PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false); | PlaySoundAtEntity("", "unlock_door.snt", "locked_door1", 0, false); | ||
| RemoveItem("key_1"); | RemoveItem("key_1"); | ||
| Line 60: | Line 55: | ||
| - | <code actionscript> | + | <code actionscript>void OnStart() |
| - | void OnStart() | + | |
| { | { | ||
| AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); | ||
| - | SetEntityCallbackFunc("key_1", "**OnPickup**"); | + | SetEntityCallbackFunc("key_1", "OnPickup"); |
| } | } | ||
| void UsedKeyOnDoor(string &in asItem, string &in asEntity) | void UsedKeyOnDoor(string &in asItem, string &in asEntity) | ||
| Line 72: | Line 66: | ||
| RemoveItem("key_1"); | RemoveItem("key_1"); | ||
| } | } | ||
| - | void **OnPickup** (string &in asEntity, string &in type) | + | void OnPickup(string &in asEntity, string &in type) |
| { | { | ||
| SetEntityActive("monster_grunt", true); | SetEntityActive("monster_grunt", true); | ||