PDA

View Full Version : AI skill creation


goodtimeshaxor
08.03.2007, 01:09
I'm interested in making skills through AI. These skills are imposible through conventional skilldata scripting but are a reality through AI scripting. I need some help, any help will do.

If you can provide any of the following please reply:
1. Script a brand new skill through AI.obj
2. Help me learn AI.obj
3. Combination of the two
4. Or anything that will get me closer to my goal

Interesting aye? Let's recap: A skill that is imposible to implement through skilldata.txt but can be done through ai scripting. Again, this means that it's a skill that can be done and is something out of the ordinary which ultimately means a brand new skill that has, to my knowledge, never been made.

^_^

m4rk
08.03.2007, 01:38
your skill summons a pet that makes action on master and then despawns.

This would allow Per example to make a skill that makes a earthquake... :) (You can make //earthquake through AI ^_^)
I think that would be a nice effect for any skill :p

FidoW
08.03.2007, 01:51
In the past we use AI to implement some skills like "Summon Arrows" or unpack soulshots ... or "Scroll of Escape for towns"...

Thats is because with C1 skilldata was imposible to get an item through an skill so... with AI, summoning a pet who give an item to master and later despawn... in the case of the SOE towns is a similar idea, pet teleport master to the required location and later despawn...


some examples... C1 NASC... my own code...

Decompressing packs...

class default_npc { }

class summon_item : default_npc {
parameter:
int item = 1;
int cantidad = 1;

handler:

EventHandler CREATED() {
GiveItem1(myself.master, item, cantidad);
AddTimerEx(30001, 100);
}

EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 30001) Despawn();
}

}

// Soulshot
class soulshot_decompressor_n : summon_item {
parameter:
int item = 1835;
int cantidad = 300;
}


Summoning arrows...

class default_npc { }

class summon_item_random : default_npc {

parameter:
int item = 1;
int cantidad_fija = 1;
int cantidad_random = 1;

handler:

EventHandler CREATED() {
GiveItem1(myself.master, item, cantidad_fija+Rand(cantidad_random));
AddTimerEx(30001, 100);
}

EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 30001) Despawn();
}

}

class summon_mithril_arrow : summon_item_random {
parameter:
int item = 1344; // @mithril_arrow
int cantidad_fija = 450;
int cantidad_random = 1350;
}


SOE to towns (C4 SOEs)

class default_npc { }

class scroll_of_escape_town : default_npc {
parameter:
int x = 0;
int y = 0;
int z = 0;
int castle = 0;
string fnYouAreChaotic = "tcm.htm";

handler:

EventHandler CREATED() {
if (myself.master.karma > 0) {
ShowPage(myself.master, fnYouAreChaotic);
Despawn();
}
else if (castle > 0) && (Castle_IsUnderSiege2(castle))
{
ShowSystemMessage(myself.master, 707); // No puedes teletransportarte a un pueblo que este en asedio
Despawn();
}
else {
AddTimerEx(50000, 100);
InstantTeleport(myself.master, x, y, z);
}
}

EventHandler TIMER_FIRED_EX(timer_id) {
if (timer_id == 50000) Despawn();
}

}

class summon_soe_talking : scroll_of_escape_town {
parameter:
int x = -83900;
int y = 242700;
int z = -3700;
int castle = 0;
}

evern
10.03.2007, 19:02
Thanks to fidows post i am able begin my first attempt to add skills that buff stats, i'm able to add a kind of validation to whether players buff stack on this by retaining the summon until a certain period using TIMER_FIRED, which when it will die and negate the stats, but a major problem arise because players can select the summon and unsummoning it manually, this causing the AI not able to negate the stats before the timer runs out.

i tried a few methods but to no avail...........

1) negate the stats upon MY_DYING
problem: MY_DYING doesn't work when players unsummon them manually
s
2) negate the stats upon TALKED and TALK_SELECTED
problem: doesn't work either

so here's my question

1) what are the parameter that is passed in to MENU_SELECTED when players click unsummon? (maybe this method works?)

2) is there any other way around this?

any help appreciated... really.... i'm stucked for days... thanks in advance


class stat_inc_skills : default_npc
{
parameter:
int Stat = 0;
int Amount = 0;

handler:
EventHandler CREATED()
{
myself->AddTimerEx(3000,1000);
}

EventHandler TIMER_FIRED_EX(timer_id,i0,i1)
{
if( timer_id == 3000 )
{
i0 = Stat;
i1 = Amount;
myself->IncrementParam(myself.master,i0,i1);
despawn();
}
}

}



class 1 stat_inc_skills : default_npc
parameter_define_begin
int Stat 0
int Amount 0
parameter_define_end
handler 13 17 // CREATED
variable_begin
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // myself
push_const 704
add
fetch_i
push_const 3000
push_const 1000
func_call 184680487 // func[AddTimerEx]
shift_sp -2
shift_sp -1
handler_end

handler 12 540 // TIMER_FIRED_EX
variable_begin
"timer_id"
"i0"
"i1"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

push_event // timer_id
push_const 236
add
fetch_i4
push_const 3000
equal
branch_false L12899
L12898
push_event // i0
push_const 260
add
push_reg_sp
fetch_i
push_parameter Stat
assign4
shift_sp -1
L12900
push_event // i1
push_const 264
add
push_reg_sp
fetch_i
push_parameter Amount
assign4
shift_sp -1
L12901
push_event // myself
push_const 704
add
fetch_i
push_event // myself
push_const 704
add
fetch_i // master
push_const 552
add
fetch_i
push_event // i0
push_const 260
add
fetch_i4
push_event // i1
push_const 264
add
fetch_i4
func_call 184746219 // func[IncrementParam]
shift_sp -3
shift_sp -1
L12902
push_event // myself
push_const 704
add
fetch_i
func_call 184549616 // func[Despawn]
shift_sp -1
L12899
handler_end

class_end

goodtimeshaxor
12.03.2007, 02:07
Hm, before I start to mess with AI, how are you able to use "NASC" or whatever that is? AI isn't written in that language for C4.

FidoW
12.03.2007, 02:16
Using a compiler... maybe ?

C1 AI is like C4 but with some differences... in C1 we have a good NASC compiler, now... people like me compile it by hand.. but others looks like he have a compiler... would be interesting sharing that and all together start coding faster... in the past i code a lot of stuff for C1 and share some things, right now im too tired to compile it by hand... i need my time for other things.

evern
12.03.2007, 14:07
whos got a c4 compiler? please share dont be selfish... =P i had enough of coding it by hand

m4rk
12.03.2007, 18:03
check here (https://postpacific.loc-online.com/forums/showthread.php?t=6823&highlight=nasc) and ask them to gently compile your c4 nasc code into c4 ai.obj :)

FidoW
12.03.2007, 18:10
The problem of that system is i cant make my own test, i never write the final code in the first time, i code... test... modify... test... add... and if I need to wait between every change i made for someone to compile it for me... :s