Ai Command Stack
#21
Posted 25 March 2008 - 09:20 AM
Did you make that yourself? Just wondering cuz i'm the only person I know so far who made something like that and I want to make it better, and if yours is better it saves me the trouble...
#22
Posted 25 March 2008 - 09:37 PM
Platform AI pathfinding?
Did you make that yourself? Just wondering cuz i'm the only person I know so far who made something like that and I want to make it better, and if yours is better it saves me the trouble...
I left you a post in your platform A* path finding about it a while back...
You just wait a little... I solved your node based system problem in my upcoming node path finding dll. You can make a platform node system in 5 minutes with it with no hard coded linking of nodes.
This (platform pathfinding) method here is workable but slow to set up and tweak.
#23
Posted 07 April 2008 - 02:55 PM
#24
Posted 07 April 2008 - 09:17 PM
so is there a way to have my AI randomly feel like wandering in a given amount of space and not attacking unless he sees the player object using these scripts?
Sure but I do recommend you learn to make your own scripts to match your need. Understand how the command scripts work is the key.
#25
Posted 17 April 2008 - 11:12 PM
impressive work
-Kearel
#26
Posted 07 August 2008 - 01:40 AM
causes a compilation error that has to be aborted.
#27
Posted 06 October 2008 - 01:33 PM
ERROR in
action number 1
of Create Event
for object BulletObj:
Error in code at line 2:
effect_create_above(ef_smoke,x,y,0,c_gray);
at position 2: This function is only available in the Pro Edition.
i have lite and this came in 2nd room in unregversion
you should not use effect_create
first room works great!
That is great tutorial and helped me a lot! =)
sry my english if wrote something wrong
#28
Posted 06 October 2008 - 04:20 PM
#29
Posted 06 October 2008 - 08:47 PM
Everything you need is right there
in patrol command
if(BigBossFound) HandleBigBoss
HandleBigBoss script
Clear The Stack
Clear the list
add RunHome to list or add FightBoss to list
#30
Posted 12 December 2009 - 06:49 AM
now don't you feel stupid?Very good tutorial. This can be great use to somebody.
PS: YAY!!!! First post!!!!!!!!
#31
Posted 12 December 2009 - 02:24 PM
but this is probably something that never gets done anyway, so.....EXCELLENT LIST
Roel
#32
Posted 13 August 2011 - 08:24 PM
You don't realy need a command stack or list and I would not jump in this sort of thing before having done a few AIs first...
I can tell you about script switching which is how the command stack started and it's much more managable than a bunch of case statements
AI object
on create
curscript = WalkArround;
on step
script_execute(curscript);
script WalkArround
xx = random(room_width) yy = random(room_height) curscript = WalkToXY;
script WalkToXY
direction = point_direction(x,y,xx,yy); speed = 3; if(point_distance(x,y,xx,yy)< 10) curscript = WalkArround;
So now you have 2 scripts that switch between each other. One decides where to go, the other goes to it and when it's done, ressets the script to the original;
This method uses instance variables curscript and xx,yy, so no parameters to confuse you.
Now you can elaborate to a patrol and enemy (player) hunt
AI object
on create
curscript = PatrolArround;
on step
script_execute(curscript);
script PatrolArround
xx = random(room_width) yy = random(room_height) curscript = PatrolToXY;
script PatrolToXY
speed = 3;
player = instance_nearest(x,y,PlayerObj)
if(player)
{
if(point_distance(x,y,player.x,player.y)<200)
{
curscript = AttackPlayer;
exit;
}
}
direction = point_direction(x,y,xx,yy);
if(point_distance(x,y,xx,yy)< 10)
curscript = PatrolArround;scrip AttackPlayer
if(!instance_exists(player))
{
curscript = PatrolToXY;
exit;
}
if(point_distance(x,y,player.x,player.y)>200)
{
curscript = PatrolToXY;
exit;
}
speed = 5;
direction = point_direction(x,y,player.x,player.y)The setup selects a random spot to patrol to. Patrols to it while checking if the player is near. If the player is near, he is attacked until he move too far. at that point, the patroltoXY continues and then when the patrol point is reached, another patrol point is randomly selected.
Hope it helps.
The command stack is a huge elaboration of this method and, in retrospect, this simpler method should have been explained first. It's much easier to implement, even if it does not allow for parameters (that can be remembered), you can use instance variables instead...
#33
Posted 18 November 2011 - 02:41 AM
Just wondering if someone can help me, I get the following error when trying to use the script:
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_orb_drone_cs:
Illegal argument count calling script "CommandStackPush".
Script requires 16 arguments, 6 have been supplied.
I have copied in all the CommandStack scripts into my project + the cmdComandObj.
I see that the CommandStackPush requires 16 arugments, however when checking out the tutorials, only the arguments used by the function to be put on the stack are used (ie. not 16 of them are required). Why can't I seem to replicate this in my scripts? do I need to pass 16 dummy arguments to the function?
Many thanks in advance.
#34
Posted 18 November 2011 - 03:22 AM
#35
Posted 17 December 2011 - 11:08 PM
pass 0s for the missing arguments. darn gm8.1 broke the flexible argument system... or change the way the arguments are referenced inside
I am attempting to use your suggestion, but its not working... Can you specify what you mean by passing 0's?
#36
Posted 18 December 2011 - 12:22 AM
It sort of like in c++ where you can specify a default value from omitted arguments in the function declaration, but the default is 0 in GM
For example
Script DoIt
var count; count = argument0;
if(count == 0) count = 1;
repeat(count) ShowMessage("Hello")
if you call
DoIt(10), you would see a message 10 times
DoIt(1), you would see it 1 time
DoIt(), you would see it 1 time because the missing argument0 is converted to 0 in the script and the if in there sets it to default to 1.
Now gm8.1 broke this variable number of arguments feature to the detriment of many 3rd party extensions. So, CommandStackPush CAN takes up to 16 arguments. But most commands only take a few, like MoveToXY takes x,y,speed... that is 3, plus the script id, 4... so add ,0,0,0,0,0,0... as many as are missing to abide by the 16 argument gm8.1 thinks the script needs.
change
CommandStackPush (MoveToXY, destx, desty, speed)
to
CommandStackPush (MoveToXY, destx, desty, speed,0,0,0,0,0,0,0,0,0,0,0,0)
There is a way to fix the CommandStackPush And CommandListAdd and in another few places I think.
change
data.arg1 = argument1;
data.arg2 = argument2;
and so on
to
data.arg1 = 0;
if (argument_count > 1) data.arg1 = argument[1];
data.arg2 = 0;
if (argument_count > 2) data.arg2 = argument[2];
and so on all the way to 15... for all core functions that set the data.args using argumentN naming convention...
I cant test this as I am afraid to update my earlier release of gm8.1 to the latest release and loose my key. My gm8.1 does not have this bug... I mean feature.
#37
Posted 18 December 2011 - 12:38 AM
#38
Posted 18 December 2011 - 01:13 AM
http://dl.dropbox.co...mmandstack.gm81
Edited by SirGuy, 18 December 2011 - 01:36 AM.
#39
Posted 18 December 2011 - 02:05 AM
#40
Posted 18 December 2011 - 03:38 AM
Here is a very complicated setup
http://www.host-a.ne...2/station16.gmk
arrows move, shift and z to shoot, t to tractor on and off
Move to the bottom, tag a cylinder with your tractor beam. then use the tractor beam to move and attach another cylinder to the first one, tractor and push it and release before it hits the cylinder, both should snap together. add modules (on top of the cylinders) to your station, a power source, a radar (it will tag you as friendly if you avoided the already built station at the top), a asteroid beam, a processing platform.... Once tagged by your station, the other ships should attack you if too close. Meanwhile they gather resources.
The AI ships are controlled with the command stack. The player ship also is. that way you could take control of another ship byt simply adding the pleyer control script to the ai ship stack.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











