Runtime error 216

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
darkhog
Posts: 58
Joined: Sun Sep 09, 2012 7:59 pm

Runtime error 216

Post by darkhog »

I'm trying to make simple game where you can drive car. Unfortunately I get runtime error 216. Most likely my fault, because I'm net to this soft, so I attaching my project.
Attachments
car.zgeproj
(4.62 KiB) Downloaded 462 times
User avatar
VilleK
Site Admin
Posts: 2371
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Hi and welcome to these forums!

You get a "null pointer referenced in expression" error in the log window too. The problem is in Car.OnUpdate.Condition.Expression:

"return CurrentModel.CollidedWith.ClassId == Ground.ClassId;"

CurrentModel.CollidedWith is only valid to use in OnCollision. So move this Condition to Car.OnCollision instead.
darkhog
Posts: 58
Joined: Sun Sep 09, 2012 7:59 pm

Post by darkhog »

Thanks! However now I have another problem. Wheels of my car don't want to rotate. I'm using following script in Keypress binded to W key. I'm attaching project file. KeyPress is in OnUpdate.

Also sorry for noob questions, but I'm new to it aaand, you know.
Attachments
car.zgeproj
(5.51 KiB) Downloaded 486 times
User avatar
VilleK
Site Admin
Posts: 2371
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

For some reason I can't remember the keys need to be specified in caps. So just change to W instead and it will work.
darkhog
Posts: 58
Joined: Sun Sep 09, 2012 7:59 pm

Post by darkhog »

Thanks again.
User avatar
Kjell
Posts: 1924
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hej Ville,
VilleK wrote:For some reason I can't remember the keys need to be specified in caps.
Because Windows returns the QWERTY key events in the 0x41 - 0x5A range, which corresponds to the capital letters in the ANSI map. The lower case ordinals actually map to the numpad and function-keys among others :)

K
User avatar
VilleK
Site Admin
Posts: 2371
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

That's it, thanks for reminding me Kjell :)
Post Reply