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

Tag checking for weapons

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Onlyoneinall
Bug finder




Joined: 16 Jul 2005
Posts: 746

PostPosted: Sat Jul 29, 2006 10:53 am    Post subject: Tag checking for weapons Reply with quote

Okay, so I want to make it so that either the "each step" or "autorun" and the "instead of battle" scripts for maps, I want the game to check which weapon is equipped, and accordingly it will change the battle picture. Since there will be more than one weapon, how do I write the script so that the picture and attack will be correct, according to the weapon?

Code:
if (check tag(tag:Pistol Equip))
then,begin
(write spell (hero:Reed,0,0,atk:Pistol))
set hero picture (hero:Reed,1,inside battle)
end
else,begin
(write spell (hero:Reed,0,0,0))
set hero picture (hero:Reed,0,inside battle)
end
if (check tag(tag:Rifle Equip))
then,begin
(write spell (hero:Reed,atk:Pistol))
set hero picture (hero:Reed,3,inside battle)
end
else,begin
(write spell (hero:Reed,0,0,0))
set hero picture (hero:Reed,0,inside battle)
end


That causes no attack to be used at all, since the else causes the hero to be unarmed even if he has a pistol. What should I do to get this to work for four different weapons?
_________________
http://www.castleparadox.com/gamelist-display.php?game=750 Bloodlust Demo 1.00

Back to top
View user's profile Send private message Send e-mail
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Sun Jul 30, 2006 10:14 am    Post subject: Reply with quote

Code:
if (check tag(tag:Pistol Equip)) then, begin
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
end, else, begin
  if (check tag(tag:Rifle Equip)) then, begin
    write spell (hero:Reed,0,0,atk:Pistol)
    set hero picture (hero:Reed,3,inside battle)
  end,else,begin,
    write spell (hero:Reed,0,0,0)
    set hero picture (hero:Reed,0,inside battle)
  end
end


I cleaned up the script, and fixed a bug for you. The key to this type of thing (until Ubersetzung comes out, at least) is to nest the if() then...else blocks, like this:

Code:
if something then
  great!
else
  if something else then
    great!
  else
    if something else 2 then
      great
    else
      nothing worked :(
    end
  end
end

_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jul 30, 2006 3:12 pm    Post subject: Reply with quote

Huh? What's going to change when U. comes out?
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
FnrrfYgmSchnish
Probably the Grand Poobah or something




Joined: 19 Jul 2003
Posts: 88
Location: Not here

PostPosted: Sun Jul 30, 2006 5:34 pm    Post subject: Reply with quote

Just a random guess, but since "Else" and "If" are involved... maybe the addition of an "Elsif"-type thing for plotscripts?
Back to top
View user's profile Send private message Send e-mail
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Sun Jul 30, 2006 5:56 pm    Post subject: Reply with quote

In U., I'd just do this:

Code:
if (check tag(tag:Pistol Equip)) then, begin
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
  exit script
end
if (check tag(tag:Rifle Equip)) then, begin
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
  exit script
end
write spell (hero:Reed,0,0,0)
set hero picture (hero:Reed,0,inside battle)


... actually, I lied. Right now, I'd do this:


Code:
write spell (hero:Reed,0,0,0) #default
set hero picture (hero:Reed,0,inside battle)

#special cases:
if (check tag(tag:Pistol Equip)) then, begin
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
end
if (check tag(tag:Rifle Equip)) then, begin
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
end

_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jul 30, 2006 10:36 pm    Post subject: Reply with quote

Code:

switch (true) do, begin
 case (check tag(tag:Pistol Equip)) do(
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
 )
 case (check tag(tag:Rifle Equip)) do (
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
 )
 else (
  write spell (hero:Reed,0,0,0)
  set hero picture (hero:Reed,0,inside battle)
 )
end


ehehe...
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Onlyoneinall
Bug finder




Joined: 16 Jul 2005
Posts: 746

PostPosted: Sun Jul 30, 2006 10:55 pm    Post subject: Reply with quote

Thanks you guys. It'll be nice to see a stop script command implemented sometime in the future. Happy
_________________
http://www.castleparadox.com/gamelist-display.php?game=750 Bloodlust Demo 1.00

Back to top
View user's profile Send private message Send e-mail
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Mon Jul 31, 2006 2:57 am    Post subject: Reply with quote

The Mad Cacti wrote:
Code:

switch (true) do, begin
 case (check tag(tag:Pistol Equip)) do(
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
 )
 case (check tag(tag:Rifle Equip)) do (
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
 )
 else (
  write spell (hero:Reed,0,0,0)
  set hero picture (hero:Reed,0,inside battle)
 )
end


ehehe...


That is an abomination of nature.
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Aug 01, 2006 1:35 am    Post subject: Reply with quote

Mike Caron wrote:
The Mad Cacti wrote:
Code:

switch (true) do, begin
 case (check tag(tag:Pistol Equip)) do(
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
 )
 case (check tag(tag:Rifle Equip)) do (
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
 )
 else (
  write spell (hero:Reed,0,0,0)
  set hero picture (hero:Reed,0,inside battle)
 )
end


ehehe...


That is an abomination of nature.


I made sure to make switch alot more abusable than it is in other languages.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Mike Caron
Technomancer




Joined: 26 Jul 2003
Posts: 889
Location: Why do you keep asking?

PostPosted: Tue Aug 01, 2006 2:27 pm    Post subject: Reply with quote

The Mad Cacti wrote:
Mike Caron wrote:
The Mad Cacti wrote:
Code:

switch (true) do, begin
 case (check tag(tag:Pistol Equip)) do(
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
 )
 case (check tag(tag:Rifle Equip)) do (
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
 )
 else (
  write spell (hero:Reed,0,0,0)
  set hero picture (hero:Reed,0,inside battle)
 )
end


ehehe...


That is an abomination of nature.


I made sure to make switch alot more abusable than it is in other languages.


It should not work that way! Crying it should be a jump table, with optimizations, and... *cry*
_________________
I stand corrected. No rivers ran blood today. At least, none that were caused by us.

Final Fantasy Q
OHR Developer BLOG
Official OHRRPGCE Wiki and FAQ
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Wed Aug 02, 2006 12:33 am    Post subject: Reply with quote

Mike Caron wrote:
The Mad Cacti wrote:
Mike Caron wrote:
The Mad Cacti wrote:
Code:

switch (true) do, begin
 case (check tag(tag:Pistol Equip)) do(
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,1,inside battle)
 )
 case (check tag(tag:Rifle Equip)) do (
  write spell (hero:Reed,0,0,atk:Pistol)
  set hero picture (hero:Reed,3,inside battle)
 )
 else (
  write spell (hero:Reed,0,0,0)
  set hero picture (hero:Reed,0,inside battle)
 )
end


ehehe...


That is an abomination of nature.


I made sure to make switch alot more abusable than it is in other languages.


It should not work that way! Crying it should be a jump table, with optimizations, and... *cry*


Come now, life can't always be fair...
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Onlyoneinall
Bug finder




Joined: 16 Jul 2005
Posts: 746

PostPosted: Thu Aug 03, 2006 1:49 am    Post subject: Reply with quote

I'm also wondering, is it better this script takes place for each step or for autorun?
_________________
http://www.castleparadox.com/gamelist-display.php?game=750 Bloodlust Demo 1.00

Back to top
View user's profile Send private message Send e-mail
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Thu Aug 03, 2006 5:53 am    Post subject: Reply with quote

I'd actually do it as an instead of battle script, as an every step script would use a lot of unneccessary processing time, and an autorun script (I assume you mean something like an on map load script or a new game script) would lose accuracy if someone changed equipment in the middle of a map.

Game.exe automatically passes the battle formation you would have fought as the first argument to an instead of battle script, so you can use fight formation to fight the appropriate battle as normal after you perform the appropriate calculations, like so:

Code:

begin, my instead of battle script, formationNum, begin
  write spell (hero:Reed,0,0,0) #default
  set hero picture (hero:Reed,0,inside battle)

  #special cases:
  if (check tag(tag:Pistol Equip)) then, begin
    write spell (hero:Reed,0,0,atk:Pistol)
    set hero picture (hero:Reed,1,inside battle)
  end
  if (check tag(tag:Rifle Equip)) then, begin
    write spell (hero:Reed,0,0,atk:Pistol)
    set hero picture (hero:Reed,3,inside battle)
  end

  fight formation(formationNum)
end
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
Page 1 of 1

 
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