Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
I'm creating a script that will clone up to three objects in a given area but I don't know how to implement the creation of a generation radius like the one that exists in the function "in proximity do something" that gives the freedom to choose the size of the area and whether will be a cube or a sphere. Thank you very much in advance. (Sorry for the strange English, I'm Brazilian and I'm using google translator) |
||||
|
i don't know how your code look like but here is how i see this problem:
|
||||
|
so far my code looks like this //Script by Sleeper Dev //zone where generation occurs at a random position of a scene node /* <action jsname="action_randomSpawn" description="RandomSpawn"> <property name="Object1" type="scenenode" default=" " /> <property name="Object2" type="scenenode" default=" " /> <property name="Object3" type="scenenode" default=" " /> <property name="Radius" type="float" default="10" /> </action> */ |
||||
|
the script I want to create is the following: -choose up to three scene nodes -set a spawn radius -then determine that every "X" seconds one of the three objects that was defined by me will be generated in the defined area. (using the "Every few seconds do something") can you help me? |
||||
|
in my example i almost show you all you need, implement it to your code and then set position for each Object by setRandomPositionBox or setRandomPositionSphere. |
||||
|
thank you very much friend, i will do that |
||||
|
I implemented it but it is giving error see in the image https://pasteboard.co/Y4YRYVDC1uT0.png I also need to know how do I make the spawn cube have the size defined by me I thought about creating a cube in the scene and making the objects spawn inside it so that the area is visible and so that I can define the location I want |
||||
|
you got discord, if you, add me |
||||
|
yes I have, my tag is Nelsinho Bola 76227 |
||||
|
cant find you add me SamGrady5149 |
||||
|
Hopefully you got it working. I know you said you wanted to use code, but it's very simple to create Spawners without code....just by using a dummy node as a spawner (which randomly walks round the scene really quickly), then move your characters relative to the current position of the dummy node, to spawn them to the "random" position. EG: 1- Create a dummy node (sphere with 0 polygons, 0 scale), rename the node as "Spawner1". 2- Add game_character behaviour to "Spawner1" dummy node, set "random path", set speed=1000, set radius=1000 (or whatever you want). 3- On your 3 characters, just use: Every few seconds, If Variable "Spawn1"=1, Set position relative to node: "Spawner", Set Variable "Spawn1" =0. 4- You can then control the Spawn/Teleport events for each character by setting Variable "Spawn1" =1 (You can also control them individually by adding variable "Spawn2", "Spawn3" etc.) 5 (optional) - you can add "collide when moved" to the Spawner node, to prevent your 3 characters being accidentally spawned/trapped inside level geometry. It's probably not as good as coding, but it's very simply/quick to set up and works reliably well. So this method is mainly for people who don't/can't get the code to work. |
||||
|
@VP you right, i've done this code based on special needs for @SleeperDev. In code below i show base of action mede for @SleeperDev (original code use clone)
but it really cool that you can make many stuff without code, @VP i saw lot of your post and your no code skills great ![]() |
||||
|
P.S. this code better use with cubeMesh (code get size of box) so if using sphere, cylinder, plain or cone this code can work but scale doesn't work like it has to |
[ 1 2 ] Page 1 of 2 |
|