EDIT: I should add that it happens to every powerup on the affected paths, not just 1 or 2.
Powerups not spawning at nodes [Solved]
Moderator: Moderators
-
LRKfm946
- Master Sergeant

- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Powerups not spawning at nodes [Solved]
In my lua, I'm spawning powerups at nodes around the map, but many of the powerups don't spawn at the nodes they're supposed to. Instead they spawn at the center point of the map. All the path names are correct, and the nodes are not obstructed in any way (not underground or inside any objects). What's going on? 
EDIT: I should add that it happens to every powerup on the affected paths, not just 1 or 2.
EDIT: I should add that it happens to every powerup on the affected paths, not just 1 or 2.
Last edited by LRKfm946 on Mon Apr 07, 2014 4:07 pm, edited 3 times in total.
- Locutus
- 1st Lieutenant

- Posts: 420
- Joined: Fri Jun 04, 2010 10:08 am
- Projects :: Stargate Battlefront Pegasus
- Location: Germany
- Contact:
Re: Powerups not spawning at nodes
I could imagine that this is caused by different "counting", for example in ZE you have node 0-2 but in lua you're trying to spawn on node 1-3 or vice versa.
-
LRKfm946
- Master Sergeant

- Posts: 163
- Joined: Sun Feb 02, 2014 6:13 pm
- Projects :: Battlefront II Hunger Games
- Contact:
Re: Powerups not spawning at nodes
Nope, I have them all indexed correctly; n nodes, 0 thru n-1.
Here's the function I'm using to test them:
There's a line in there that teleports me to each node as it checks it, and I never got teleported to the center. A few nodes must have gotten moved because a couple times I was teleported in mid air or inside an object but I fixed them all and it still didn't work.
EDIT: The teleporting line just gave me an idea: after the powerup is created, teleport it to the node. I tested it, and it works!
Le solved
The fix:
EDIT 2: Oh wow, now I see my original error... I copied and pasted another loop and changed the node name but forgot to change it in CreateEntity()... Well now I feel dumb 
Although now it crashes after node 8 in the special_power_spawn loop with no error...
Unsolved now.
EDIT 3 yet again: Okay so I removed the line that teleports me to each node and it stopped crashing, so I'm guessing that means everything's working. I'm going to go around and make sure each node works.
FINAL EDIT: After testing each node, they're all good!
Here's the function I'm using to test them:
Hidden/Spoiler:
EDIT: The teleporting line just gave me an idea: after the powerup is created, teleport it to the node. I tested it, and it works!
The fix:
Code: Select all
CreateEntity("com_item_powerup_dual", powerspawn, "powerup"..i)
local powerupPtr = GetEntityPtr("powerup"..i)
SetEntityMatrix(powerupPtr, point)Although now it crashes after node 8 in the special_power_spawn loop with no error...
EDIT 3 yet again: Okay so I removed the line that teleports me to each node and it stopped crashing, so I'm guessing that means everything's working. I'm going to go around and make sure each node works.
FINAL EDIT: After testing each node, they're all good!
