Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

deleting npc's
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Mon Dec 22, 2003 7:37 pm    Post subject: deleting npc's Reply with quote

Question yo, is there a script to make an npc destroy another npc, heres the example:the hero uses npc 1, and it walks down 4 spaces, npc 2 is in the way so npc 1 destroys npc 2 and keeps walking, dose npc 1 need a npc in range script, or is it impossible. if any one can help, thankz Question
Back to top
View user's profile Send private message
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Mon Dec 22, 2003 11:48 pm    Post subject: Reply with quote

I'm not sure if this is what you want, but I think you could just check to see if they are next to eachother (I'm assuming there's a way to check the postition of NPCs) and if they are next to eachother, destroy NPC 2.
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Tue Dec 23, 2003 10:13 am    Post subject: Reply with quote

Question what if there are lots of other npcs around that npc Question
Back to top
View user's profile Send private message
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Tue Dec 23, 2003 1:00 pm    Post subject: Reply with quote

You'd only be checking the position of NPC1 and NPC2. Unless the others were copies of those two (which would probably be bad) they wouldn't be important.
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
Setu_Firestorm
Music Composer




Joined: 26 Mar 2003
Posts: 2566
Location: Holiday. FL

PostPosted: Tue Dec 23, 2003 2:23 pm    Post subject: Reply with quote

Code:
script, KillThaFoo, begin
walk npc (1,down,4)
wait for npc (1)
wait (2)   #just to give it time
destroy npc (2)
end


I dunno if that's what you're asking er not, but hope that helps.
_________________


Facebook: http://www.facebook.com/georgerpowell
Newgrounds: http://setu-firestorm.newgrounds.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Tue Dec 23, 2003 2:42 pm    Post subject: Reply with quote

I thought of that first but it seemed so simple that he wouldn't even need to ask about it. I assumed he meant something like a wandering NPC that will destroy another NPC. If he just wants an NPC to walk down and have another one be destroyed (which would be way easier) then that would work.
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
Setu_Firestorm
Music Composer




Joined: 26 Mar 2003
Posts: 2566
Location: Holiday. FL

PostPosted: Tue Dec 23, 2003 2:46 pm    Post subject: Reply with quote

Shoot, for all I know, you could be right. I just threw in what I know would work, but if he wanted the NPC #1 to wander, then I'm in the same boat you are....I don't really know.
_________________


Facebook: http://www.facebook.com/georgerpowell
Newgrounds: http://setu-firestorm.newgrounds.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Dec 23, 2003 6:14 pm    Post subject: Reply with quote

No, I believe that what he wanted was to make npc walk down 4 spaces, ans if it bumped into npc 2, it would destroy it. You'd want a script like this:

script, roll rock, begin
variable(ctr, npc1, npc2)
npc1 := npc reference (1)
npc2 := npc reference (2) #adjust these as nessacary for multiple copies)
for (ctr, 1, 4) do (
walk npc (npc1, down, 1)
wait for npc (npc1)
if (npc x(npc1) == npc x(npc2) , and, npc y(npc1) + 1 == npc y(npc2)) then (destroy npc (2))
#checks to see if npc2 is below npc1
)
end
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Wed Dec 24, 2003 1:35 pm    Post subject: Reply with quote

Question yo,cati thankz it seem to working perfect, but wat if there was a copy of npc 1 in the way or multiple copies of npc 2, would i have the script read like this:
Code:

script, roll rock, begin
variable(ctr, npc1, npc2,npc3,npc4)
npc1 := npc reference (1)
npc2 := npc reference (2) #adjust these as nessacary for multiple copies)

npc3 := npc referecne (3)
npc4 := npc referecne (4)

for (ctr, 1, 4) do (
walk npc (npc1, down, 1)
wait for npc (npc1)
if (npc x(npc1) == npc x(npc2) , and, npc y(npc1) + 1 == npc y(npc2)) then (destroy npc (2))
#checks to see if npc2 is below npc1
)
end


notic the npc 3 and 4 reference, would that be telling npc 1 to delete npc 3 and 4 or the third and forth copies of npc 2. the other thing im tryin is checking in all 8 directions of npc 1, i think i can handle that by coping the [if (npc x] statement right? , thankz a lot for the help peeps. Question
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Dec 26, 2003 2:29 am    Post subject: Reply with quote

8 directions? Do you mean that if the npc is ever next to (including diagonally) the other npc(s), they're destroyed? And do you want the npc to stop if it bumps into another copy of itself? Hmmm....
Well, if it bumps into another npc, it ought to stop automatically, as npcs can't walk through each other (unless you use a 'suspend obstruction' command)

Ok, this script is far more complicated, but you can use the extra scripts for other things too:

Code:

define script (
100, roll rock, 2, 0, 0 #game.exe automatically gives the npc ref of the npc you clicked on 2nd arg
 -1, maximum, 2, 0, 0 #returns the larger of 2 numbers
 -1, minimum, 2, 0, 0 #like the above (never used)
 -1, absolute, 1, 0 #returns absolute value (turns negatives into positives)
)

script, roll rock, useless, npc ref, begin
 variable (ctr, ctr2, nocopies, x1, y1, npc2, last y)
 nocopies := npc copy count (2)
 last y := -1
 for (ctr, 1, 4) do, begin
  walk npc (npc ref, down, 1)
  wait for npc (npc ref)
  x1 := npc x (npc ref)
  y1 := npc y (npc ref)
  for (ctr2, 0, nocopies -- 1) do, begin #go through each copy of npc 2 and check it.
   npc2 := npc reference (2, ctr2)
   # if the second npc is no more than 1 tile away in both x and y directions, it must be next to the first npc
   if (maximum (absolute (x1 -- npcx (npc2)), absolute (y1 -- npcy (npc2))) <= 1) then (destroy npc (npc2))
  end
  if (last y == y1) then (ctr2 := 4) #if the 'rock' hasn't moved, then it must be stuck. Stop the loop.
  last y := y1
 end
end

script, minimum, val1, val2, begin
 if (val1 >> val2) then (return (val2)) else (return (val1))
end

script, maximum, val1, val2, begin
 if (val1 << val2) then (return (val2)) else (return (val1))
end

script, absolute, val1, begin
 if (val1 << 0) then (return (0 -- val1)) else (return (val1))
end


You will get a warning from HSpeak that useless is never used, ignore this.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Tue Dec 30, 2003 4:44 pm    Post subject: War anyone? Reply with quote

Idea yo, ok heres wat im really trying to do, im tryin to make a small checkers type of mini game,npc 1 is the white piece and npc 2 is the black one,and there will be many other copies of npc 1 and 2. im sorry i didnt say that to begin with. i managed to make the movement phase (ex: the first hero is the cursor, and if it walks on a npc and the player presses enter, blocks are made around that npc representing how far it can move. the checking phase is the one im stuck on,(ex: there is copy of npc 2 in front of npc1 and i need that script to check if there is one ,and if there is run the jumping script that creates block to represent which directions npc 1 can jump npc 2. (by jumping i quess i can use a small walking script) and if theres another copy of npc 2 jump that one to, if not then stay on that spot,then a opponents turn phase(which in my case is a second player ,not AI, which is harder to make)for game example look at my avatar it show a small game(made with gifs) the actual game is a 8x8 checker board .

You see, i made up a game, i call it War,its a blend of chinese checkers and regular checkers,so basicly its chinese checkers on a checker board, i play it with my bros, any one can play it, it uses a checker board and its pieces,the first two rows are your end of the board and the opponents end is the oposite of yours,you and your opponent begin with 16 pieces each and place them on the first two rows of each end,you each take turns moving one piece at a time. The object is to take out all of your opponents pieces out. These are the rules, a level one piece (a regular checker piece) can move up,up right, up left,right,left,but it cant move backwards, but only one space, you can jump over your own pieces to move across the board and if you jump an opponents piece you take it and keep jumping his or your pieces until you reach the last row of the opponents side, once that happens you get to get a choice: get an extra piece or level up your existing piece (stack an extra piece over it) its bonus is, it gets to move one extra space (level 3 gets an extra 2 spaces, which is the maximum i think for now or maybe your game will be over by the time u get a chance to level up your pieceses to level 4 and beyond) once you choose, you place your new piece and old one back to your end of the board in any space on the last two rows. The level up rules are as so: a leveled up piece cant level itself up, it can only creates a new piece at your end of the board, and then is put back to you end of the board,on the other hand a level one piece can level up and existing leveled up piece or level itself up,if a leveled up piece gets jumped by a level one piece than the leveled one loses one level. and so these are the rules, or more like guide lines if you feel sometings need to be changed so be it.so that it thats why i was asking for a script like the one above,if again you can help me thankz a lot, if not then try out War yourself. Idea
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Jan 02, 2004 2:30 am    Post subject: Reply with quote

OH.

Well, you should have said that in the first place. But if you did, everybody would have been silent and not helped you.
When you said 8 directions, I thought you meant that as it moves down if any piece is on any of the adjacent 8 squares its destroyed, not that it can jump in 8 directions. Well, then my script apve is useless. Hmm... hmm...
This is rapidly sounding like Im going to end up writing much of your script, and I'm getting confused as to what exactly you want, so I'm just going to port the top one to 8 directions.

... tomorrow or the day after.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jan 04, 2004 11:33 am    Post subject: Reply with quote

Opps, too late. See you in a week!

WEEE!!! SUMMER HOLIDAY!
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Tue Jan 06, 2004 5:00 pm    Post subject: real complicated Reply with quote

Question yo, mad, thankz a lot for helping me out. this npc deleting script is getting real complicating, so i have shifted to a plan b. im experimenting with npc vehicles, the movement seems to be working fine but i just cant get the selecting phase down, check it out
Code:

script,blue,begin
if(checktag(8)==on)then,begin
destroynpc(npcatspot((herox),(heroy)))
createnpc(33,herox,heroy)
end
end

script,deleteblue,begin#21
#settag(8,off)
variable (deletebluenpc)
for(deletebluenpc,1,20)
do
 (destroynpc(33))
end

script,enterkey,begin
if(keyispressed(28))then,begin
settag(7,on)
alternpc(34,npcstat:vehicle,1)
end
end

script,red,begin#22
if(checktag(7)==on)then,begin
alternpc(34,npcstat:script,23)
blockingnpcs1
waitforkey(usekey)
settag(7,off)
settag(8,on)
wait for key (usekey)
deleteblocks
#settag(8,off)
wait for key (usekey)
alternpc(34,npcstat:vehicle,1)
end
end

script,redchange,begin#23
alternpc(34,npcstat:vehicle,0)
end


theres five scripts, the first one gose on the blue piece(player2) which is triggered when the red the hero mounts a red npc (vehicle), when the hero mounts a red npc and walks over a blue one, the blue is destroyed then a new one gets created which shows that its been jumped.

the second one is for deleting the new npc that is created when the blue one gets destroyed.

the third is for the enter key, when the enter key is pressed the red vehicle gets its vehicle value changed because at the begining of the game a textbox is shown that sets all red npc's vehicle value to 0 so the hero wont get in the first vehicle he touches(because the npc's are set to be used when stepped on)

the 4th one is the red piece's script(player 1's piece) it changes the blues script so that it can be deleted when stepped on,then creates blocks that represent where it can move, then deletes them when the hero is done moving, and at the end reds vehicle value gets set back.

the last script is for use in the begining of the game.

heres wat happens in the game i push enter the block are set up but the hero wont enter the vehicle, the only way it dose is if i move down one and back again, then hero dose go in the vehicle and it is used fine(the blue npc script works).

what im trying to do is this: the player pushes enter, then hero mounts the red vehicle, the blocking boxes come out,hero make movement then end of turn. so thats it, i still dont know if i should have 1 big script, or can it be done with a few scripts. thankz again mad, for helpin me out, and thankz to who ever can help me Question
Back to top
View user's profile Send private message
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Thu Jan 08, 2004 7:50 pm    Post subject: ok forget that one to Reply with quote

Question yo, ok forget the top one to, to hard. instead i decided to just change the heros picture and use that, much easier,why didnt i think of that to begin with. just one question, can u use -if key is pressed- statements in an npc's script. thankz, if any1 can help Question
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group