Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / first thread of my life how to make a variation destroy entiti ?

Author
Message
gendestroier
13
Years of Service
User Offline
Joined: 5th Jun 2010
Location: Brazil
Posted: 6th Jul 2010 18:21
well...where i start...
1.i'm creating a game but it makes a heavy use of customised scripts, and i did a character talk to me using the fpgcrawtext, put globalvar 40 to be activate when i stoop talking with him, this globalvar opens a modified scripted door (that closes when i pass the door and open when i talk with the char it opens) and this door have an activateifused commando to destroy an object, BUT the damm object needs a script also customed, to destroy the object, and i know it looks weird, but i need help to make that script works.

if someone want to take a look on the scripts....
no problem...i attach it

mods for creating a inteligent game,at least
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 6th Jul 2010 22:00
You should probably go ahead and attach it as it would be difficult to help without seeing what you have already done.

gendestroier
13
Years of Service
User Offline
Joined: 5th Jun 2010
Location: Brazil
Posted: 6th Jul 2010 22:30 Edited at: 6th Jul 2010 22:35
hummm.... hold on...



it's basicaly this...

and... the char script



simple trapdoor script(not mine, just added globalvar and activateifused)



mods for creating a inteligent game,at least
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 6th Jul 2010 23:13 Edited at: 6th Jul 2010 23:32
;Triggers
:state=0:activated=0,none
:state=0:activated=1,state=1
:state=1:activated=1,destroy


activated=1 is a condition, not an action.

So, it should be on the left side of the second colon with the conditions, not on the right side with the actions.

activate=x is an action but activated=x is a condition.

So it should have read...

;Triggers
:state=0,activated=0:none
:state=0,activated=1:state=1
:state=1,activated=1:destroy

Then we see the 'none' in the first line.
Is that valid???
If we don't want to take any action, then we can omit the line since there is another for state=0.

Then it reads...

;Triggers
:state=0,activated=1:state=1
:state=1,activated=1:destroy

But then we can simplify it further because we know it was activated=1 in order to go from state=0 to state=1, so checking again for activated=1 in state=1 is redundant.
So, we can remove that jump to another state and simply say...

;Triggers
:state=0,activated=1:destroy


This, however, still has a flaw.
The state=0 is the initialization state and will run when the entity is spawned.
If this entity was not spawned at start, then spawning it would put it in an activated state of 1 and this script would destroy it as soon as it spawns.

A better way to do it would be to set it to an activated state of 0 on its spawn by doing that in state=0.
Then we would check for the activated state=1 in state=1, like so...

;Triggers
:state=0:activate=0,state=1
:state=1,activated=1:destroy

Now it should work right whether the entity is spawned at the start or some time later.

I'll let Flatlander cypher the rest, but I noticed this much right away.

   Conjured Entertainment

 WARNING: Intense Madness
gendestroier
13
Years of Service
User Offline
Joined: 5th Jun 2010
Location: Brazil
Posted: 7th Jul 2010 00:21 Edited at: 7th Jul 2010 00:22
the object in this case will be destroyed in the start not when activated by ifused, that is the problem, my main idea is to make the entiti be destroyed when ''activated by ifused''


Quote: ";Triggers
:state=0:activated=0,none
:state=0:activated=1,state=1
:state=1:activated=1,destroy


activated=1 is a condition, not an action"



i was meaning a condition, then action ''none'' cuz if you get that action field clean i coud generate problems in that script.
you can't put an action in the place of the second condition in this case, you need a condition first, i wanned the engine to check if activatedifused was been activated, and then i make the state 1 to order a destroy action for that entiti.

that wasn't the first version of that script the first one says

nearactivable=0,none
nearactivable=1,destroy

of course it doesn't works
everything i'm sayng here i heard in somewere, so it coud be all wrong...

mods for creating a inteligent game,at least
gendestroier
13
Years of Service
User Offline
Joined: 5th Jun 2010
Location: Brazil
Posted: 7th Jul 2010 02:32
HAHA!!!!!!!!!!!!! HAHA!!!!!!!!!

IT'S WORKING !!!!!!!!!
IT'S WORKING !!!!!!!!!

the changes i did was

take this
Quote: ";Triggers
:state=0:activated=0,none
:state=0:activated=1,state=1
:state=1:activated=1,destroy"


and do that
:state=0,activated=0
:state=0,activated=1:state=1
:state=1,activated=1;subhealth=999999

then it execute the scripts line correctly


pay atention...

the scripts have to be used like that

1.put a door and change the main A.I to doortrap.fpi
2.put a triggerzone with the stock script activate.fpi after the door(in the other side of the room for example)
3.them you have to put a character with that civilian script AND the globalvar value had to be equal in the char script and in the door script, like both 40, that means you will be able to open the damm door when you finish talking with the char. you can make that situation infinite times in the map, just copy and past the script of the door and of the char, and modify the both copied scripts to another globalvar, like door gobal 50 and the char global 50. i think you can only modify the globalvar to maximum 999999, unfortiantely...back to the tutorial,after you put the char main A.I like that, we get to the next pass
4.put an holed(a hole when the plr can pass through) wall sized object and another object like that last one but not holed,and set their propreties like

A. the holed object needs to have those config

respanw
max at any time = 1
maximum spawn = 1
spawn at start = no
set the normal object name in the ifused propriety

and use any defalt script (don't care)

B.the normal one, you put has
spawn at start = yes
and in the A.I scripts
appear = appear1.fpi
main = destroyit (that destroy script)
destroy = stock script ''destroyandactivate.fpi''

that all will make the normal wall to disappear and the holed to appear when the door is opened

thanks everyone

mods for creating a inteligent game,at least
Flatlander
FPSC Tool Maker
17
Years of Service
User Offline
Joined: 22nd Jan 2007
Location: The Flatlands
Posted: 7th Jul 2010 03:06
I'm glad it's working. I just got back and was going to take a look.

gendestroier
13
Years of Service
User Offline
Joined: 5th Jun 2010
Location: Brazil
Posted: 7th Jul 2010 03:09 Edited at: 7th Jul 2010 03:24
Quote: "I'm glad it's working. I just got back and was going to take a look. "


thanks mate !!

the script was doing exacly what i said it to do... he was destroing the fence, BUT when the destroy A.I was suposed to be activated, it just didn't cuz the fence was already destroyed by the main script (i didn't knew the 3 A.I could interfere one in the job of the other)so...of course the engine didn't pay atention in the destroyandactivate script that was making the entire fence dissapear and simply don't activate the holed fence, a muppet rokie mistake

mods for creating a inteligent game,at least

Login to post a reply

Server time is: 2024-03-28 10:08:08
Your offset time is: 2024-03-28 10:08:08