Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 662 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
NPC Codes #376489
07/03/11 12:25
07/03/11 12:25
Joined: Apr 2011
Posts: 36
M
marvz Offline OP
Newbie
marvz  Offline OP
Newbie
M

Joined: Apr 2011
Posts: 36
hey, will you please help me to create a npc in my game? what is the code how to do that? i need it for my game. i dont have any idea to create that because i only a beginner. plzzzzzzzzzzzzzzz

Re: NPC Codes [Re: marvz] #376490
07/03/11 13:33
07/03/11 13:33
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
What kind of NPC do you need?
Are they zombies, ghosts or maby idiots with guns?

And you may take a look at the aum



Re: NPC Codes [Re: Random] #376504
07/03/11 16:43
07/03/11 16:43
Joined: May 2008
Posts: 257
D
djfeeler Offline
Member
djfeeler  Offline
Member
D

Joined: May 2008
Posts: 257
in Aun :

Code:
Q: How can I make an entity move to the specified location?

A: Here's an example that moves an NPC character towards its goal using primitive, and yet fully functional obstacle avoidance code.

 

ENTITY* goal;

 

action npc_goal() // attach this action to the destination entity

{

       goal = my;        

}

 

action goal_tracker() // attach this action to your NPC character

{

       while (!goal) {wait (1);} // wait until the goal entity is loaded

       VECTOR temp, temp_angle;

       var npc_speed = 5;

       var covered_dist, i;

       while (1)

       {

               my.skill10 += 6 * time_step; // 6 gives the animation speed

               vec_set (temp.x, my.x); // trace 10,000 quants below the npc entity

               temp.z -= 10000;

               temp.z = -c_trace (my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX) + 20; // play with 20

               temp.x = npc_speed * time_step;

               temp.y = 0;

               ent_animate(my, "walk", my.skill10, ANM_CYCLE);

               covered_dist = c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);

               if (covered_dist < 0.1) // the npc is stuck?

               {

                       my.pan += 90 - random(180); // then add a random angle to its pan angle

                       i = 0;

                       while (i < 10) // walk in the new direction for 10 frames, play with 10

                       {

                               c_move (my, temp.x, nullvector, IGNORE_PASSABLE | GLIDE);

                               ent_animate(my, "walk", my.skill10, ANM_CYCLE);

                               i++;

                               wait (1);

                       }                                

               }

               else // the npc can move? Then rotate it towards the goal again!

               {

                       vec_set(temp_angle, goal.x);

                       vec_sub(temp_angle, my.x);

                       vec_to_angle(my.pan, temp_angle);

                       my.tilt = 0;

               }

               if (vec_dist(goal.x, my.x) < 50) // the npc has found the goal entity?

                       break; // then get out of the while loop!

               wait (1);

       }

       // the goal was reached here

       ent_animate(my, "stand", 0, 0); // switch to "stand"

}



Re: NPC Codes [Re: djfeeler] #376551
07/04/11 11:30
07/04/11 11:30
Joined: Apr 2011
Posts: 36
M
marvz Offline OP
Newbie
marvz  Offline OP
Newbie
M

Joined: Apr 2011
Posts: 36
My game idea is that, when i clicked for example the NPC whatever kind of NPC, a conversion will pop up, or some kind of a panel will appear.. do you have any idea for that? help me guys, to do that...

Re: NPC Codes [Re: marvz] #376570
07/04/11 14:23
07/04/11 14:23
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
For that you can use a EVENT. Search in the manual for "event" and "EVENT_CLICK,ENABLE_CLICK".

Last edited by Widi; 07/04/11 14:28.
Re: NPC Codes [Re: Widi] #376616
07/05/11 04:24
07/05/11 04:24
Joined: Apr 2011
Posts: 36
M
marvz Offline OP
Newbie
marvz  Offline OP
Newbie
M

Joined: Apr 2011
Posts: 36
#include <quest.c>
//////////////////

function game_question()
{

randomize();
numRandom= int(random(20));

if(numRandom==0)
{
one_txt.visible=on;
one.visible=on;
}
}
action question
{

my.enable_click = on;
my.event = game_question;
}

I try this code. but it contains error which is "syntax error", help me to fix this bug.. plzzzzzzzzzzz....

Re: NPC Codes [Re: marvz] #376621
07/05/11 07:09
07/05/11 07:09
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
God damn it! Stop asking for help this way! Stop beging for such simple things! Take a look at my website, there is zombie ai under downloads! And it works, I've tested it.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: NPC Codes [Re: 3run] #376625
07/05/11 08:06
07/05/11 08:06
Joined: Apr 2011
Posts: 36
M
marvz Offline OP
Newbie
marvz  Offline OP
Newbie
M

Joined: Apr 2011
Posts: 36
i downloaded the zombie AI in your site. but i need is that, the player have a conversation with my nPC, not a battle, do you have that sample game?

Re: NPC Codes [Re: marvz] #376629
07/05/11 09:43
07/05/11 09:43
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
one_txt.visible=on;
one.visible=on;
my.event = game_question;

That is c-script !!!!! (if you use c-script then pease post in the "C-SCRIPT AND WDL" section!
plzzzzzzzzzzz READ THE MANUAL !!!!!!!!!!
And if you have a error, it help us a lot if you can post witch line the error is.

set(one_txt,SHOW);
set(one,SHOW);
my.emask |= ENABLE_CLICK; // <-- that is lite-c


Last edited by Widi; 07/05/11 09:44.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1