Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger script when using any laudanum
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
RE: Trigger script when using any laudanum

Okay, I just so happen to be an expert in this subject. (Not really, but I did recently learn the "for" loop)

From my very basic understanding of the for loop, I came up with this for your script:

for(int i=1;i<=7;i++)
AddUseItemCallback(string& asName, string& asItem, string& asEntity, string& asFunction, bool abAutoDestroy);


replace the 7 in "for" part with the total amount of laudanums in your script, +1 (for example, if you had 20 laudanums in your map, the number would be 21).

To place this in your script, you will have to modify the item name slightly. The standard name for the laudanum is :

"potion_health_1"

Now, what you need to do is replace the "1" with "+i", but make sure it is out of the quotations. it should now look like:

"potion_health_"+i

This makes the game recognize all of these same items within the for loop as compatible for the adduseitemcallback.


here's an example of a chair puzzle I am using in my current mod, allowing the player to throw any of the 6 chairs in the room through the window and triggering the script (do not copy this script for your own uses or I will sacrifice you to the Sun God, Ra.)



for(int i=1;i<=7;i++)
AddEntityCollideCallback("chair_"+i, "AreaBreakWindow", "CollideAreaBreakWindow", true, 1);


Hope that helped!

I rate it 3 memes.
06-06-2012, 09:10 PM
Find


Messages In This Thread
RE: Trigger script when using any laudanum - by Adny - 06-06-2012, 09:10 PM



Users browsing this thread: 1 Guest(s)