I want to make a fairly simple "town raiding" script, basically I set what monsters to spawn, how many, and where they spawn, then where they should attack to(so I can set them to spawn out of town and attack/walk into town)
So I need to know how I could go about making a monster attack from one location to another(by this I mean walk towards the second location unless there is a player to attack, then stop walking and start attacking him)
Does anyone have any suggestions about how I could do this?
Question number two: How would I go about create a "multi"(Like I don't want it to be a house with a sign or anything, basically I just need to create one of the multis I can find in insideuo or uofiddler
How would I go about a "attack towards" on animals?
Moderator: POL Developer
How would I go about a "attack towards" on animals?
Last edited by Poi on Sat May 07, 2011 1:47 pm, edited 1 time in total.
Re: How would I go about a "attack towards" on animals?
So I thought about possibly using parts from the herding skill script, and it works on sheep, but not most monsters like dragons and what not, any ideas? Heres what I got so far
Code: Select all
use os;
use uo;
use cfgfile;
include "include/client";
include "include/eventID";
include "include/attributes";
include "include/skillPoints";
var i := 0;
program textcmd_raidtown( who, template )
var props array;
props.+facing := who.facing;
SendSysMessage(who, "Where would you like to spawn the raiders?");
var spawn := TargetCoordinates(who);
SendSysMessage(who, "Where would you like to spawn the raiders to attack?");
var attack := TargetCoordinates(who);
while(i < 15)
var result := CreateNpcFromTemplate( template, spawn.x, spawn.y, spawn.z, props );
if (!result)
SendSysMessage( who, "NPC Creation Failed: " + result.errortext );
return 0;
endif
var holder := {};
holder.append(attack.x);
holder.append(attack.y);
var ev := struct;
ev.+type := EVID_HERDING;
ev.+data := holder;
SendEvent(result, ev);
i := i + 1;
endwhile
endprogram
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Re: How would I go about a "attack towards" on animals?
First question is simple enough. Just have the npc walk towards the destination. If there is anyone to attack on the way, then attack. Nothing to attack, continue walking.
And the multi you want to use has been converted into your multis.cfg? Just use the createmulti() function.
And the multi you want to use has been converted into your multis.cfg? Just use the createmulti() function.
Re: How would I go about a "attack towards" on animals?
Your right, just have the npc walk towards the destination, I was asking more of how to do thatmr bubbles wrote:First question is simple enough. Just have the npc walk towards the destination. If there is anyone to attack on the way, then attack. Nothing to attack, continue walking.
And the multi you want to use has been converted into your multis.cfg? Just use the createmulti() function.
And thanks, didn't know about a createmulti function
-
- Grandmaster Poster
- Posts: 120
- Joined: Thu Jan 18, 2007 2:34 am
Re: How would I go about a "attack towards" on animals?
Ah ok. Well I take it you want to use existing NPCs, and not create unique raider NPCS?Poi wrote:Your right, just have the npc walk towards the destination, I was asking more of how to do that
I guess, depending how your AI is scripted you would want to alter the main ai loop. That being when the npc is doing nothing, just 'waiting for an event', wandering, etc.
For example, your main ai loop might look something like
Code: Select all
while (1)
#wander
#waiting for an event
enwhile
Code: Select all
while (1)
var raider := IsARaider(me);
if (raider) // can be a cprop on the npc, with destination info to use to walk towards
walk towards the raid co-ordinates for a few steps
endif
endwhile
Like i said, it all depends on your current AI scripts. But something like the above is a start.
Re: How would I go about a "attack towards" on animals?
Ah alright, that helps a lot, thank you