Jump to content


Photo

Top-down Shooter Ai


  • Please log in to reply
34 replies to this topic

#1 turgon

turgon

    VP Studios

  • GMC Member
  • 550 posts
  • Version:GM:Studio

Posted 19 August 2009 - 10:31 PM

This script, when placed in the step event, creates a highly advanced AI that supports allies, seeks cover, dodges bullets, retreats, rushes opponents, and last but not least, has a (customizable) difficulty level from 0 to 100!



Gamemaker Pro is needed to use this script (but you can still try the demo if you don't have pro!)

Download Links (1.6 Mb):
.zip File Link: <mediafire>
.zip File Mirror: [url="http://&lt;a%20href="http://www.filefactory.com/file/a0gdb3f/n/Turgon_s_TDS_AI_zip"%20target="_blank"&gt;http://www.filefacto...zip&#60;/a&#62;"]<filefactory>[/url]
Executable Demo File Link: <instant play>
*I recommend that you download the .zip file; it contains the demo also, and then you don't have to re-download*

What the demo is showcasing is the following script, which is called in the Step Event of the AI objects:

vp_tds_ai(initialize,opponent,cover,dodge_this, ammunition,difficulty,max_speed, grid_size, ally,reload_time)

There is no other coding for the AI! In order to implement this script in your game, just download the .zip file, and import the script "vp_tds_ai". Note that I can't just post the code because there are two other scripts that are necessary for the main script to work (instance_nth_nearest and ai_grid_walk). These are automatically imported along with the main script.

Please post comments, suggestions, and any questions or requests for assistance you need! Enjoy!

(Known) Games that use this AI:
Exo -- ND4SPD
The American Civil War -- CaptainLepidus
Territory Killer -- Why789
VP Paintball -- Turgon


Xalrons444 has made an edited version of this example. New weapon types, improved spawn locations, health bars, and more are included!

Edited version by Xalrons444:
Edited TDS AI


Edited by turgon, 30 October 2013 - 07:55 PM.

  • 0

#2 coolkat677

coolkat677

    GMC Member

  • GMC Member
  • 113 posts

Posted 19 August 2009 - 10:52 PM

Script looks great! The ai worked very well although there is one problem I have. In the program when the ai stop and then you go towards it, the ai doesn't back up. It stays in the exact same place unless you go farther away. My suggestion is that you program the ai to stay at a constant distance. Other than that, it looks great!
  • 0

#3 MrKittyMedia

MrKittyMedia

    GMC Member

  • New Member
  • 35 posts

Posted 19 August 2009 - 11:50 PM

It seems you can pretty much hurt your teammate too though allthough im not sure.. there was alot of paint ballin so i cant be sure
  • 0

#4 turgon

turgon

    VP Studios

  • GMC Member
  • 550 posts
  • Version:GM:Studio

Posted 20 August 2009 - 01:01 AM

Script looks great! The ai worked very well although there is one problem I have. In the program when the ai stop and then you go towards it, the ai doesn't back up. It stays in the exact same place unless you go farther away. My suggestion is that you program the ai to stay at a constant distance. Other than that, it looks great!

Thank you for reviewing! The AI is actually designed to hug cover like that. I'm not sure if I want the AI to be at a constant distance (at least not in this template), but I guess that that's because this is more of an aggressive AI; it doesn't really give up ground very easily... Which gives me an awesome idea. I'll work on making another argument that defines how aggressive the AI is! The less it is, the more it will back up and retreat. The max value will probably be pretty much as it is now. Thanks again!

It seems you can pretty much hurt your teammate too though allthough im not sure.. there was alot of paint ballin so i cant be sure

Yes you can shoot your teammates; friendly fire is on. (Everything in the demo except the script was just built to be part of the demo; the actual script doesn't have ai's shooting teammates. That means that if you use this script in your game, you can simply make it so your projectiles don't harm teammates) Thanks for checking it out!
  • 0

#5 MrKittyMedia

MrKittyMedia

    GMC Member

  • New Member
  • 35 posts

Posted 20 August 2009 - 03:04 AM

If aim_direction is 45, and point_direction(x,y,obj_player.x,obj_player.y) is 46, then the computer will add 4 to aim_direction because it is less than the direction to obj_player. But then, aim_direction will be 49, which is more than the direction to obj_player. This will keep happening, and cause the computer to keep adjusting its aim.
So to stop this, adjust the above code to read:


var target_direction;
target_direction=point_direction(x,y,obj_player.x,
obj_player.y);
if(abs(target_direction-aim_direction)>2)
{
if(aim_direction<target_direction){event_user(5);}
else if(aim_direction>target_direction){event_user(6);}
}


…in which case the computer will only adjust the direction if the difference is greater than 2.
There is one more problem with this aiming code. If you were to be directly to the right of the AI, then the direction towards obj_player would be 0. However, if you moved down a bit, then the direction would be 359 (or something close). Instead of simply spinning its aim down some, the computer would spin it completely around. To stop this, we’ll adjust the target_direction so that if the difference between target_direction and the direction to obj_player is greater than 180 (more than half the circle), then add or subtract 360 to target_direction in a way that it would be closer to the direction to obj_player. Keep in mind that adding or subtracting 360 really doesn’t change the general direction (as 360 degrees is a full circle), but it changes its numerical value so our code would calculate it correctly.
If you didn’t understand any of that, then here’s an example.
Suppose the direction to obj_player was 359, and aim_direction was 0. Since the difference between the direction to obj_player and aim_direction is greater than 180, we subtract 360 from the direction to obj_player. Now we have -1 and 0, for which it will be easy for the AI to alter its aim the short way.


var target_direction;
target_direction=point_direction(x,y,obj_player.x,
obj_player.y);

if(abs(target_direction-aim_direction)>180)
{
target_direction+=sign(aim_direction-target_direction)*360
}

if(abs(target_direction-aim_direction)>2)
{
if(aim_direction<target_direction){event_user(5);}
else if(aim_direction>target_direction){event_user(6);}
}


Try to check that this is incorporated in yours if it is which i dont believe so please try to make it more seamless and flow better
  • 0

#6 turgon

turgon

    VP Studios

  • GMC Member
  • 550 posts
  • Version:GM:Studio

Posted 20 August 2009 - 04:43 AM

Hmm... So are you saying that you would like it if the AI turns slowly (instead of instantly)? I confess that I hadn't considered that before, and hadn't planned on the AI being like that. (I agree that it is easily incorporated). I suppose that I could add an argument that asks whether or not the movement should be smooth. At the moment it focuses almost purely on the strategy aspect instead of the physics part. This could add a lot of strategy to it though, since you would be able to sneak up behind them!
Or...
Are you saying that you'd like it that the AI doesn't graphically jitter back-and-forth? It doesn't do it very much as far as I can tell, but I see how you might like it to be better...
Or...
Both?
Please reply, and then I'll update it!
  • 0

#7 Snoogms

Snoogms

    GMC Member

  • New Member
  • 103 posts

Posted 25 September 2009 - 11:10 AM

Thanks for this, and thanks for good comments in the script, I'm learning a lot on this:)

Motion planning looks like fun to play with
  • 0
“One of the most difficult tasks people can perform, however much others may despise it, is the invention of good games.” --Jung


|| "For a WIP, 8/10." --chichmonkey || "I'll give it a 9/10" --simple-games || "There's just something about this game which makes it so addictive" --ninja_sheep ||



#8 why789

why789

    GMC Member

  • New Member
  • 518 posts

Posted 30 September 2009 - 12:44 AM

love the script but i have one thing :)

when i create my ally i do the same thing i do with the enemy just switch the target and what-not and the enemy works fine but when i put in the ally it says "unknown variable retreat"

any help???
I tried to put retreat00 in the create event of the ally but no cigar :(

thanks
  • 0

#9 turgon

turgon

    VP Studios

  • GMC Member
  • 550 posts
  • Version:GM:Studio

Posted 30 September 2009 - 03:09 AM

Snoogms: Thanks! I'm glad that you found it helpful!

why789: Well, The only thing that I can think of at the moment is perhaps that the 'ready' variable wasn't initialized correctly. You can double check that by comparing your script to the step event of the AI in the example. If not, just let me know, and I'll look further into the problem. Thanks!
  • 0

#10 fredcobain

fredcobain

    GMC Member

  • GMC Member
  • 165 posts

Posted 30 September 2009 - 01:23 PM

Man, this is fantastic!

Congratulations!!

Pretty useful!
  • 0
I am an Posted Image in the GM Quiz!

#11 DZiW

DZiW

    GMC Member

  • GMC Member
  • 978 posts
  • Version:Unknown

Posted 30 September 2009 - 08:18 PM

Hi turgon.

It sounds pretty interesting, but mediafire is... yep.
Could you host GML only at a better place? Or just a better place would do)

Cheers
  • 0

YOU CREATE: WHERE LiFE MAY FAiL, DEAћ SHALL NOT!


#12 sunoco

sunoco

    GMC Member

  • GMC Member
  • 19 posts
  • Version:GM8

Posted 07 October 2009 - 01:22 AM

I am not sure if I am doing it wrong, but it seems as if you have to do more than put the code ( with objects replaced etc.) in the step event. You also have to place a create event, place controllers etc. Am I doing something wrong?
  • 0

#13 turgon

turgon

    VP Studios

  • GMC Member
  • 550 posts
  • Version:GM:Studio

Posted 09 October 2009 - 03:10 PM

Thanks guys; I'll get back to you tomorrow. I'm working until 11 tonight. (I'll probably just edit this post)

EDIT:

fredcobain: I'm glad that I was able to help you! It sounds like you enjoyed it!

DZiW: I have posted a mirror for filefactory in the original post. Enjoy!

sunoco: Well, you obviously have to convert the example code in order for it to work in your own game. You have to make your own objects and stuff. Here's a tip: make your game before you put in the AI. You should put the AI in last because this allows you to properly insert the code. The bare minimum that you need for the code to work is just the script execution. In order to make it work like the AI in the example, you do need a create event as well; it will just contain variables to initialize. Without the create event variables in the example, the AI would all be the same, and they would always be executing all of the code. I hope this helps!

Edited by turgon, 10 October 2009 - 06:59 PM.

  • 0

#14 Tarik

Tarik

    GMC Member

  • GMC Member
  • 2731 posts
  • Version:GM:Studio

Posted 10 October 2009 - 10:54 PM

Dear Turgon,

I really enjoyed your example. There's a few great points, but also a number of things that can be improved on.

First of all, I loved your presentation of the demo. Often times there's new people on the GMC looking for information, and finding examples that they don't know how to command. You very easily allowed me to quickly look through all of the features in different environments with different settings.

The actual AI? It was rather nice, with a lot of interesting features I haven't seen before here at the GMC in other examples which were limited to just pursuing and sometimes dodging while firing all the time. However, you have left the user with little documentation, which could've been used both for learning, as well as for modifying and adding or changing features. I've never in my life used an example as an engine for my game, I don't think anyone will create amazing games if they don't understand the underlying code/engine they used. But when I just started out with GM in 2003 apart from reading the manual, I learned most by reading explanations of examples provided to me. As such, though this example might be useful to some who want to create a quick game without understanding the work you have done for them, it's not particularly useful for learning about AI. It might be cool if you could comment the vp_tds_ai() script more. You have placed descriptions of what a code is used for, but not how it works. For example, new users could learn a lot if you could explain "//find the best cover" in more detail. Then others can both learn from, as well as improve your work.

There were a few times where the AI would get stuck for a short period, sometimes directly infront of an enemy. Also, at numerous times the opponents would attempt to fire through the wall. It should be too difficult to check for collisions with walls.

Lastly, there's some comments to be made about the fun-factor, variety-factor and realism-factor, which are very much interrelated. If I were to play a game I would find it rather awkward for an enemy to make a 180 degree turn in 1/50th of a second and fire at me. If you were to add turning into the game, it would require a whole different way of movement, dodging, seeking cover, and of course, firing in the right direction. The same goes for acceleration to full speed running, walking more slow when going backwards etc. I would personally not enjoy a game where you can turn and run at full speed in any direction instantly. It's exactly the way of dealing with the flaws of the human physique that plays such a great role in strategy, when you take that away it comes down to spamming bullets while moving in all crazy directions.

Then there's the lack of range based weapons, and with that I mean, weapons without infinite range. Pistols, shotguns, versus snipers. It would be interesting to see the AI try to get more closer, or use different types of weapons at different distances, set mines or throw grenades. You can't develop a game with a single weapon for all NPCs, a lack of such variety is just not fun (though you did include reload time.)
Lastly, there are features for sneaking up on opponents. It would be interesting if you would include fog of war kind of features, or visibility only when in-sight, but that's something that individual developers can add themselves.

Anyway I hope you understand my praise and my suggestions. Once again, great work, I hope you'll continue to improve it. I got 90 fps at the last room btw, impressive efficiency.
Take care,

Tarik
  • 0

#15 Dylijn

Dylijn

    GMC Member

  • New Member
  • 553 posts

Posted 14 October 2009 - 01:33 PM

Wow nice A.I.

It would be even better if they had a vision and or roam around.

Nice job man :lol:
  • 0


#16 JackBread

JackBread

    Spiky Bread of Death

  • GMC Member
  • 453 posts

Posted 23 October 2009 - 05:46 AM

This is awesome! It works great. ^_^

Edited by JackBread, 23 October 2009 - 06:09 AM.

  • 0

#17 why789

why789

    GMC Member

  • New Member
  • 518 posts

Posted 30 October 2009 - 04:24 PM

Snoogms: Thanks! I'm glad that you found it helpful!

why789: Well, The only thing that I can think of at the moment is perhaps that the 'ready' variable wasn't initialized correctly. You can double check that by comparing your script to the step event of the AI in the example. If not, just let me know, and I'll look further into the problem. Thanks!

sorry im taking so long to reply but like i said i duplicated the enemy AI and simply changed the arguments didnt change anything in the ready and so forth
  • 0

#18 KilmarGames

KilmarGames

    GMC Member

  • New Member
  • 422 posts

Posted 03 January 2010 - 02:37 AM

I get two errors. One in the script at line 56 position 27.

And i get this starting the game:

___________________________________________
COMPILATION ERROR in Script: vp_tds_ai
Error in code at line 56:
//This script was developed by VP Studios. Place it in the Step Event of the ai object.//vp_tds_ai(initialize,opponent,cover,dodge_this,amm
unition,difficulty,max_speed,grid_size,ally,reload_
time)/* initialize | true if first time running (make a variable) opponent | the target object cover | the cover object dodge_this | the bullet object to dodge ammunition | what to shoot difficulty | difficulty level (0=impossibly stupid, 100=genius) max_speed | maximum walking speed grid_size | the size of the squares that the AI will be walking around on (best set to the rounded-up square size of the characters) ally | the ally object (usually the object it is) (this allows cooperation among team members) reload_time | how often the AI can shoot (default 15)*/if argument0=1 {//basically a create event, but contained in this script grid_size=argument7; intelligence=abs(min(argument5,100)); walk_speed=argument6*(2/4); retreat_speed=argument6*(3/4); dodge_speed=argument6*(4/4); retreat=0; retreat_timer=0; max_retreat_timer=120; casual_distance=50+intelligence*2; dodge_distance=intelligence; grid_size=argument7; //initialize the movement grid mgrid=mp_grid_create(-grid_size,-grid_size,room_width/grid_size+2, room_height/grid_size+2,grid_size,grid_size); mpath=path_add(); walking_path=0; path_update=0; path_update_speed=20; strategy_index=min(round(random(intelligence/10)+1),instance_number(argument2)); strategy_change=intelligence; strategize=strategy_change; can_shoot=1; reload_time=argument9; reload_index=0; ddirection=0; if random(100)>=(100-intelligence) then is_smart=1; else is_smart=0; pn=choose(1,-1); //positive or negative (random) hit_indicator=health_points; rush_ready=1; rush=0; support_ally=0; }nearest_ally=instance_nearest(x,y,argument8);if support_ally=1 {target=nearest_ally.target; }else {target=instance_nearest(x,y,argument1); } if !instance_exists(target) {support_ally=0; exit; } cover=instance_nearest(x,y,argument2);cover_type=a
rgument2;retreat_timer+=1;path_update+=1;strategize
+=1;dodge_this=instance_nearest(x,y,argument3);if retreat_timer>=max_retreat_timer {retreat_timer=0; retreat=0; //also use this timer for other strategical factors rush=0; rush_ready=1; if random(100)>=(100-intelligence) then is_smart=1; else is_smart=0; pn=choose(1,-1); support_ally=0; }if path_update>=path_update_speed {path_update=0; walking_path=0; }if can_shoot=0 {reload_index+=1; if reload_index>=reload_time {reload_index=0; can_shoot=1; } }//find the best coverif strategize>=strategy_change {i=grid_size; strategic_cover=instance_nth_nearest(target.x,targ
et.y,argument2,strategy_index); strategy_index=min(round(random(intelligence/10)+1),instance_number(argument2)); strategize=0 do {strategic_direction=point_direction(target.x,targ
et.y,x,y)-(100-intelligence)+random(2*(100-intelligence)); strategic_x=strategic_cover.x+(grid_size/2)+lengthdir_x(i,strategic_direction); strategic_y=strategic_cover.y+(grid_size/2)+lengthdir_y(i,strategic_direction); i+=1; } until (collision_circle(strategic_x,strategic_y,grid_siz
e/4,cover_type,0,0)<=0) do {strategic_direction=point_direction(target.x,targ
et.y,x,y)-(100-intelligence)+random(2*(100-intelligence)); normal_cover_x=cover.x+(grid_size/2)+lengthdir_x(i,strategic_direction); normal_cover_y=cover.y+(grid_size/2)+lengthdir_y(i,strategic_direction); i+=1; } until (collision_circle(normal_cover_x,normal_cover_y,gr
id_size/4,cover_type,0,0)<=0) } //shootingddirection=point_direction(x,y,target.x,ta
rget.y);if collision_line(x,y,target.x,target.y,cover_type,0,
0)<=0 {if can_shoot=1 && collision_line(x,y,target.x,target.y,argument8,0,1
)<=0 {z=instance_create(x+lengthdir_x(20,ddirection), y+lengthdir_y(20,ddirection),argument4) z.direction=ddirection-(50-intelligence/2)+random(2*(50-intelligence/2)); can_shoot=0; } } //dodging projectilesif distance_to_object(dodge_this)<=dodge_distance {if is_smart=1 {if collision_line(x,y,dodge_this.x,dodge_this.y,cover
_type,0,0)<=0 {//dodge the projectile if there isn't an obstacle in the way and are smart enough if random(100)>intelligence*2 then exit; path_end(); mp_potential_step_object(dodge_this.x,dodge_this.y
,-dodge_speed,cover_type); exit; //and don't double-move } } else {//dodge the projectile no matter where it is if random(100)>intelligence*2 then exit; path_end(); mp_potential_step_object(dodge_this.x,dodge_this.y
,-dodge_speed,cover_type); exit; //and don't double-move } } //if just hit, then retreat (if smart enough)if hit_indicator!=health_points {hit_indicator=health_points; if is_smart=1 {retreat=1; rush=0; retreat_timer=0; } } //if nearest ally needs help, then support them (if smart enough)if nearest_ally.retreat=1 {if intelligence>=30 {support_ally=1; retreat_timer=0; } }else {if is_smart=1 {if nearest_ally.hit_indicator!=nearest_ally.health_points {support_ally=1; retreat_timer=0; } } }if rush=0 {//normal movement if collision_line(x,y,target.x,target.y,argument2,0,0
)>0 {if retreat=0 {if distance_to_object(target)>casual_distance {//just run for the target vp_tds_ai_grid_walk(target.x,target.y,retreat_spee
d,0); } else {//sneak up on target vp_tds_ai_grid_walk(strategic_x,strategic_y,walk_s
peed,0); if rush_ready=1 //if ready to rush, then rush opponent {rush_ready=0; if random(100)>=(100-intelligence) {rush=1; retreat_timer=0; } } } } else {//run for strategic cover vp_tds_ai_grid_walk(strategic_x,strategic_y,retrea
t_speed,0); } ddirection=direction } else {if retreat=0 {//be a moving target (if smart enough) if is_smart=1 {vp_tds_ai_grid_walk(normal_cover_x,normal_cover_y
,walk_speed,0); } else { } } else {//run for nearest cover vp_tds_ai_grid_walk(normal_cover_x,normal_cover_y,
retreat_speed,0); } } }else {//rush opponent! vp_tds_ai_grid_walk(target.x,target.y,dodge_speed,
0); }image_angle=ddirection; //point the correct way
^
at position 12: Variable name expected.


  • 0
Kilmar Games has a website!

#19 spicydeath82

spicydeath82

    Awesomesauce

  • New Member
  • 138 posts
  • Version:GM8

Posted 21 January 2010 - 09:39 AM

very good example. i did experience slow down with 100 units in the room, but other then that nice job, only suggestion i would make would be use of a collision mask for all the units so they don't get stuck so easily. i'd also suggest perventing them from moving into each other.
  • 0
Life is incapable of of springing from nothing. Science has proven that. So if life here didn't spring up outta the primordial muck then who's responsible? Life has to come from life.

Posted Image

#20 Xalrons444

Xalrons444

    GMC Member

  • New Member
  • 588 posts

Posted 27 January 2010 - 07:49 PM

I'm going to download this and probably use it for my game. I first incountered it in its excellent use in N4SPD's game EXO.

Edit: I have played the demo and it has by far the best top down AI that I have ever seen. I am definately using it in my game.

Edited by Xalrons444, 27 January 2010 - 07:52 PM.

  • 0

#21 why789

why789

    GMC Member

  • New Member
  • 518 posts

Posted 08 April 2010 - 07:52 PM

i used his AI in one of my games :D search for territory killer on yoyogames.... username is why789
  • 1

#22 Xalrons444

Xalrons444

    GMC Member

  • New Member
  • 588 posts

Posted 30 May 2010 - 10:32 AM

I've adapted it so that there are four different weapons and the health shows.
Posted Image
There are currently four weapons:
pistol
SMG
Assault rifle
Sniper rifle

The AI treats them all the same apart from the sniper rifle. The AI never rushes while using the sniper rifle

Edited by Xalrons444, 30 May 2010 - 10:39 AM.

  • 0

#23 CaptainLepidus

CaptainLepidus

    GMC Member

  • GMC Member
  • 852 posts
  • Version:GM:HTML5

Posted 01 June 2010 - 11:34 PM

Umm...ok? That post wasn't really helpful, just letting you know :unsure:
  • 0

"The reason programming is addictive is the same reason a good game is addictive: it constantly feeds you with a sense of minor accomplishment on your way to [achieving] the greater goal."

Yal

Planning to build a network of like-minded, innovative GameMaker developers, connected by a set of tools for building awesome games. Interested? PM me.


#24 Xalrons444

Xalrons444

    GMC Member

  • New Member
  • 588 posts

Posted 02 June 2010 - 08:33 AM

Sorry.

Edit: Now something useful. I have made three changes
1. I have improved the AI itself maiking it better at choosing targets. i.e. if the nearest enemy is through a wall but the second nearest is in plain view. It will now choose the second nearest enemy as its target.

2. I have created a much better spawning system which does do two things
-allows you to edit the spawing area in the room editor
-tries to make you spawn behind cover, far away from the nearest enemy. Spawn killing used to be common.

3. Improved the HUD. The player's health bar and weapon are now displayed on the HUD.

Edit2: I have improved the AI again. I often found, while playing, that I would be standing behind an enemy firing at it while it ignored me and concentrated on one of my allies. Now I have changed it so that if there is an enemy that is very close and in it's line of sight, it will switch target to it. I am now almost ready to release my editted version of the AI.

Edit3: Ihave sent this editted version Turgon and it is available for donwload from the first post.

Edited by Xalrons444, 06 June 2010 - 06:02 PM.

  • 0

#25 Xalrons444

Xalrons444

    GMC Member

  • New Member
  • 588 posts

Posted 09 July 2010 - 09:19 PM

I have started to make a game called Space Ops from my editted version of this AI. Here is a link to it on Yoyo Games and here's one to the GMC topic.

Edited by Xalrons444, 10 July 2010 - 08:38 AM.

  • 0

#26 StashAugustine

StashAugustine

    GMC Member

  • New Member
  • 8 posts

Posted 01 December 2010 - 03:38 AM

The AI works pretty well. Good job!

I modified it with some vision abilities, so that it can only attack you when it sees you. But there are problems with the mp_grid. It doesn't like changing paths.
As an example, the enemies home in on my last known position, but if they don't see me they then stand still, rather than go back to their old routine. Do you know why this is?

Also, I can't figure out how the cover system works. But the AI is still great. Thanks for putting this up.
  • 0
Non nobis, Domine, sed nomini tuo da gloriam.

RA Heinlein's Starship Troopers in alpha. Burn Bugs in the world of Starship Troopers under the pressure of an AI Director.
http://sandbox.yoyog...arship-troopers

#27 Sir

Sir

    Jedi Poodoo

  • GMC Member
  • 384 posts
  • Version:GM:Studio

Posted 21 December 2011 - 05:41 PM

Ok, sorry for necro'ing a dead topic, but i found this and i would like to use it, but when i put it in my game, it gives these 2 errors...


ERROR in
action number 1
of Step Event
for object obj_military_2:

In script vp_tds_ai:
Illegal argument count calling script "vp_tds_ai_grid_walk".
Script requires 3 arguments, 4 have been supplied.

___________________________________________
ERROR in
action number 1
of Step Event
for object obj_military_2:

In script vp_tds_ai:
Error in code at line 111:
normal_cover_x=cover.x+(grid_size/2)+lengthdir_x(i,strategic_direction);
^
at position 31: Unknown variable x

I can fix the unkown var x by simply deleting the .x in the cover.x, and the .y in the cover.y (hope i don't break anything...) but i am not sure how to get past the top error... Any help? And once again, sorry for necro'ing this topic

Also, I am using GM 8.1

Edited by SirGuy, 21 December 2011 - 06:01 PM.

  • 0

For my sake, please RTFM.


#28 The Legend

The Legend

    Unashamed

  • GMC Member
  • 1132 posts
  • Version:GM:Studio

Posted 20 March 2012 - 09:32 PM

B-E-A UTIFUL!
EDIT: Spoke too soon. This is trash. Cold be awesome but in order to really get this to work you need an understanding of the script itself. I will attempt to do so and remake this script (if I can) Though I might not even study the script and just try it myself. I'm glad it works for you guys though. Wis I could say the same...

Edited by The Legend, 24 March 2012 - 04:42 PM.

  • 0

#29 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 09 November 2012 - 06:46 AM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.
  • 0

#30 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 09 November 2012 - 06:46 AM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.
  • 0

#31 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 09 November 2012 - 06:46 AM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.
  • 0

#32 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 09 November 2012 - 06:46 AM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.
  • 0

#33 Greenhawk

Greenhawk

    Gue Games

  • GMC Member
  • 722 posts
  • Version:GM:Studio

Posted 10 November 2012 - 12:37 PM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.

bro you just spam quadrouple posted. you can't do that. for most reasons moderator. could lock this topic whih would be bad because people use this a lot and need to ask questions about his script. :ninja:

also..
Same with sirguy i get the same error.
AWESOME JOB ON THE SCRIPT BY THE WAY TURGON! :biggrin:

Edited by Greenhawk911, 10 November 2012 - 12:38 PM.

  • 0

Games Made:

 

Youtube Channels:

One of the many GMC Gurus.


#34 ionasskopelitis

ionasskopelitis

    GMC Member

  • GMC Member
  • 14 posts
  • Version:GM8

Posted 24 November 2012 - 07:40 AM

its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.


its not working in gm html5 whell it shoots but the only thing it does is shoot and when i take cover it stops shooting, but it doesnt move it just stays there.

bro you just spam quadrouple posted. you can't do that. for most reasons moderator. could lock this topic whih would be bad because people use this a lot and need to ask questions about his script. :ninja:/>

also..
Same with sirguy i get the same error.
AWESOME JOB ON THE SCRIPT BY THE WAY TURGON! :biggrin:/>


i'm sorry by computer bugged at that moment so i didnt know if it was posted so i refreshed the page like four times and it got posted 4 times im sorry.
  • 0

#35 Darc_Wolf

Darc_Wolf

    GMC Member

  • GMC Member
  • 4 posts
  • Version:GM8.1

Posted 25 January 2013 - 12:00 AM

I deleted all objects in the room, added some walls, tiles, the enemy object, the player object, and the obj_control, but when I start the game, I get this error:


___________________________________________
ERROR in
action number 1
of Step Event
for object obj_opponent:

In script vp_tds_ai:
Error in code at line 111:
normal_cover_x=cover.x+(grid_size/2)+lengthdir_x(i,strategic_direction);
^
at position 31: Unknown variable x


Sorry for the bump, but I really would like to use this. I'm using GM8.1 Pro.

Edited by Darc_Wolf, 25 January 2013 - 12:02 AM.

  • 0