Getting a Walkable location?
#1
Posté 31 mai 2011 - 09:42
1. It must be on the ground or against a solid surface, and
2. It must not be inside a wall etc.
But the catch is, that it must return a semi-random location.
The plan I have, is to make a plane travelling system.
Similar to the Spectral Realm I have here....
But instead of being a Plane of Spirits, tinted blue, with music to suit, I was planning on having a player ability, that allows the player to travel to different planes depending on their elemental affinity.
eg - If you are aligned with Fire, you travel to the Fire Plane.
The result being you travel to a plane which is tinted in red, has firey ambient music etc, but the problem comes with placeable objects.
I want to be able to place certain placeable objects programatically in the area to suit the plane. eg - Random Distribution of Fire, and maybe Lava etc
(The lava comment just gave me an idea, isnt there tilemagix or something, that lets you turn water in an area to Lava, Ice and Grass - Bingo)
Anyhow..
Fire Plane = Fire all over the area
Earth Plane = Tree's and Grass
Air Plane = Er.... I dunno... Clouds?
Water Plane = Underwater sort of effect.
I can do most of this, I just need to work out a random distribution system, and be able to determine if the location generated conforms to a valid location, and wont materialize inside a wall.
#2
Posté 31 mai 2011 - 11:56
#3
Posté 31 mai 2011 - 12:16
There are some functions in the #include "x0_i0_position" which can also be used to get Random Locations - Although I cant see it on the Lexicon - I remember seeing it in the Function List in Toolset.
I could use that function to spawn say.... 20 basic creatures at random locations in the area, and in the onSpawn event, have them destroy themselves, and spawn the placeables.
I just wonder if this will create too much overhead.
#4
Posté 31 mai 2011 - 12:30
x0_i0_infinite
string INF_BASE;
void INF_CreateRandomEncounter(object oArea, object oPC);
void INF_CreateRandomPlaceable(object oArea, object oPC);
string INF_GetEntryMessage();
string INF_GetReentryMessage();
string INF_GetReachStartMessage();
string INF_GetReturnToStartMessage();
string INF_GetReachRewardMessage();
string INF_GetReturnToRewardMessage();
string INF_GetPoolEmptyMessage();
This function looks interesting.
INF_CreateRandomPlaceable(object oArea, object oPC);
I havent had a chance to look at it.
#5
Posté 31 mai 2011 - 12:48
Baaleos wrote...
Has anyone used
x0_i0_infinite
string INF_BASE;
void INF_CreateRandomEncounter(object oArea, object oPC);
void INF_CreateRandomPlaceable(object oArea, object oPC);
string INF_GetEntryMessage();
string INF_GetReentryMessage();
string INF_GetReachStartMessage();
string INF_GetReturnToStartMessage();
string INF_GetReachRewardMessage();
string INF_GetReturnToRewardMessage();
string INF_GetPoolEmptyMessage();
This function looks interesting.
INF_CreateRandomPlaceable(object oArea, object oPC);
I havent had a chance to look at it.
Nope I hvae never seen that one before,
If it does not work you can use Function - GetAreaSize to find your area size for your random locations.
#6
Posté 31 mai 2011 - 05:04
#7
Posté 31 mai 2011 - 05:54
Lightfoot's way is the only way I know of to do it. I seem to recall someone - virusman, maybe? - looking at this issue and finding it too problematic to make a GetIsLocationWalkable because of z values or somesuch.Baaleos wrote...
Hmm, suppose that would do it.
There are some functions in the #include "x0_i0_position" which can also be used to get Random Locations - Although I cant see it on the Lexicon - I remember seeing it in the Function List in Toolset.
I could use that function to spawn say.... 20 basic creatures at random locations in the area, and in the onSpawn event, have them destroy themselves, and spawn the placeables.
I just wonder if this will create too much overhead.
As for lag, so long as you only spawn the first, and Copy the rest of the creatures, it should be fine. I would probably stagger placeable creation slightly, once you have the locations, depending on how beefy your server is.
Funky
#8
Posté 01 juin 2011 - 10:17
I wanted a mini-boss in an area to "feed" off of a placeable object's "life" during battle until the placeable ran out of life.
Once the placeable ran out of life, I wanted it to explode and scatter gems around the room, near to where the placeable used to be.
In order to make the gems look realistic, I used the gemstone placeables as containers and created an appropriate gem inside each container.
The important point is that the floor was uneven (the skull-shaped floor) so I needed to find exactly where "floor height" was. The only realistic way to find the correct floor height was to create a NPC in a random location, find out where it was standing then destroy it.
Since the area was a single, self-contained mission, I set up the onenter for the area to check if the boss had been defeated or not, and to set up the area for the entering player if it hadn't already been set up before and the boss left unkilled.
As part of the onenter script, I made a loop which created NPCs randomly around the correct location and then stored the locations of those NPCs in variables on the area before destroying the NPCs.
Since all of the hard work is done during the onenter script, any lag caused is combined with the normal delay on loading a new area and therefore is less noticable.
When I need to create the placeables which contain the loot gems, I just access the variables I stored previously on the area.
Maybe you can do something similar?
Modifié par Melkior_King, 01 juin 2011 - 10:24 .
#9
Posté 01 juin 2011 - 12:31
In order to make sure that the system doesnt lag everytime it does it, I can have it so that the Locations of where the placeables are spawned, are stored persistently per area.
Meaning that next time the server resets, and runs the same function, it doesnt need to spawn NPC's to get the data, because the server will have the position date already on hand.
If I wanted to be really fanci, I could have the onModLoad event, load the Persistent Locations into Memory or something as Locals.
#10
Posté 01 juin 2011 - 12:54
Modifié par _Knightmare_, 01 juin 2011 - 12:56 .
#11
Posté 01 juin 2011 - 02:41
CalculateSafeLocation is possible, but hasn't been requested; besides, it can be done with existing functions.
Modifié par virusman, 01 juin 2011 - 02:42 .
#12
Posté 05 juin 2011 - 07:48
#13
Posté 05 juin 2011 - 07:49
Modifié par DM_Vecna, 05 juin 2011 - 07:50 .
#14
Posté 06 juin 2011 - 12:07
A:) Generating random loc is very easy with Function - GetAreaSize, then create a creature at loc to check validity. annd follow funky way of copying and placeing objects.
the mention of nwnx_funct extender I had know Idea it GetGroundHeight & GetIsWalkable, the CalculateSafeLocation would be a nice function and make the above A:) even easyer I would enjoy a function like that. Rather then go through all the create a creature and check. I VOTE if you can do it V-Man Go For it, I will use it rather then the A:) meathod
#15
Posté 06 juin 2011 - 08:20
#16
Posté 06 juin 2011 - 08:49
Modifié par Axe_Murderer, 06 juin 2011 - 08:52 .
#17
Posté 06 juin 2011 - 08:52
Greyfort wrote...
I agree with lightfoot, and funky...
A:) Generating random loc is very easy with Function - GetAreaSize, then create a creature at loc to check validity. annd follow funky way of copying and placeing objects.
the mention of nwnx_funct extender I had know Idea it GetGroundHeight & GetIsWalkable, the CalculateSafeLocation would be a nice function and make the above A:) even easyer I would enjoy a function like that. Rather then go through all the create a creature and check. I VOTE if you can do it V-Man Go For it, I will use it rather then the A:) meathod
I agree,
I do plan on using this method to generate the random locations in the area, but to further optimize it, I plan on storing the Locations Persistently, so that they do not need to be re-acquired via the spawning in of npc's.
It makes sense, if I am going to spawn in npc's which is a somewhat cpu intensive process, especially if done multiple times, that I should save the valid locations for re-use.
#18
Posté 06 juin 2011 - 08:56
Axe_Murderer wrote...
If it's only in one or two areas where you need this, you could paint down a bunch of triggers that delimit the 'bad' areas and test your generated loc to see if it falls within one of them...or vice-versa.
The Idea I have, is to simulate a multi-planar invasion, basically a rip off of 'Rift - Planes of Telaria'
Where there can be world events, where Planar Tears open, and out pours enemies of the specific rift element.
eg- Rift of Fire = Plane of Fire is invading.
I want to make the system capable of randomly choosing an area, save for the few designated city areas, and then starting the planar tear in the area, and then the Planar Tear will grow in size, and then become a fully fledged Rift.
(Server wide announcements would be generated, which would allow players to travel to the area, and participate in the event etc)
With the nwnx_areas plugin, I can then instance that area, to make an elemental copy of the area.
eg- Rift of Fire appears, players could then cross over the rift, and enter a flaming version of the area they just left.
Some aspects of this would be similar to Oblivion, where you have to cross into the other plane, to destroy the gateway.
Modifié par Baaleos, 06 juin 2011 - 08:57 .





Retour en haut







