Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Error: Cannot insert a user defined type that is different from the array type

Author
Message
Olde Worlde Illusions
2
Years of Service
User Offline
Joined: 10th Oct 2021
Location:
Posted: 11th Jan 2022 04:54 Edited at: 11th Jan 2022 05:04
Hello,

I am trying to use the insert function on my custom type array and I am getting this error:

Quote: "Error: Cannot insert a user defined type that is different from the array type"


Here is my type array declaration:


Here is my type declaration:


Here is the function definition:

Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 11th Jan 2022 06:13 Edited at: 11th Jan 2022 06:30
Here's something to point you in the right direction. You need to create the unit and sphere as their own things, create the sphere and place it in the unit, then insert the until into the playerdefense array.
id.x and id.z will only keep a record of the position in this case, you also need to update the sphere position to reflect this each time you change the position within the instance.

I hope this helps.


Olde Worlde Illusions
2
Years of Service
User Offline
Joined: 10th Oct 2021
Location:
Posted: 11th Jan 2022 07:17 Edited at: 11th Jan 2022 07:32
Hey,

Thanks for that bit of code, my game is now much cleaner! The issue now is some code stopped working and I don't know why.


If i start the round it briefly displays "Bullet Array is empty" followed by 0. For some reason the bullet's x position isn't being updated in the array. I have attached the code for reference. I know my create Bullet function is firing because of the reason stated above, but for the life of me can't figure out why it isn't updating the bullets position.

UPDATE: I can confirm the array is being expanded. Too tired to continue, going to catch some ZZZ's 1/11/2022 2:24am

UPDATE 2: changing the line
to
confirms the bullets are being created and the 0 refers to the newly created bullet. However, if that is the case then why don't i have a stream of bullets flying across the stream??? OK I am for sure going to catch some ZZZ's Night! 1/11/2022

Attachments

Login to view attachments
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 11th Jan 2022 08:26
Quote: "but for the life of me can't figure out why it isn't updating the bullets position."


From what I see you are updating an array item not an object position??

Call SetObjectPosition(), maybe??
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 11th Jan 2022 08:46
As I'm unable to see the entirety of your code I will just have to give you this, you should be able to use this to give you an idea where you went wrong.

Steve Ancell
18
Years of Service
User Offline
Joined: 16th Feb 2006
Location: Brighton, East Sussex, UK
Posted: 14th Jan 2022 02:31 Edited at: 14th Jan 2022 02:31
@Olde Worlde Illusions
How did you get on?, hope you got your game working.

Login to post a reply

Server time is: 2024-05-04 08:19:26
Your offset time is: 2024-05-04 08:19:26