Forum rules - please read before posting.

Load and Save enemies.

Hi Chris @ChrisIceBox, so, my turret works quit well now and it saves and loads correctly. However, how would I handle making multiple enemies? I mean, my turret is completely relying on an AC trigger that puts it to false (which covers the whole area where the player is walking on, since it falls with gravity, thus can fall on a lot of different places). Should I create an identical bool for every enemy so I am ending up in hundreds of bools in the Game Editor? But then I would also have hundreds of triggers in eahother.  What is the best way to handle this? 

Comments

  • Have you seen this tutorial on saving?  It's pretty heavy going, but if you want to avoid creating hundreds of bools / triggers, you're going to need to instead get into some serious scripting.
  • Yes,I saw it but didnt try it yet. And what you say I already thought. It seems also fairly complicated to let it work together with AC, in terms of my scripting knowledge. Do you have any idea where I can start? Or is that a too complex question?
  • I mean, basically I want to duplicate what I already have, but then I have just one bool that sets something to false which will affect all my enemies at the same time. My sscripts on the gamobject(s) itself are not static but the global variable which holds what it should do in AC is, so maybe if you could just hint me a little bit.. (only if its possible of course). (I am trying to make a game btw that is similar to Little Big Adventure, a game from 1991, but with point and click on hotspots, so that's different).
  • You've got a fan of LBA 2 here!

    I don't think you need a trigger / bool for this, actually.  If you've already become familiar with Remember scripts, take a look at the RememberNPC script.  That essentially saves things like position, rotation, walking state etc.  I shouldn't think a RememberEnemy script would be too different.  If your enemy script has a bool like "IsDead", then you could pass that onto the RememberEnemy script easily enough.  What'll make is 10x easier to implement is if dead enemies are simply hidden from the scene, rather than deleted entirely.
  • Wow! You are a LBA 2 fan? I was completely amazed by both games, and I think its crazy that Frederick Raynal (the maker of LBA, but you probably know) doesnt have the money and support he should have for these amazing gems of games, to make a third part or at least a remake (they planned it but it still didnt succeed). So, about the scripts: of course, I already thought of the RememberEnemy script but I couldnt make it work. I will explain: So I already made the script according to your instructions, saving custom scene data (the Light.enable example), with a Rigidbody.IsKinematic. So it holds the Kinematic value on/off when saving and loading and that works perfectly! However, if I revere to the bool of my own TurretScript, I get a null reference and I dont know why. I have to admit I am not really at home in abstract classes and virtual methods and override them but I thought if it works with the Rigidbody, why doesnt it simply works the same with my own bool value of my turretscript?
  • BTW: my enemies wont really get deleted, I think I will just let them dead in the scene, this is different from other games, but dfference must be there! (They are all robots after all, so their will be no rotten corpse haha).
  • Ok, just did a little test again, if I put the RememberEnemy script on another gameObject I get no null reference, is this because you cannot have multiple rememberscripts on one object that are made in the same way the light.enabled script is made?
  • Not at all - you can have as many Remember scripts as you like.  If you're getting a NullReference Exception error, there's something wrong with your script.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.