Aller au contenu

Photo

Trigger: Working but not working


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
dncollins64

dncollins64
  • Members
  • 9 messages
I've been trying to get triggers working in my game, but the only way I've been able to do it so far is to create a placeable and then setting a trigger around it. That way when I click on it, the trigger is activated. However, I thought that I would be able to set the trigger off by walking into the area it was in with this command, case: EVENT_TYPE_ENTER. Is this just for transitioning into a new area, whether changing areas or going through doors or so forth?

I know my trigger is working because my cutscene is going off, and the placeable's script is only a generic one with the actual cutscene being scripted into the trigger script.

What I am really trying to do is to do an area transition or an area jump through triggers, which I'm not having any luck at being able to do even when using a placeable to activate the trigger. I have the two areas created, the trigger created, and a waypoint in the second area. For the trigger I have the script set to trigger_core, the variable 2DA to var_trigger, and for the variables the TRIGGER_AT DEST_AREA_TAG set to the resource name for the area to transport to (there is no tag identification), and the TRIGGER_AT_DEST_TAG set to the waypoint tag of the transport area.

I'm sure that my script is a problem, but it could also be I don't have something set up right. For whatever reason, I just can't get this to go. Any help is greatly appreciated, I really want to get this going.

Modifié par dncollins64, 28 avril 2012 - 04:42 .


#2
Sunjammer

Sunjammer
  • Members
  • 926 messages
It sounds like you are doing everything right. One thing I don't understand is why you think it is a problem with your script since trigger_core is a core script.

Anyway double check the variables you set in var_trigger are correct, i.e. that you have typed the area's resource name correctly (do not include the .are extension), check for typos or rogue spaces and check that you set the waypoint's tag rather than its name (I've done this before!).

Modifié par Sunjammer, 30 avril 2012 - 12:05 .


#3
dncollins64

dncollins64
  • Members
  • 9 messages
Hey, thanks for answering. I might be mistaken, but it sounds as if this is something you have done before and if so I sure hope you can help. I'll tell you what I have done, but first a quick question. It's my understanding that I could paint the trigger in the middle of my area or wherever, and if I pass through it, it will fire. The thing is I've never got a trigger to go off except by using a placeable with it, and having the trigger set to start a cutscene so I could verify the trigger actually worked. I'm not wanting the trigger to do a cutscene at this point, just trying to see if the trigger was working. So much for quick so here it is, is it enough to just paint the trigger on the area or should I try to put placeables in such as invisible transition doors?

As for the rest, here is what I have. First I have my two areas I created, both of which have been added to the area list for the area chosen. I did this by extracting the two master areas from the designerareas.erf master file, adding the two areas to them by creating new structures and added them as resref's under their resource name. Then I saved these two files in my override folder. The first area has a trigger within it, and the second area has the waypoint. The variables for the trigger has the dest tag of the waypoints tag, and the dest area tag has the created areas resource name. The script for the trigger is trigger_core at this point, I've tried adding things to it as well as just running it as trigger_core.

If it is of any help, I created a creature in the second area which isn't showing up either when I go there. I'm pretty much at my wits end on this; I've read everything on here on triggers, been all through the wiki, even been to youtube to see if someone has shown how to do this. Really hope you can give me some insight, thanks.

Edit: After reading more on the wiki, I'm thinking the problem is my module settings or a lack of script to load the new custom area. I'm not sure which to do as the wiki says this there are two kind of modules, standalone and non-standalone. If I'm understanding the standalone, I have to give it a starting area and waypoint in the module, as well as a script (this would explain why when I export it always says no starting area specified). I will have to start over and my start point will always be at the area's waypoint which is definitely not what I want to do. If it is an add-in, I have to leave the starting area and waypoint blank as well as the script. Then it says an extension needs at least one entry point that hooks into the main campaign, using a technique called PRCSCR.

After reading this, I'm of the belief what I am wanting or need it to be is a add-in or non-standalone. So is what I need a script to load the first starting area, which would be my entry point that hooked into the game. Or do I need multiple scripts for different areas and various other creations.

A couple more things, I noticed there are selectable variables for the module and areas. Should I leave these alone, or make adjustments and if I need to make adjustments what fields should I edit.

Sorry for the long post, it's a steep learning curve as I haven't done anything like this before and the wiki is kind of incomplete. Thanks.

Modifié par dncollins64, 01 mai 2012 - 03:20 .


#4
dncollins64

dncollins64
  • Members
  • 9 messages
At Sunjammer; I never did get the custom area to work. I could trigger cutscenes in it, but never able to do area transitions or get creatures to show up. I did get a placeable to show up, but I don't know if I hard scripted that or not.

However, I did get what I wanted by taking the main camp area and duplicating it. Then I saved it under my module and added a creature to it which worked. I was only able to do an area transition by doing two things; one, hard scripting it into a conversation and for the second, adding a trigger with the dest tag and dest area tag set. If I only did one it wouldn't work. The script wasn't much, just a simple little "doareatransition".

I was going to try Lobo's script for area transitions when using plots, but the wiki is really incomplete on how to do plots as it doesn't say how to fill in the fields.

I would have thought though I could have used custom areas, instead of having to duplicate to achieve what I wanted which was to do an area transition to a cutscene, and then transition back. Anyway, thanks for your response.

#5
Sunjammer

Sunjammer
  • Members
  • 926 messages

dncollins64 wrote...

I'll tell you what I have done, but first a quick question. It's my understanding that I could paint the trigger in the middle of my area or wherever, and if I pass through it, it will fire. The thing is I've never got a trigger to go off except by using a placeable with it, and having the trigger set to start a cutscene so I could verify the trigger actually worked. I'm not wanting the trigger to do a cutscene at this point, just trying to see if the trigger was working. So much for quick so here it is, is it enough to just paint the trigger on the area or should I try to put placeables in such as invisible transition doors?

A trigger by itself will be enough and it will fire (i.e. an event is raised) when the trigger is created (spawns), when a creature enters the trigger, when a creature leaves a trigger.

There isn't a generic "area transition" trigger resource in core but the functionality has already been scripted. All you have to do is create a new trigger resource and it is automatically assigned trigger_core as its Script and var_trigger as for its Variable 2da.

Incidentally an easier/more reliable way to see if a trigger is working is to use DisplayFloatyMessage or if you have the log enabled PrintToLog.

dncollins64 wrote...
As for the rest, here is what I have. First I have my two areas I created, both of which have been added to the area list for the area chosen. I did this by extracting the two master areas from the designerareas.erf master file, adding the two areas to them by creating new structures and added them as resref's under their resource name. Then I saved these two files in my override folder.


I've not tried it myself but this seems like a bit of a hack to me: and might be the source of your problems. Doesn't extracting a ARE file from the ERF mean you get a lot of baggage? Like all the creatures, placeables, triggers, etc.?

If I was creating a new area using one of the existing core/single player levels I would simply create a new area in my module and setting the area's Area Layout to the appropriate resource. The wiki has a visual index to make finding the correct resource easier. This way you have a nice clean area you can work with in the toolset and it is much easier to build and test.

dncollins64 wrote...
After reading this, I'm of the belief what I am wanting or need it to be is a add-in or non-standalone. So is what I need a script to load the first starting area, which would be my entry point that hooked into the game. Or do I need multiple scripts for different areas and various other creations.

I think until you have basic things like area transitions working I would work on your module as a standalone module. If you want to convert it into an add-on for the Single Player campaign you can always do that later. Of course if one of your area transitions is back to an area in the Single Player campaign this isn't really an option.

However for testing you can create a waypoint in your first area as a temporary module start waypoint. Also create a simple module script that allows you to skip character generation. I normally go with my own version of the example script on the wiki. Then open your module's properties and set the module's Script, Starting Area and Starting Waypoint accordingly. Also at this point you want the module's Extended Module property set to (None). Once set export the area and the script (which will also update the module's properties).

#6
dncollins64

dncollins64
  • Members
  • 9 messages
Been kind of busy, but I wanted to thank you for your help on this. Got it to work by copying the two areas from single player, and then making my changes by adding things and adding it to the area list. It may be a hack, but at least it's working although the second area when I leave still thinks I am at camp (when I leave the second area it is straight to the map, so instead of getting the options I would normally get, the only option I get is as if I were leaving from camp. That's all good though, as I added a creature to the second area which transitions me back to camp.) Thanks again.