Jump to content

Set target event?


Rick
 Share

Recommended Posts

So to set a target you drag an entity to another. Does this trigger any sort of event in the receiving target entity or is there a way I can force the Spawn() method to be called? The reason I ask is because I'm playing around with a switch criteria to determine what scripts to play for a volume trigger. My idea is that this could be designed in the editor. Let's say I have 2 switches in my scene. I name them, "TookCamera" and "KilledGuard". I then would like to make these 2 targets of my volume trigger. The reason I want to know about this event inside my volume trigger is so that I can actually add a property radio button for the switch that gets added with the name of the switch.

 

This way in the properties of the volume trigger I can say run this function on collision IF TookCamera is ON and KilledGuard is OFF and run this other function on collision if TookCamera is OFF and KilledGuard is ON etc. This would allow some pretty dynamic gameplay and all we would need to make it work is some kind of way of knowing when a target was added/removed.

Link to comment
Share on other sites

Oh wow, I completely forgot that now that we can have Lua scripted entities we can code up Logic entities.

 

I will throw some together and post them up for others to utilize.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

That's possible also. Is there currently a way to know when a target is set, or would I need to poll in the Update() method to search for targets assigned to the entity?

 

I was just thinking the volume trigger would have come properties like:

 

CollideScriptFile = "mycollide.lua"

CollisionOption1 -- these options could be static or maybe dynamic if possible

Function = "MyCollide1" -- what function to run that is in mycollide.lua

TookCamera On/Off -- this is what I was talking about. TookCamera would be the name of a switch you dragged into your scene. When you make it the target of this trigger it would dynamically add this property setting

KilledGuard On/Off

 

CollisionOption2

Function = "MyCollide2"

TookCamera On/Off

KilledGuard On/Off

 

CollisionOption3

Function = "MyCollide3"

TookCamera On/Off

KilledGuard On/Off

 

 

So what this is saying is when the player collides with this volume trigger, it would run different scripts based on the settings of some switches.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...