What object is passed to a trigger?
by Drethon · in Torque Game Engine · 01/03/2009 (3:46 pm) · 5 replies
I'm trying to have a trigger set a flag in the player object that entered the trigger but it looks like the object passed to a trigger is not the player that crossed the trigger as I tried to create a variable in the player script to be set by the trigger and a debug output shows the player never got the variable set.
#2
This is why I'm wondering what the %obj parameter is. This is why I don't like typeless scripts...
01/04/2009 (9:31 am)
That did help, I was able to store the value I wanted in the %client object and re-access it but what if I want an NPC to work with this trigger? Is this %client object accessible by an NPC? If not is it possible instead of storing the value in the %client object can I access a %player object associated with the %obj parameter?This is why I'm wondering what the %obj parameter is. This is why I don't like typeless scripts...
#3
If you want to have an AI activate a trigger, you will have to do a check on what obj entered the trigger.
Is it a:
%player
%AI_player
%something else?
Then do something based on what %obj entered the trigger.
01/04/2009 (9:50 am)
%obj is whatever object entered the trigger. If you want to have an AI activate a trigger, you will have to do a check on what obj entered the trigger.
Is it a:
%player
%AI_player
%something else?
Then do something based on what %obj entered the trigger.
#4
Thanks
01/04/2009 (10:18 am)
All of which I believe will inherit from GameBase, is there a way to set a variable in this parent datablock that can be common to all? (I'm still learning torque scripting).Thanks
#5
01/13/2009 (10:41 am)
Trigger callbacks are invoked on the server, correct? Shouldn't you just be able to set %obj.someAttribute = 5;?
Torque Owner Jacob Williams
datablock TriggerData(DungeonTrigger) { tickPeriodMS = 100; }; function DungeonTrigger::onEnterTrigger(%this,%trigger,%obj) { Parent::onEnterTrigger(%this,%trigger,%obj); %name = %obj.client.namebase; if (%obj.client) messageClient(%obj.client, 'MsgDungeon', '\c0 %1 %2',%trigger.nameTag ,%name); } function DungeonTrigger::onLeaveTrigger(%this,%trigger,%obj) { Parent::onLeaveTrigger(%this,%trigger,%obj); } function DungeonTrigger::onTickTrigger(%this,%trigger) { Parent::onTickTrigger(%this,%trigger); }Hope this helps!