Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
Tinderbox inventory detection or Reset ignite property: I need one!
So i have a couple of ways of detecting interaction from the player for lamp entities, but one of them allows for triggering the callback even though the user has no tinderboxes, and the other only allows for igniting the object once. If i can get the amount of tinderboxes the user has or if i can somehow reset the object from having its ignition set, then i can have things working as i want them to. I have an alternative method to all of this, but it requires more effort from the player, so i would like to avoid this alternative for now.
I've tried resetting the entity through ResetProp(), but that did not reset its ignition; and i've tried using wildcards in HasItem(), but it keeps returning false.
(This post was last modified: 10-02-2011, 09:34 PM by Your Computer.)
|
|
10-02-2011, 09:34 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
I'm not exactly sure what you're getting at, but I think you could have a global variable integer that increases by every interaction between the player and a tinderbox. So that once the player has a tinderbox, you might be able to set every turned off candle as a static, uninteractible object while having an interaction area that checks if the player has a tinderbox and then add a fire particle effect on the top of the candle. Finally, it should also subtract the global variable by one per interaction between the player and the area. Though it may be some work planning it out across multiple levels, it should do the job right.
|
|
10-02-2011, 09:48 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
I guess i should have mentioned that this is for my cannon i'm working on for my Teamnesia story. To explain it further, in the level editor i can set a callback (under "CallbackFunc") to the entity, which one of the parameters is capable of providing "OnIgnite" as its value. However, using that method only allows for "igniting" the entity once. If i use SetEntityPlayerInteractCallback(), this allows for lighting the object even without tinderboxes.
I'll use your method for my other custom story, but as you could imagine that method won't work for Teamnesia (at least not without the cooperation of everyone else).
(This post was last modified: 10-03-2011, 04:52 AM by Your Computer.)
|
|
10-02-2011, 10:04 PM |
|
Acies
Posting Freak
Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation:
73
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
SetEntityCallbackFunc(string& asName, string& asCallback);
What type of entity is it? Could you perhaps make it a lamp and setlamplit = false.
This seems like something I should be able to solve Can't find the model though. It wasn't Sel's canon.
ジ
|
|
10-02-2011, 10:21 PM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
Why would you need wildcards for HasItem? Isn't it just tinderboxes?
|
|
10-02-2011, 10:30 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
(10-02-2011, 10:21 PM)Acies Wrote: SetEntityCallbackFunc(string& asName, string& asCallback);
What type of entity is it? Could you perhaps make it a lamp and setlamplit = false.
Already tried those. The cannon is a lamp entity, so if you can get this to work with another lamp entity, great! Also, you're not going to find this cannon anywhere until i release it; i made it myself.
(10-02-2011, 10:30 PM)MrBigzy Wrote: Why would you need wildcards for HasItem? Isn't it just tinderboxes?
I figured since the player picked up "tinderbox_"+n that perhaps the game stores the names of the tinderbox entities, hoping that HasItem() supports wildcards. "tinderboxes" returns false also.
(This post was last modified: 10-02-2011, 10:47 PM by Your Computer.)
|
|
10-02-2011, 10:46 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
Does the entity callback returns true for ignition even if player has no tinderboxes?
|
|
10-02-2011, 10:51 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
(10-02-2011, 10:51 PM)Tanshaydar Wrote: Does the entity callback returns true for ignition even if player has no tinderboxes?
For SetEntityCallbackFunc() the callback is not triggered when the user has no tinderboxes and tries to interact with the entity. However, after the user obtains tinderboxes, once triggered i can no longer light the entity again even if i pass false to SetLampLit().
(This post was last modified: 10-02-2011, 11:00 PM by Your Computer.)
|
|
10-02-2011, 10:59 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
That's really weird. You know I made some modern lamps to be litable with using light bulbs and OnIgnite state always works for me. I'll check my levels if I can reproduce your case.
|
|
10-02-2011, 11:02 PM |
|
DRedshot
Senior Member
Posts: 374
Threads: 23
Joined: Jun 2011
Reputation:
11
|
RE: Tinderbox inventory detection or Reset ignite property: I need one!
looks like the only alternative to ResetProp is CreateEntityAtArea... - maybe after each shot is fired, create another cannon with a new name. I know it's not optimised but it might be your only workaround..
(This post was last modified: 10-02-2011, 11:42 PM by DRedshot.)
|
|
10-02-2011, 11:41 PM |
|
|