After 2 or 3 weeks of getting absolutely nowhere with scripting, I really felt it was hopeless. Felt I had missed the party by about 5 years or more. Should've been here in 2015. To be honest I'm not passionate about modding, nor machinima. Just wanted to make some educational videos with this amazing sandbox, for myself and anybody else who wanted to share - to try an ease the pain of online learning during the pandemic.
So today I thought to myself, "you just don't get C#, let's try VB instead. One last shot and we'll call it quits". Well it started better but I had all kinds of inconsistencies and probably some caching/memory issues where even on restarting the game I would see residual spawns - go figure.
Then I would run the script several times and get different outcomes - can't even begin to explain that.
Finally I decided to break the script down into subroutines. That did it. Everything I wanted to do, spawn at absolute or relative coordinates, be a passenger in a car, and finally have the car driven by the AI according to absolute coordinates all gelled in about 3 hours of work. Contrast that with 3 or more weeks of getting nowhere with C#.
One challenge that frustrated me, as the player, was getting in the car. Hitting F resulted in a fight with the driver, so finally I realized i had to script the player's entry into the car as well as the driver and the front passenger, both AI. Originally I also scripted my exit but realized doing in manually (F key) gave me more flexibility to get out - ie. not at the same time as the passenger (which could have been done with a wait statement ofc).
Of course I learned a lot by just trial and error, but at last i feel i can now progress and get things done - and sure I know what i accomplished is very simple in the grand scheme.
So here is my first real script.