Scripts / SetPosition(e,x,y,z) help please.

Author
Message
miki
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Hmm..
Posted: 22nd Jul 2015 08:04 Edited at: 22nd Jul 2015 10:16
G'morn,

I'm trying to position my npc's at different positions at game start..



I'm using this method..



I've tried other positions in the soldier script to no avail..
I've also tried turning physics, collision and gravity off and on. Which left my npc,s bodyless in some cases.

Could someone point me in the right direction please?

regards,
miki.
in the end
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 22nd Jul 2015 15:34
SetPosition does not work very good alone. The best is to use it in combination with resetPosition and CollisionOff(e)
like this:


Hope this helps
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
miki
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Hmm..
Posted: 23rd Jul 2015 07:34 Edited at: 23rd Jul 2015 07:39
Hi Corno_1,

I've already tried that and it didn't work. Maybe I'm putting the code in the wrong place.

Anyhow, I used an alternative method. Spawning the npc using 'math.random' at the top of it's code.
Like this:







.... and this is the code associated with the trigger



Thanks,
miki.
in the end
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 23rd Jul 2015 09:47 Edited at: 23rd Jul 2015 09:48
Ok I hope this time I can solve your problem:


I created a new Function SetEntityPos(e,x,y,z) and also introduced my oneTimeEvent array to you. I often had the same problem in the name_init function, so I created and used this array a lot

Of course you must set the vars to yours.
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
miki
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Hmm..
Posted: 23rd Jul 2015 09:53
Cool,

I'll try it out and let you know the result.

many thanks,
miki.
in the end
miki
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Hmm..
Posted: 23rd Jul 2015 17:02
G'Eve Corno_1

it appears that the SetPosition(e,x,y,z) works fine.
My mistake. The x coordinates are 23800 not 238, for example.



Anyhow, there's something in the ai_soldier code that makes the character walk back to its original editor position.
When I use your method it does the same.

Thanks,
miki.
in the end
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 23rd Jul 2015 17:56
Change this small part to your coords, that should do it

My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
miki
19
Years of Service
User Offline
Joined: 7th Jan 2005
Location: Hmm..
Posted: 24th Jul 2015 11:38
Hi Corno_1,

these are all the changes to the 'return home' sections of the code I made.
Commenting out the operative commands.



Yet it still returns to the original editor position.

I may be doing something completely wrong. I can't think what.

Is it Friday? Ha!

regards,
miki.
in the end
J_C
17
Years of Service
User Offline
Joined: 9th Nov 2007
Location:
Posted: 24th Jul 2015 18:42
Hi miki
I was developing code to place AI characters in different positions using the ResetPosition/setPosition functions..
but they would always turn around and go back to their original positions then come back to the new set position..
I checked my copy of DarkAI and found this command.

----- DARK AI -----------------------------
AI SET ENTITY POSITION
This command sets the current entity position both within the AI system and to any linked object.
When linked to an object this is the preferred method of resetting the position of an entity
as opposed to positioning the object in DarkBasic.
When not linked to an object this command sets the position within the AI system
and you should position any representation yourself.

Syntax
AI Set Entity Position Entity Number, X#, Z#
--------------------------------------
I emailed Lee to ask for access to this AI command - he sent back it would be added when they do the AI updates...
so may not be your fault or the fact its Friday...
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 24th Jul 2015 20:57
here you go, use it like this

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Login to post a reply

Server time is: 2024-12-22 01:12:41
Your offset time is: 2024-12-22 01:12:41